Skip to content

Commit

Permalink
programs.zsh.ohMyZsh: add cacheDir option (#33150)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ma27 authored and fpletz committed Jan 16, 2018
1 parent 13b4f44 commit b55d4c0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nixos/modules/programs/zsh/oh-my-zsh.nix
Expand Up @@ -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.
'';
};
};
};

Expand All @@ -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
'';
};
Expand Down

0 comments on commit b55d4c0

Please sign in to comment.