68 lines
1.6 KiB
Nix
68 lines
1.6 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
let
|
|
cfg = config.programs.my-kakoune;
|
|
|
|
autoloadModule = types.submodule {
|
|
options = {
|
|
name = mkOption {
|
|
type = types.str;
|
|
description = "Name of the autoload script/folder. It might affect kakoune's load order.";
|
|
};
|
|
src = mkOption {
|
|
type = types.path;
|
|
description = "Path to the autoload script/folder.";
|
|
};
|
|
};
|
|
};
|
|
in
|
|
{
|
|
imports = [ ./kak-lsp.nix ./fish-session.nix ];
|
|
|
|
options.programs.my-kakoune = {
|
|
enable = mkEnableOption "My version of the kakoune configuration";
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.kakoune;
|
|
description = "The kakoune package to be installed";
|
|
};
|
|
rc = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = "Content of the kakrc file. A line-concatenated string";
|
|
};
|
|
autoload = mkOption {
|
|
type = types.listOf autoloadModule;
|
|
default = [ ];
|
|
description = "Sources to autoload";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
home.file =
|
|
let
|
|
kakouneAutoload = { name, src }: {
|
|
name = "kakoune/autoload/${name}";
|
|
value = {
|
|
source = src;
|
|
target = ".config/kak/autoload/${name}";
|
|
};
|
|
};
|
|
in
|
|
{
|
|
# kakrc
|
|
".config/kak/kakrc".text = cfg.rc;
|
|
} //
|
|
(builtins.listToAttrs (map kakouneAutoload ([
|
|
# include the original autoload files
|
|
{
|
|
name = "00-rc";
|
|
src = "${cfg.package}/share/kak/autoload/rc";
|
|
}
|
|
] ++ cfg.autoload)));
|
|
};
|
|
}
|