kak: Clean up add-on dependencies and add kak-mirror
This commit is contained in:
parent
096c2654a2
commit
e68000c5eb
|
@ -17,11 +17,6 @@ let
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
activationScript = text: pkgs.writeText "config.kak" ''
|
|
||||||
hook global KakBegin .* %{
|
|
||||||
${text}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ../modules/programs/my-kakoune ./kaktex.nix ];
|
imports = [ ../modules/programs/my-kakoune ./kaktex.nix ];
|
||||||
|
@ -92,17 +87,14 @@ in
|
||||||
|
|
||||||
# Plugins
|
# Plugins
|
||||||
{
|
{
|
||||||
name = "01-luar";
|
name = "luar";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "gustavo-hms";
|
owner = "gustavo-hms";
|
||||||
repo = "luar";
|
repo = "luar";
|
||||||
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
|
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
|
||||||
sha256 = "sha256-vHn/V3sfzaxaxF8OpA5jPEuPstOVwOiQrogdSGtT6X4=";
|
sha256 = "sha256-vHn/V3sfzaxaxF8OpA5jPEuPstOVwOiQrogdSGtT6X4=";
|
||||||
};
|
};
|
||||||
}
|
activationScript = ''
|
||||||
{
|
|
||||||
name = "02-luar-config.kak";
|
|
||||||
src = activationScript ''
|
|
||||||
# Enable luar
|
# Enable luar
|
||||||
require-module luar
|
require-module luar
|
||||||
# Use luajit
|
# Use luajit
|
||||||
|
@ -110,17 +102,14 @@ in
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "03-peneira";
|
name = "peneira";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "natsukagami";
|
owner = "natsukagami";
|
||||||
repo = "peneira";
|
repo = "peneira";
|
||||||
rev = "743b9971472853a752475e7c070ce99089c6840c";
|
rev = "743b9971472853a752475e7c070ce99089c6840c";
|
||||||
sha256 = "sha256-E4ndbF9YC1p0KrvSuGgwmG1Y2IGTuGKJo/AuMixhzlM=";
|
sha256 = "sha256-E4ndbF9YC1p0KrvSuGgwmG1Y2IGTuGKJo/AuMixhzlM=";
|
||||||
};
|
};
|
||||||
}
|
activationScript = ''
|
||||||
{
|
|
||||||
name = "04-peneira-config.kak";
|
|
||||||
src = activationScript ''
|
|
||||||
require-module peneira
|
require-module peneira
|
||||||
|
|
||||||
# Change selection color
|
# Change selection color
|
||||||
|
@ -158,17 +147,14 @@ in
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "01-kakoune-focus";
|
name = "kakoune-focus";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "caksoylar";
|
owner = "caksoylar";
|
||||||
repo = "kakoune-focus";
|
repo = "kakoune-focus";
|
||||||
rev = "949c0557cd4c476822acfa026ca3c50f3d38a3c0";
|
rev = "949c0557cd4c476822acfa026ca3c50f3d38a3c0";
|
||||||
sha256 = "sha256-ZV7jlLJQyL420YG++iC9rq1SMjo3WO5hR9KVvJNUiCs=";
|
sha256 = "sha256-ZV7jlLJQyL420YG++iC9rq1SMjo3WO5hR9KVvJNUiCs=";
|
||||||
};
|
};
|
||||||
}
|
activationScript = ''
|
||||||
{
|
|
||||||
name = "02-kakoune-focus-config.kak";
|
|
||||||
src = activationScript ''
|
|
||||||
map global user <space> ': focus-toggle<ret>' -docstring "toggle selections focus"
|
map global user <space> ': focus-toggle<ret>' -docstring "toggle selections focus"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
@ -179,7 +165,6 @@ in
|
||||||
repo = "kakoune-inc-dec";
|
repo = "kakoune-inc-dec";
|
||||||
rev = "7bfe9c51";
|
rev = "7bfe9c51";
|
||||||
sha256 = "0f33wqxqbfygxypf348jf1fiscac161wf2xvnh8zwdd3rq5yybl0";
|
sha256 = "0f33wqxqbfygxypf348jf1fiscac161wf2xvnh8zwdd3rq5yybl0";
|
||||||
# leaveDotGit = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -195,6 +180,23 @@ in
|
||||||
name = "kakoune-discord";
|
name = "kakoune-discord";
|
||||||
src = (builtins.getFlake "github:natsukagami/kakoune-discord/03f95e40d6efd8fd3de7bca31653d43de2dcfc5f").packages.${pkgs.system}.kakoune-discord-rc + "/rc";
|
src = (builtins.getFlake "github:natsukagami/kakoune-discord/03f95e40d6efd8fd3de7bca31653d43de2dcfc5f").packages.${pkgs.system}.kakoune-discord-rc + "/rc";
|
||||||
}
|
}
|
||||||
|
rec {
|
||||||
|
name = "kakoune-mirror";
|
||||||
|
src = pkgs.fetchFromGitHub
|
||||||
|
{
|
||||||
|
owner = "Delapouite";
|
||||||
|
repo = "kakoune-mirror";
|
||||||
|
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
|
||||||
|
sha256 = "sha256-uslx4zZhvjUylrPWvTOugsKYKKpF0EEz1drc1Ckrpjk=";
|
||||||
|
} + "/mirror.kak";
|
||||||
|
wrapAsModule = true;
|
||||||
|
activationScript = ''
|
||||||
|
require-module ${name}
|
||||||
|
|
||||||
|
# Bind <a-w> to ${name}
|
||||||
|
map global normal <a-w> ': enter-user-mode -lock mirror<ret>'
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,16 @@ let
|
||||||
type = types.path;
|
type = types.path;
|
||||||
description = "Path to the autoload script/folder.";
|
description = "Path to the autoload script/folder.";
|
||||||
};
|
};
|
||||||
|
wrapAsModule = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Wrap the given source file in a `provide-module` command. Fails if the `src` is not a single file.";
|
||||||
|
};
|
||||||
|
activationScript = mkOption {
|
||||||
|
type = types.nullOr types.lines;
|
||||||
|
default = null;
|
||||||
|
description = "Add an activation script to the module. It will be wrapped in a `hook global KakBegin .*` wrapper.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
@ -44,24 +54,48 @@ in
|
||||||
|
|
||||||
home.file =
|
home.file =
|
||||||
let
|
let
|
||||||
kakouneAutoload = { name, src }: {
|
kakouneAutoload = { name, src, wrapAsModule ? false, activationScript ? null }:
|
||||||
|
[
|
||||||
|
(if !wrapAsModule then {
|
||||||
name = "kakoune/autoload/${name}";
|
name = "kakoune/autoload/${name}";
|
||||||
value = {
|
value = {
|
||||||
source = src;
|
source = src;
|
||||||
target = ".config/kak/autoload/${name}";
|
target = ".config/kak/autoload/${name}";
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
name = "kakoune/autoload/${name}/module.kak";
|
||||||
|
value = {
|
||||||
|
text = ''
|
||||||
|
provide-module ${name} %◍
|
||||||
|
${readFile src}
|
||||||
|
◍
|
||||||
|
'';
|
||||||
|
target = ".config/kak/autoload/${name}/module.kak";
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
] ++ (if activationScript == null then [ ] else [{
|
||||||
|
name = "kakoune/autoload/on-load/${name}.kak";
|
||||||
|
value = {
|
||||||
|
text = ''
|
||||||
|
hook global KakBegin .* %{
|
||||||
|
${activationScript}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
target = ".config/kak/autoload/on-load/${name}.kak";
|
||||||
|
};
|
||||||
|
}]);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# kakrc
|
# kakrc
|
||||||
".config/kak/kakrc".text = cfg.rc;
|
".config/kak/kakrc".text = cfg.rc;
|
||||||
} //
|
} //
|
||||||
(builtins.listToAttrs (map kakouneAutoload ([
|
(builtins.listToAttrs (lib.lists.flatten (map kakouneAutoload ([
|
||||||
# include the original autoload files
|
# include the original autoload files
|
||||||
{
|
{
|
||||||
name = "00-rc";
|
name = "rc";
|
||||||
src = "${cfg.package}/share/kak/autoload/rc";
|
src = "${cfg.package}/share/kak/autoload/rc";
|
||||||
}
|
}
|
||||||
] ++ cfg.autoload)));
|
] ++ cfg.autoload))));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue