Compare commits

...

2 commits

7 changed files with 554 additions and 520 deletions

30
flake.lock generated
View file

@ -746,11 +746,11 @@
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
},
"locked": {
"lastModified": 1742676311,
"narHash": "sha256-EZ+/JXbyE7r/e4tNftecWcWtzjb8YBOGLG75Z+rFgZg=",
"lastModified": 1743644801,
"narHash": "sha256-z8x/j/RuDBo/5lNt3XYatKRpIMFMHVE2HK7TKVxYn+c=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "d56129adbc7cc099b44eb134d2c25e3e2201ec7f",
"rev": "f3fca85fe72c70d58f44f4c6ad2f27a91aa54d0d",
"type": "github"
},
"original": {
@ -779,11 +779,11 @@
"niri-unstable": {
"flake": false,
"locked": {
"lastModified": 1742641057,
"narHash": "sha256-+OhtlQPNOKmwK6YtAaXPu42jXe3ufi7hny78N8dqDKA=",
"lastModified": 1743492917,
"narHash": "sha256-OqLDg0Ody1HX23hgjvjIkfZPNhYKxbkj/ONcDjdD4Ik=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "ed20822ce947198e4106698d7afffd0a832a7b3c",
"rev": "60034a57efd9c8130b05797b37cbc187a8c13145",
"type": "github"
},
"original": {
@ -926,11 +926,11 @@
},
"nixpkgs-stable_3": {
"locked": {
"lastModified": 1742512142,
"narHash": "sha256-8XfURTDxOm6+33swQJu/hx6xw1Tznl8vJJN5HwVqckg=",
"lastModified": 1743576891,
"narHash": "sha256-vXiKURtntURybE6FMNFAVpRPr8+e8KoLPrYs9TGuAKc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7105ae3957700a9646cc4b766f5815b23ed0c682",
"rev": "44a69ed688786e98a101f02b712c313f1ade37ab",
"type": "github"
},
"original": {
@ -1102,11 +1102,11 @@
},
"nixpkgs_8": {
"locked": {
"lastModified": 1742422364,
"narHash": "sha256-mNqIplmEohk5jRkqYqG19GA8MbQ/D4gQSK0Mu4LvfRQ=",
"lastModified": 1743583204,
"narHash": "sha256-F7n4+KOIfWrwoQjXrL2wD9RhFYLs2/GGe/MQY1sSdlE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a84ebe20c6bc2ecbcfb000a50776219f48d134cc",
"rev": "2c8d3f48d33929642c1c12cd243df4cc7d2ce434",
"type": "github"
},
"original": {
@ -1508,11 +1508,11 @@
"xwayland-satellite-unstable": {
"flake": false,
"locked": {
"lastModified": 1742671548,
"narHash": "sha256-nJK70IyhyOXth5Dcyv7DKtv95TTZkqcAYHVj4Uq2Blw=",
"lastModified": 1743346993,
"narHash": "sha256-i7rWd/5BcqLgQEtB5L/6gKN5R5GUJcmm34F+iBivH60=",
"owner": "Supreeeme",
"repo": "xwayland-satellite",
"rev": "0fa13c6fb43ae26a597103989a42e44a03d2d827",
"rev": "45c055696437a08e3989d9b91d9c617b84cc2bc3",
"type": "github"
},
"original": {

View file

@ -189,7 +189,12 @@
in
{
overlays.default = lib.composeManyExtensions overlays;
overlays = {
default = lib.composeManyExtensions overlays;
kakoune = final: prev: {
nki-kakoune = final.callPackage ./packages/common/nki-kakoune { };
};
};
packages.x86_64-linux.deploy-rs = deploy-rs.packages.x86_64-linux.default;
apps.x86_64-linux.deploy-rs = deploy-rs.apps.x86_64-linux.default;

View file

@ -2,21 +2,24 @@
callPackage,
kakoune,
kakoune-unwrapped,
nki-kak-util ? callPackage ./util.nix { },
nki-kak-lsp ? callPackage ./lsp.nix { },
nki-kak-rc ? callPackage ./rc.nix { },
nki-kak-plugins ? callPackage ./plugins.nix { util = nki-kak-util; },
nki-kak-kaktex ? callPackage ./kaktex { },
nki-kak-themes ? callPackage ./themes.nix { },
nki-kak-faces ? callPackage ./faces.nix { util = nki-kak-util; },
...
}:
let
lsp = callPackage ./lsp.nix { };
rc = (callPackage ./rc.nix { });
in
(kakoune.override {
plugins =
callPackage ./plugins.nix { }
++ callPackage ./themes.nix { }
nki-kak-plugins
++ nki-kak-themes
++ [
(callPackage ./kaktex { })
(callPackage ./faces.nix { })
rc
lsp.plugin
nki-kak-kaktex
nki-kak-faces
nki-kak-rc
nki-kak-lsp.plugin
];
}).overrideAttrs
(attrs: {
@ -27,6 +30,15 @@ in
rm "$out/bin/kak"
makeWrapper "${kakoune-unwrapped}/bin/kak" "$out/bin/kak" \
--set KAKOUNE_RUNTIME "$out/share/kak" \
--suffix PATH ":" "${lsp.extraPaths}"
--suffix PATH ":" "${nki-kak-lsp.extraPaths}"
'';
passthru = {
lsp = nki-kak-lsp;
rc = nki-kak-rc;
plugins = nki-kak-plugins;
kaktex = nki-kak-kaktex;
themes = nki-kak-themes;
faces = nki-kak-faces;
};
})

View file

@ -1,6 +1,9 @@
{ callPackage, ... }:
{
callPackage,
utils ? callPackage ./utils.nix { },
...
}:
let
utils = callPackage ./utils.nix { };
faces = {
Default = "%opt{text},%opt{base}";
BufferPadding = "%opt{base},%opt{base}";

View file

@ -19,449 +19,455 @@
marksman,
templ,
rust-analyzer,
overrideConfig ? (baseConfig: baseConfig),
extraSetup ? "",
...
}:
let
# Configuration for kak-lsp
config = {
languageIDs = {
c = "c_cpp";
cpp = "c_cpp";
javascript = "javascriptreact";
typescript = "typescriptreact";
protobuf = "proto";
sh = "shellscript";
};
config =
let
baseConfig = {
languageIDs = {
c = "c_cpp";
cpp = "c_cpp";
javascript = "javascriptreact";
typescript = "typescriptreact";
protobuf = "proto";
sh = "shellscript";
};
languageServers =
let
vscodeServerWith =
languageServers =
let
vscodeServerWith =
{
name,
extraFileTypes ? [ ],
}:
{
name = "vscode-${name}-language-server";
value = {
args = [ "--stdio" ];
command = "vscode-${name}-language-server";
filetypes = [ name ] ++ extraFileTypes;
roots = [
"package.json"
".git"
];
package = nodePackages.vscode-langservers-extracted;
};
};
in
{
name,
extraFileTypes ? [ ],
}:
{
name = "vscode-${name}-language-server";
value = {
args = [ "--stdio" ];
command = "vscode-${name}-language-server";
filetypes = [ name ] ++ extraFileTypes;
ccls = {
args = [
"-v=2"
"-log-file=/tmp/ccls.log"
];
package = ccls;
command = "ccls";
filetypes = [
"c"
"cpp"
];
roots = [
"compile_commands.json"
".cquery"
".git"
];
};
gopls = {
command = "gopls";
package = gopls;
filetypes = [ "go" ];
offset_encoding = "utf-8";
roots = [
"Gopkg.toml"
"go.mod"
".git"
".hg"
];
settings = {
gopls = {
hoverKind = "SynopsisDocumentation";
semanticTokens = true;
};
};
settings_section = "gopls";
};
haskell-language-server = {
args = [ "--lsp" ];
command = "haskell-language-server-wrapper";
filetypes = [ "haskell" ];
roots = [
"Setup.hs"
"stack.yaml"
"*.cabal"
"package.yaml"
];
settings_section = "haskell";
};
nil = {
command = "nil";
package = nil;
filetypes = [ "nix" ];
roots = [
"flake.nix"
"shell.nix"
".git"
];
settings.nil = {
formatting.command = [ "${lib.getExe nixfmt-rfc-style}" ];
};
};
pylsp = {
command = "pylsp";
package = python311Packages.python-lsp-server;
filetypes = [ "python" ];
offset_encoding = "utf-8";
roots = [
"requirements.txt"
"setup.py"
".git"
".hg"
];
};
# Spellchecking server
ltex-ls = {
command = "ltex-ls";
args = [ "--log-file=/tmp" ];
filetypes = [
"latex"
"typst"
];
roots = [
"main.tex"
"main.typ"
".git"
];
package = ltex-ls;
};
tailwind = {
command = "tailwindcss-language-server";
args = [ "--stdio" ];
filetypes = [
"html"
"css"
"javascript"
"typescript"
"templ"
];
roots = [
"tailwind.config.{js,cjs,mjs,ts}"
"package.json"
".git"
];
package = nodePackages.vscode-langservers-extracted;
settings_section = "tailwindCSS";
settings.tailwindCSS = {
validate = "warning";
userLanguages.templ = "html";
};
package = tailwindcss-language-server;
};
};
in
{
ccls = {
args = [
"-v=2"
"-log-file=/tmp/ccls.log"
];
package = ccls;
command = "ccls";
filetypes = [
"c"
"cpp"
];
roots = [
"compile_commands.json"
".cquery"
".git"
];
};
gopls = {
command = "gopls";
package = gopls;
filetypes = [ "go" ];
offset_encoding = "utf-8";
roots = [
"Gopkg.toml"
"go.mod"
".git"
".hg"
];
settings = {
gopls = {
hoverKind = "SynopsisDocumentation";
semanticTokens = true;
elixir-ls = {
args = [ ];
command = "elixir-ls";
filetypes = [ "elixir" ];
roots = [ "mix.exs" ];
};
};
settings_section = "gopls";
};
haskell-language-server = {
args = [ "--lsp" ];
command = "haskell-language-server-wrapper";
filetypes = [ "haskell" ];
roots = [
"Setup.hs"
"stack.yaml"
"*.cabal"
"package.yaml"
];
settings_section = "haskell";
};
nil = {
command = "nil";
package = nil;
filetypes = [ "nix" ];
roots = [
"flake.nix"
"shell.nix"
".git"
];
settings.nil = {
formatting.command = [ "${lib.getExe nixfmt-rfc-style}" ];
};
};
pylsp = {
command = "pylsp";
package = python311Packages.python-lsp-server;
filetypes = [ "python" ];
offset_encoding = "utf-8";
roots = [
"requirements.txt"
"setup.py"
".git"
".hg"
];
};
# Spellchecking server
ltex-ls = {
command = "ltex-ls";
args = [ "--log-file=/tmp" ];
filetypes = [
"latex"
"typst"
];
roots = [
"main.tex"
"main.typ"
".git"
];
package = ltex-ls;
};
tailwind = {
command = "tailwindcss-language-server";
args = [ "--stdio" ];
filetypes = [
"html"
"css"
"javascript"
"typescript"
"templ"
];
roots = [
"tailwind.config.{js,cjs,mjs,ts}"
"package.json"
".git"
];
settings_section = "tailwindCSS";
settings.tailwindCSS = {
validate = "warning";
userLanguages.templ = "html";
};
package = tailwindcss-language-server;
};
elixir-ls = {
args = [ ];
command = "elixir-ls";
filetypes = [ "elixir" ];
roots = [ "mix.exs" ];
};
typescript-language-server = {
args = [ "--stdio" ];
command = "typescript-language-server";
filetypes = [
"typescript"
"javascript"
];
roots = [ "package.json" ];
package = nodePackages.typescript-language-server;
};
fsautocomplete = {
args = [
"--adaptive-lsp-server-enabled"
"--project-graph-enabled"
"--source-text-factory"
"RoslynSourceText"
];
command = "fsautocomplete";
filetypes = [ "fsharp" ];
roots = [ "*.fsproj" ];
settings_section = "FSharp";
settings.FSharp = {
AutomaticWorkspaceInit = true;
};
package = fsautocomplete;
};
metals = {
command = "metals";
filetypes = [ "scala" ];
roots = [
"build.sbt"
"build.sc"
"build.mill"
];
settings_section = "metals";
settings.metals = {
inlayHints.inferredTypes.enable = true;
inlayHints.typeParameters.enable = true;
inlayHints.hintsInPatternMatch.enable = true;
# From kakoune-lsp's own options
icons = "unicode";
isHttpEnabled = true;
statusBarProvider = "log-message";
compilerOptions = {
overrideDefFormat = "unicode";
typescript-language-server = {
args = [ "--stdio" ];
command = "typescript-language-server";
filetypes = [
"typescript"
"javascript"
];
roots = [ "package.json" ];
package = nodePackages.typescript-language-server;
};
fsautocomplete = {
args = [
"--adaptive-lsp-server-enabled"
"--project-graph-enabled"
"--source-text-factory"
"RoslynSourceText"
];
command = "fsautocomplete";
filetypes = [ "fsharp" ];
roots = [ "*.fsproj" ];
settings_section = "FSharp";
settings.FSharp = {
AutomaticWorkspaceInit = true;
};
package = fsautocomplete;
};
metals = {
command = "metals";
filetypes = [ "scala" ];
roots = [
"build.sbt"
"build.sc"
"build.mill"
];
settings_section = "metals";
settings.metals = {
inlayHints.inferredTypes.enable = true;
inlayHints.typeParameters.enable = true;
inlayHints.hintsInPatternMatch.enable = true;
# From kakoune-lsp's own options
icons = "unicode";
isHttpEnabled = true;
statusBarProvider = "log-message";
compilerOptions = {
overrideDefFormat = "unicode";
};
};
package = metals;
};
texlab = {
command = "texlab";
filetypes = [ "latex" ];
roots = [
"main.tex"
"all.tex"
".git"
];
settings_section = "texlab";
settings.texlab = {
build.executable = "latexmk";
build.args = [
"-pdf"
"-shell-escape"
"-interaction=nonstopmode"
"-synctex=1"
"%f"
];
build.forwardSearchAfter = true;
build.onSave = true;
# forwardSearch =
# (if pkgs.stdenv.isDarwin then {
# executable = "/Applications/Skim.app/Contents/SharedSupport/displayline";
# args = [ "-r" "-g" "%l" "%p" "%f" ];
# } else
# {
# executable = "${pkgs.zathura}/bin/zathura";
# args = [ "--synctex-forward" "%l:1:%f" "%p" "-x" "${./kaktex} jump %%{input} %%{line} %%{column}" ];
# });
};
package = texlab;
};
tinymist = {
command = "tinymist";
filetypes = [ "typst" ];
roots = [
"main.typ"
".git"
];
settings_section = "tinymist";
settings.tinymist = {
exportPdf = "onSave";
formatterMode = "typstfmt";
};
package = tinymist;
};
marksman = {
command = "marksman";
filetypes = [ "markdown" ];
roots = [
".marksman.toml"
".git"
];
package = marksman;
};
templ = {
command = "templ";
args = [ "lsp" ];
filetypes = [ "templ" ];
roots = [
"go.mod"
".git"
];
package = templ;
};
rust-analyzer = {
args = [ ];
command = "rust-analyzer";
filetypes = [ "rust" ];
roots = [ "Cargo.toml" ];
package = rust-analyzer;
};
}
// (builtins.listToAttrs (
builtins.map
(
ft:
vscodeServerWith {
name = ft;
extraFileTypes = if ft == "json" then [ ] else [ "templ" ];
}
)
[
"html"
"css"
"json"
]
));
faces = [
## Items
# (Rust) Macros
{
face = "attribute";
token = "attribute";
}
{
face = "attribute";
token = "derive";
}
{
face = "macro";
token = "macro";
} # Function-like Macro
# Keyword and Fixed Tokens
{
face = "keyword";
token = "keyword";
}
{
face = "operator";
token = "operator";
}
# Functions and Methods
{
face = "function";
token = "function";
}
{
face = "method";
token = "method";
}
# Constants
{
face = "string";
token = "string";
}
{
face = "format_specifier";
token = "formatSpecifier";
}
# Variables
{
face = "variable";
token = "variable";
modifiers = [ "readonly" ];
}
{
face = "mutable_variable";
token = "variable";
}
{
face = "module";
token = "namespace";
}
{
face = "variable";
token = "type_parameter";
}
{
face = "class";
token = "enum";
}
{
face = "class";
token = "struct";
}
{
face = "class";
token = "trait";
}
{
face = "class";
token = "union";
}
{
face = "class";
token = "class";
}
## Comments
{
face = "documentation";
token = "comment";
modifiers = [ "documentation" ];
}
{
face = "comment";
token = "comment";
}
# Typst
{
face = "header";
token = "heading";
}
{
face = "ts_markup_link_url";
token = "link";
}
{
face = "ts_markup_link_uri";
token = "ref";
}
{
face = "ts_markup_link_label";
token = "label";
}
{
face = "ts_property";
token = "pol";
}
{
face = "ts_markup_list_checked";
token = "marker";
}
{
face = "ts_constant_builtin_boolean";
token = "bool";
}
{
face = "ts_keyword_control";
token = "delim";
}
{
face = "ts_number";
token = "text";
modifiers = [ "math" ];
}
{
face = "ts_markup_bold";
token = "text";
modifiers = [ "strong" ];
}
{
face = "ts_markup_italic";
token = "text";
modifiers = [ "emph" ];
}
];
raw = {
server = {
timeout = 1800;
};
package = metals;
snippet_support = false;
verbosity = 255;
};
texlab = {
command = "texlab";
filetypes = [ "latex" ];
roots = [
"main.tex"
"all.tex"
".git"
];
settings_section = "texlab";
settings.texlab = {
build.executable = "latexmk";
build.args = [
"-pdf"
"-shell-escape"
"-interaction=nonstopmode"
"-synctex=1"
"%f"
];
build.forwardSearchAfter = true;
build.onSave = true;
# forwardSearch =
# (if pkgs.stdenv.isDarwin then {
# executable = "/Applications/Skim.app/Contents/SharedSupport/displayline";
# args = [ "-r" "-g" "%l" "%p" "%f" ];
# } else
# {
# executable = "${pkgs.zathura}/bin/zathura";
# args = [ "--synctex-forward" "%l:1:%f" "%p" "-x" "${./kaktex} jump %%{input} %%{line} %%{column}" ];
# });
};
package = texlab;
};
tinymist = {
command = "tinymist";
filetypes = [ "typst" ];
roots = [
"main.typ"
".git"
];
settings_section = "tinymist";
settings.tinymist = {
exportPdf = "onSave";
formatterMode = "typstfmt";
};
package = tinymist;
};
marksman = {
command = "marksman";
filetypes = [ "markdown" ];
roots = [
".marksman.toml"
".git"
];
package = marksman;
};
templ = {
command = "templ";
args = [ "lsp" ];
filetypes = [ "templ" ];
roots = [
"go.mod"
".git"
];
package = templ;
};
rust-analyzer = {
args = [ ];
command = "rust-analyzer";
filetypes = [ "rust" ];
roots = [ "Cargo.toml" ];
package = rust-analyzer;
};
}
// (builtins.listToAttrs (
builtins.map
(
ft:
vscodeServerWith {
name = ft;
extraFileTypes = if ft == "json" then [ ] else [ "templ" ];
}
)
[
"html"
"css"
"json"
]
));
faces = [
## Items
# (Rust) Macros
{
face = "attribute";
token = "attribute";
}
{
face = "attribute";
token = "derive";
}
{
face = "macro";
token = "macro";
} # Function-like Macro
# Keyword and Fixed Tokens
{
face = "keyword";
token = "keyword";
}
{
face = "operator";
token = "operator";
}
# Functions and Methods
{
face = "function";
token = "function";
}
{
face = "method";
token = "method";
}
# Constants
{
face = "string";
token = "string";
}
{
face = "format_specifier";
token = "formatSpecifier";
}
# Variables
{
face = "variable";
token = "variable";
modifiers = [ "readonly" ];
}
{
face = "mutable_variable";
token = "variable";
}
{
face = "module";
token = "namespace";
}
{
face = "variable";
token = "type_parameter";
}
{
face = "class";
token = "enum";
}
{
face = "class";
token = "struct";
}
{
face = "class";
token = "trait";
}
{
face = "class";
token = "union";
}
{
face = "class";
token = "class";
}
## Comments
{
face = "documentation";
token = "comment";
modifiers = [ "documentation" ];
}
{
face = "comment";
token = "comment";
}
# Typst
{
face = "header";
token = "heading";
}
{
face = "ts_markup_link_url";
token = "link";
}
{
face = "ts_markup_link_uri";
token = "ref";
}
{
face = "ts_markup_link_label";
token = "label";
}
{
face = "ts_property";
token = "pol";
}
{
face = "ts_markup_list_checked";
token = "marker";
}
{
face = "ts_constant_builtin_boolean";
token = "bool";
}
{
face = "ts_keyword_control";
token = "delim";
}
{
face = "ts_number";
token = "text";
modifiers = [ "math" ];
}
{
face = "ts_markup_bold";
token = "text";
modifiers = [ "strong" ];
}
{
face = "ts_markup_italic";
token = "text";
modifiers = [ "emph" ];
}
];
raw = {
server = {
timeout = 1800;
};
snippet_support = false;
verbosity = 255;
};
};
in
overrideConfig baseConfig;
per-lang-config =
lang:
@ -602,6 +608,9 @@ in
## Faces
${faces-config}
## Extra setup
${extraSetup}
}
'';
}

View file

@ -1,59 +1,14 @@
{
pkgs,
symlinkJoin,
writeTextDir,
kakouneUtils,
callPackage,
utils ? callPackage ./utils.nix { },
fetchFromGitHub,
fetchFromGitLab,
luajit,
...
}:
with {
inherit (kakouneUtils) buildKakounePluginFrom2Nix;
inherit (utils) toDir writeModuleWrapper kakounePlugin;
};
let
toDir = name: file: writeTextDir name (builtins.readFile file);
writeActivationScript =
script:
writeTextDir "on-load.kak" ''
hook global KakBegin .* %{
${script}
}
'';
writeModuleWrapper =
name: script:
writeTextDir "module.kak" ''
provide-module ${name} %
${script}
'';
kakounePlugin =
{
name,
src,
wrapAsModule ? false,
activationScript ? null,
...
}@attrs:
let
module = if wrapAsModule then writeModuleWrapper name (builtins.readFile src) else src;
in
buildKakounePluginFrom2Nix {
pname = name;
version = attrs.version or "latest";
src =
if activationScript == null then
module
else
symlinkJoin {
name = "${name}-src";
paths = [
module
(writeActivationScript activationScript)
];
};
};
in
builtins.map kakounePlugin [
# My own scripts
{
@ -68,7 +23,7 @@ builtins.map kakounePlugin [
# Plugins
{
name = "luar";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "gustavo-hms";
repo = "luar";
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
@ -78,12 +33,12 @@ builtins.map kakounePlugin [
# Enable luar
require-module luar
# Use luajit
set-option global luar_interpreter ${pkgs.luajit}/bin/luajit
set-option global luar_interpreter ${luajit}/bin/luajit
'';
}
{
name = "peneira";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "gustavo-hms";
repo = "peneira";
rev = "b56dd10bb4771da327b05a9071b3ee9a092f9788";
@ -128,7 +83,7 @@ builtins.map kakounePlugin [
}
{
name = "kakoune-focus";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "caksoylar";
repo = "kakoune-focus";
rev = "949c0557cd4c476822acfa026ca3c50f3d38a3c0";
@ -140,7 +95,7 @@ builtins.map kakounePlugin [
}
{
name = "kakoune-inc-dec";
src = pkgs.fetchFromGitLab {
src = fetchFromGitLab {
owner = "Screwtapello";
repo = "kakoune-inc-dec";
rev = "7bfe9c51";
@ -158,14 +113,10 @@ builtins.map kakounePlugin [
})
+ "/rc";
}
# {
# name = "kakoune-discord";
# src = (builtins.getFlake "github:natsukagami/kakoune-discord/03f95e40d6efd8fd3de7bca31653d43de2dcfc5f").packages.${pkgs.system}.kakoune-discord-rc + "/rc";
# }
rec {
name = "kakoune-mirror";
src =
pkgs.fetchFromGitHub {
fetchFromGitHub {
owner = "Delapouite";
repo = "kakoune-mirror";
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
@ -182,7 +133,7 @@ builtins.map kakounePlugin [
}
{
name = "unicode-math";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "natsukagami";
repo = "kakoune-unicode-math";
rev = "08dff25da2b86ee0b0777091992bc7fb28c3cb1d";
@ -199,7 +150,7 @@ builtins.map kakounePlugin [
}
{
name = "kakoune-buffers";
src = pkgs.fetchFromGitHub {
src = fetchFromGitHub {
owner = "Delapouite";
repo = "kakoune-buffers";
rev = "6b2081f5b7d58c72de319a5cba7bf628b6802881";

View file

@ -1,5 +1,14 @@
{ lib, writeTextDir, ... }:
{
lib,
writeTextDir,
kakouneUtils,
symlinkJoin,
...
}:
with {
inherit (kakouneUtils) buildKakounePluginFrom2Nix;
};
rec {
mkFacesScript =
name: faces:
writeTextDir "share/kak/autoload/${name}/faces.kak" ''
@ -9,4 +18,49 @@
)}
}
'';
toDir = name: file: writeTextDir name (builtins.readFile file);
writeActivationScript =
script:
writeTextDir "on-load.kak" ''
hook global KakBegin .* %{
${script}
}
'';
writeModuleWrapper =
name: script:
writeTextDir "module.kak" ''
provide-module ${name} %
${script}
'';
kakounePlugin =
{
name,
src,
wrapAsModule ? false,
activationScript ? null,
...
}@attrs:
let
module = if wrapAsModule then writeModuleWrapper name (builtins.readFile src) else src;
in
buildKakounePluginFrom2Nix {
pname = name;
version = attrs.version or "latest";
src =
if activationScript == null then
module
else
symlinkJoin {
name = "${name}-src";
paths = [
module
(writeActivationScript activationScript)
];
};
};
}