2024-10-07 20:25:59 +00:00
|
|
|
{ config, options, pkgs, lib, ... }:
|
2022-01-12 20:55:53 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.my-kakoune;
|
|
|
|
in
|
|
|
|
{
|
2024-10-07 20:25:59 +00:00
|
|
|
imports = [ ./fish-session.nix ./tree-sitter.nix ];
|
2022-01-12 20:55:53 +00:00
|
|
|
|
|
|
|
options.programs.my-kakoune = {
|
|
|
|
enable = mkEnableOption "My version of the kakoune configuration";
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
2024-10-07 20:25:59 +00:00
|
|
|
default = pkgs.nki-kakoune;
|
2022-01-12 20:55:53 +00:00
|
|
|
description = "The kakoune package to be installed";
|
|
|
|
};
|
|
|
|
rc = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
|
|
|
description = "Content of the kakrc file. A line-concatenated string";
|
|
|
|
};
|
2023-06-30 11:38:46 +00:00
|
|
|
extraFaces = mkOption {
|
|
|
|
type = types.attrsOf types.str;
|
|
|
|
default = { };
|
|
|
|
description = "Extra faces to include";
|
|
|
|
};
|
2024-10-07 20:25:59 +00:00
|
|
|
autoloadFile = mkOption {
|
|
|
|
type = options.xdg.configFile.type;
|
|
|
|
default = { };
|
|
|
|
description = "Extra autoload files";
|
|
|
|
};
|
2022-01-12 20:55:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
2023-06-29 16:36:53 +00:00
|
|
|
xdg.configFile =
|
2022-01-12 20:55:53 +00:00
|
|
|
let
|
2023-06-30 11:38:46 +00:00
|
|
|
kakouneFaces =
|
|
|
|
let
|
|
|
|
txt = strings.concatStringsSep "\n" (builtins.attrValues (builtins.mapAttrs (name: face: "face global ${name} \"${face}\"") cfg.extraFaces));
|
|
|
|
in
|
|
|
|
pkgs.writeText "faces.kak" txt;
|
2022-01-12 20:55:53 +00:00
|
|
|
in
|
|
|
|
{
|
2024-10-07 20:25:59 +00:00
|
|
|
"kak/autoload/builtin".source = "${cfg.package}/share/kak/autoload";
|
2022-01-12 20:55:53 +00:00
|
|
|
# kakrc
|
2023-06-30 11:38:46 +00:00
|
|
|
"kak/kakrc".text = ''
|
|
|
|
${cfg.rc}
|
|
|
|
|
|
|
|
# Load faces
|
|
|
|
source ${kakouneFaces}
|
|
|
|
'';
|
2024-10-07 20:25:59 +00:00
|
|
|
} // lib.mapAttrs'
|
|
|
|
(name: attrs: {
|
|
|
|
name = "kak/autoload/${name}";
|
|
|
|
value = attrs // {
|
|
|
|
target = "kak/autoload/${name}";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
cfg.autoloadFile;
|
2022-01-12 20:55:53 +00:00
|
|
|
};
|
|
|
|
}
|
2022-10-03 08:00:33 +00:00
|
|
|
|