kakoune: add colorSchemePackage option

This makes it easy to declaratively manage the color scheme for kakoune via a nix package in your ``~/.config/kak/colors`` folder.
The color scheme can then be declaratively selected by name using the existing hm option ``programs.kakoune.config.colorScheme``
This commit is contained in:
Philip Wilk 2024-07-20 20:04:28 +01:00
parent afd2021bed
commit fba19d46c5
No known key found for this signature in database

View file

@ -658,12 +658,29 @@ in {
{command}`nix-env -f '<nixpkgs>' -qaP -A kakounePlugins`.
'';
};
colorSchemePackage = mkOption {
type = with types; nullOr package;
default = null;
example = literalExpression "pkgs.kakounePlugins.kakoune-catppuccin";
description = ''
A kakoune color schemes to add to your colors folder.
This works because kakoune recursively checks `$XDG_CONFIG_HOME/kak/colors/`.
To apply the color scheme use `programs.kakoune.config.colorScheme = "theme"`.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ kakouneWithPlugins ];
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "kak"; };
xdg.configFile."kak/kakrc".source = configFile;
};
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ kakouneWithPlugins ];
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "kak"; };
xdg.configFile."kak/kakrc".source = configFile;
}
(mkIf (cfg.colorSchemePackage != null) {
xdg.configFile."kak/colors/${cfg.colorSchemePackage.name}".source =
cfg.colorSchemePackage;
})
]);
}