programs.zsh.ohMyZsh: add `cacheDir` option (#33150)

The default cache directory set by oh-my-zsh is $ohMyZsh/cache which
lives in the Nix store in our case. This causes issues with several
completion plugins provided by oh-my-zsh.

Changed files
+16
nixos
modules
programs
+16
nixos/modules/programs/zsh/oh-my-zsh.nix
···
Name of the theme to be used by oh-my-zsh.
'';
};
};
};
···
${optionalString (stringLength(cfg.theme) > 0)
"ZSH_THEME=\"${cfg.theme}\""
}
source $ZSH/oh-my-zsh.sh
'';
···
Name of the theme to be used by oh-my-zsh.
'';
};
+
+
cacheDir = mkOption {
+
default = "$HOME/.cache/oh-my-zsh";
+
type = types.str;
+
description = ''
+
Cache directory to be used by `oh-my-zsh`.
+
Default is /nix/store/<oh-my-zsh>/cache.
+
'';
+
};
};
};
···
${optionalString (stringLength(cfg.theme) > 0)
"ZSH_THEME=\"${cfg.theme}\""
}
+
+
${optionalString (cfg.cacheDir != null) ''
+
if [[ ! -d "${cfg.cacheDir}" ]]; then
+
mkdir -p "${cfg.cacheDir}"
+
fi
+
ZSH_CACHE_DIR=${cfg.cacheDir}
+
''}
source $ZSH/oh-my-zsh.sh
'';