From b55d4c0564b0bde4cbc0c01b6ba7a1276382335a Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Tue, 16 Jan 2018 18:29:46 +0100 Subject: [PATCH] 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. --- nixos/modules/programs/zsh/oh-my-zsh.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nixos/modules/programs/zsh/oh-my-zsh.nix b/nixos/modules/programs/zsh/oh-my-zsh.nix index 9077643c444..b7834fa5f87 100644 --- a/nixos/modules/programs/zsh/oh-my-zsh.nix +++ b/nixos/modules/programs/zsh/oh-my-zsh.nix @@ -48,6 +48,15 @@ in 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//cache. + ''; + }; }; }; @@ -74,6 +83,13 @@ in "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 ''; };