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.
This commit is contained in:
Maximilian Bosch 2018-01-16 18:29:46 +01:00 committed by Franz Pletz
parent 13b4f440fc
commit b55d4c0564

View File

@ -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/<oh-my-zsh>/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
'';
};