nixpkgs/nixos/modules/programs/yazi.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

124 lines
2.4 KiB
Nix
Raw Permalink Normal View History

2023-09-03 15:15:23 +08:00
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.yazi;
settingsFormat = pkgs.formats.toml { };
files = [
"yazi"
"theme"
"keymap"
];
2023-09-03 15:15:23 +08:00
in
{
options.programs.yazi = {
enable = lib.mkEnableOption "yazi terminal file manager";
package = lib.mkPackageOption pkgs "yazi" { };
2023-09-03 15:15:23 +08:00
settings = lib.mkOption {
type =
with lib.types;
submodule {
options = (
lib.listToAttrs (
map (
2023-09-03 15:15:23 +08:00
name:
lib.nameValuePair name (
lib.mkOption {
inherit (settingsFormat) type;
default = { };
description = ''
Configuration included in `${name}.toml`.
2024-02-18 19:50:39 +08:00
See https://yazi-rs.github.io/docs/configuration/${name}/ for documentation.
2023-09-03 15:15:23 +08:00
'';
}
)
) files
)
);
2023-09-03 15:15:23 +08:00
};
default = { };
description = ''
Configuration included in `$YAZI_CONFIG_HOME`.
'';
};
initLua = lib.mkOption {
type = with lib.types; nullOr path;
default = null;
description = ''
The init.lua for Yazi itself.
'';
2024-04-07 22:54:18 +08:00
example = lib.literalExpression "./init.lua";
};
2024-04-07 22:54:18 +08:00
plugins = lib.mkOption {
type =
with lib.types;
attrsOf (oneOf [
path
package
]);
default = { };
description = ''
Lua plugins.
2024-04-07 22:54:18 +08:00
See https://yazi-rs.github.io/docs/plugins/overview/ for documentation.
'';
2024-04-07 22:54:18 +08:00
example = lib.literalExpression ''
{
foo = ./foo;
inherit (pkgs.yaziPlugins) bar;
2024-04-07 22:54:18 +08:00
}
'';
};
flavors = lib.mkOption {
type =
with lib.types;
attrsOf (oneOf [
path
package
]);
default = { };
description = ''
Pre-made themes.
See https://yazi-rs.github.io/docs/flavors/overview/ for documentation.
'';
example = lib.literalExpression ''
{
foo = ./foo;
inherit (pkgs.yaziPlugins) bar;
}
'';
};
2023-09-03 15:15:23 +08:00
};
config = lib.mkIf cfg.enable {
2024-04-07 22:54:18 +08:00
environment.systemPackages = [
(cfg.package.override {
inherit (cfg)
settings
initLua
plugins
flavors
;
})
];
2023-09-03 15:15:23 +08:00
};
2024-04-07 22:54:18 +08:00
2023-09-13 14:19:04 +08:00
meta = {
maintainers = with lib.maintainers; [ linsui ];
};
2023-09-03 15:15:23 +08:00
}