2023-09-03 09:15:23 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.yazi;
|
|
|
|
|
|
|
|
settingsFormat = pkgs.formats.toml { };
|
|
|
|
|
|
|
|
names = [ "yazi" "theme" "keymap" ];
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.programs.yazi = {
|
2024-04-13 14:54:15 +02:00
|
|
|
enable = lib.mkEnableOption "yazi terminal file manager";
|
2023-09-03 09:15:23 +02:00
|
|
|
|
2023-11-30 19:03:14 +01:00
|
|
|
package = lib.mkPackageOption pkgs "yazi" { };
|
2023-09-03 09:15:23 +02:00
|
|
|
|
|
|
|
settings = lib.mkOption {
|
|
|
|
type = with lib.types; submodule {
|
|
|
|
options = lib.listToAttrs (map
|
|
|
|
(name: lib.nameValuePair name (lib.mkOption {
|
|
|
|
inherit (settingsFormat) type;
|
|
|
|
default = { };
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2023-09-03 09:15:23 +02:00
|
|
|
Configuration included in `${name}.toml`.
|
|
|
|
|
2024-02-18 12:50:39 +01:00
|
|
|
See https://yazi-rs.github.io/docs/configuration/${name}/ for documentation.
|
2023-09-03 09:15:23 +02:00
|
|
|
'';
|
|
|
|
}))
|
|
|
|
names);
|
|
|
|
};
|
|
|
|
default = { };
|
2024-04-13 14:54:15 +02:00
|
|
|
description = ''
|
2023-09-03 09:15:23 +02:00
|
|
|
Configuration included in `$YAZI_CONFIG_HOME`.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
environment = {
|
|
|
|
systemPackages = [ cfg.package ];
|
|
|
|
variables.YAZI_CONFIG_HOME = "/etc/yazi/";
|
|
|
|
etc = lib.attrsets.mergeAttrsList (map
|
|
|
|
(name: lib.optionalAttrs (cfg.settings.${name} != { }) {
|
|
|
|
"yazi/${name}.toml".source = settingsFormat.generate "${name}.toml" cfg.settings.${name};
|
|
|
|
})
|
|
|
|
names);
|
|
|
|
};
|
|
|
|
};
|
2023-09-13 08:19:04 +02:00
|
|
|
meta = {
|
|
|
|
maintainers = with lib.maintainers; [ linsui ];
|
|
|
|
};
|
2023-09-03 09:15:23 +02:00
|
|
|
}
|