nixpkgs/nixos/modules/programs/yazi.nix

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

91 lines
2.1 KiB
Nix
Raw Normal View History

2023-09-03 07:15:23 +00:00
{ config, lib, pkgs, ... }:
let
cfg = config.programs.yazi;
settingsFormat = pkgs.formats.toml { };
files = [ "yazi" "theme" "keymap" ];
2023-09-03 07:15:23 +00:00
in
{
options.programs.yazi = {
enable = lib.mkEnableOption "yazi terminal file manager";
package = lib.mkPackageOption pkgs "yazi" { };
2023-09-03 07:15:23 +00:00
settings = lib.mkOption {
type = with lib.types; submodule {
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
'';
}))
files));
2023-09-03 07:15:23 +00: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 14:54:18 +00:00
example = lib.literalExpression "./init.lua";
};
2024-04-07 14:54:18 +00:00
plugins = lib.mkOption {
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-04-07 14:54:18 +00:00
example = lib.literalExpression ''
{
foo = ./foo;
bar = pkgs.bar;
}
'';
};
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
}