From 2f7739d01080feb4549524e8f6927669b61c6ee3 Mon Sep 17 00:00:00 2001
From: Philip Wilk
Date: Sat, 20 Jul 2024 20:04:28 +0100
Subject: [PATCH] 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 Home Manager option `programs.kakoune.config.colorScheme`.
---
modules/programs/kakoune.nix | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/modules/programs/kakoune.nix b/modules/programs/kakoune.nix
index da0af0c06..e68a8568e 100644
--- a/modules/programs/kakoune.nix
+++ b/modules/programs/kakoune.nix
@@ -658,12 +658,29 @@ in {
{command}`nix-env -f '' -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
+ {file}`$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;
+ xdg.configFile = mkMerge [
+ { "kak/kakrc".source = configFile; }
+ (mkIf (cfg.colorSchemePackage != null) {
+ "kak/colors/${cfg.colorSchemePackage.name}" = cfg.colorSchemePackage;
+ })
+ ];
};
}