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