DashNix/modules/programs/yazi/default.nix
2024-11-09 16:19:50 +01:00

53 lines
1.3 KiB
Nix

{
lib,
config,
options,
...
}:
{
options.mods.yazi = {
enable = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Enables yazi";
};
useDefaultConfig = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Use default yazi config (if disabled only additionalConfig is used)";
};
additionalConfig = lib.mkOption {
default = { };
example = { };
type = with lib.types; attrsOf anything;
description = "Additional config for yazi";
};
useDefaultKeymap = lib.mkOption {
default = true;
example = false;
type = lib.types.bool;
description = "Use default yazi keymap (if disabled only additionalKeymap is used)";
};
additionalKeymap = lib.mkOption {
default = { };
example = { };
type = with lib.types; attrsOf anything;
description = "Additional keymap for yazi";
};
};
config =
let
conf = import ./yazi.nix;
in
lib.optionalAttrs (options ? home.packages) (
lib.mkIf config.mods.yazi.enable {
programs.yazi = {
enable = conf.enable;
settings = conf.settings // config.mods.yazi.additionalKeymap;
keymap = conf.keymap // config.mods.yazi.additionalConfig;
};
}
);
}