···
settingsFormat = pkgs.formats.toml { };
+
files = [ "yazi" "theme" "keymap" ];
+
dirs = [ "plugins" "flavors" ];
options.programs.yazi = {
···
settings = lib.mkOption {
type = with lib.types; submodule {
+
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`.
+
initLua = lib.mkOption {
+
type = with lib.types; nullOr path;
+
The init.lua for Yazi itself.
+
} // (lib.listToAttrs (map
+
(name: lib.nameValuePair name (lib.mkOption {
+
type = with lib.types; attrsOf (oneOf [ path package ]);
+
See https://yazi-rs.github.io/docs/${name}/overview/ for documentation.
+
flavors = lib.mkOption {
+
type = with lib.types; attrsOf (oneOf [ path package ]);
+
See https://yazi-rs.github.io/docs/flavors/overview/ for documentation.
+
example = lib.literalExpression ''
config = lib.mkIf cfg.enable {
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};
+
files)) // (lib.attrsets.mergeAttrsList (map
+
if cfg.${dir} != { } then
+
(name: value: lib.nameValuePair "yazi/${dir}/${name}" { source = value; })
+
# Yazi checks the directories. If they don't exist it tries to create them and then crashes.
+
"yazi/${dir}".source = pkgs.emptyDirectory;
+
dirs)) // lib.optionalAttrs (cfg.initLua != null) {
+
"yazi/init.lua".source = cfg.initLua;