···
settingsFormat = pkgs.formats.toml { };
8
-
names = [ "yazi" "theme" "keymap" ];
8
+
files = [ "yazi" "theme" "keymap" ];
10
+
dirs = [ "plugins" "flavors" ];
options.programs.yazi = {
···
settings = lib.mkOption {
type = with lib.types; submodule {
18
-
options = lib.listToAttrs (map
20
+
options = (lib.listToAttrs (map
(name: lib.nameValuePair name (lib.mkOption {
inherit (settingsFormat) type;
···
See https://yazi-rs.github.io/docs/configuration/${name}/ for documentation.
Configuration included in `$YAZI_CONFIG_HOME`.
38
+
initLua = lib.mkOption {
39
+
type = with lib.types; nullOr path;
42
+
The init.lua for Yazi itself.
46
+
} // (lib.listToAttrs (map
47
+
(name: lib.nameValuePair name (lib.mkOption {
48
+
type = with lib.types; attrsOf (oneOf [ path package ]);
53
+
See https://yazi-rs.github.io/docs/${name}/overview/ for documentation.
59
+
flavors = lib.mkOption {
60
+
type = with lib.types; attrsOf (oneOf [ path package ]);
65
+
See https://yazi-rs.github.io/docs/flavors/overview/ for documentation.
67
+
example = lib.literalExpression ''
config = lib.mkIf cfg.enable {
systemPackages = [ cfg.package ];
variables.YAZI_CONFIG_HOME = "/etc/yazi/";
41
-
etc = lib.attrsets.mergeAttrsList (map
81
+
etc = (lib.attrsets.mergeAttrsList (map
(name: lib.optionalAttrs (cfg.settings.${name} != { }) {
"yazi/${name}.toml".source = settingsFormat.generate "${name}.toml" cfg.settings.${name};
85
+
files)) // (lib.attrsets.mergeAttrsList (map
87
+
if cfg.${dir} != { } then
89
+
(name: value: lib.nameValuePair "yazi/${dir}/${name}" { source = value; })
91
+
# Yazi checks the directories. If they don't exist it tries to create them and then crashes.
92
+
"yazi/${dir}".source = pkgs.emptyDirectory;
94
+
dirs)) // lib.optionalAttrs (cfg.initLua != null) {
95
+
"yazi/init.lua".source = cfg.initLua;