mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-14 13:01:09 +01:00
Previously, a stateVersion check for 20.03 determined whether or not the input to `programs.zsh.history.path` would be prepended with `$HOME`. However, this was not communicated in the documentation, which stated the version check determined whether the default histfile location would be in `programs.zsh.dotDir` or `home.homeDirectory`. The current change simplifies matters and brings path handling in-line with that of the preceding work on dotDir path handling. If a relative path is provided, it is parsed as being relative to `home.homeDirectory`. Both absolute and relative paths are supported, and are cleaned before being passed to other functions. Tests have been rewritten for the new logic, with case handling for reusability. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
50 lines
1.3 KiB
Nix
50 lines
1.3 KiB
Nix
{
|
|
programs.zsh = {
|
|
enable = true;
|
|
|
|
shellAliases = {
|
|
test1 = "alias";
|
|
test2 = "alias2";
|
|
};
|
|
shellGlobalAliases = {
|
|
global = "test";
|
|
};
|
|
};
|
|
|
|
nmt.script = ''
|
|
assertFileExists home-files/.zshrc
|
|
|
|
assertFileContent home-files/.zshrc ${builtins.toFile "expected-.zshrc" ''
|
|
typeset -U path cdpath fpath manpath
|
|
for profile in ''${(z)NIX_PROFILES}; do
|
|
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
|
|
done
|
|
|
|
HELPDIR="@zsh@/share/zsh/$ZSH_VERSION/help"
|
|
|
|
autoload -U compinit && compinit
|
|
# History options should be set in .zshrc and after oh-my-zsh sourcing.
|
|
# See https://github.com/nix-community/home-manager/issues/177.
|
|
HISTSIZE="10000"
|
|
SAVEHIST="10000"
|
|
|
|
HISTFILE="/home/hm-user/.zsh_history"
|
|
mkdir -p "$(dirname "$HISTFILE")"
|
|
|
|
setopt HIST_FCNTL_LOCK
|
|
unsetopt APPEND_HISTORY
|
|
setopt HIST_IGNORE_DUPS
|
|
unsetopt HIST_IGNORE_ALL_DUPS
|
|
unsetopt HIST_SAVE_NO_DUPS
|
|
unsetopt HIST_FIND_NO_DUPS
|
|
setopt HIST_IGNORE_SPACE
|
|
unsetopt HIST_EXPIRE_DUPS_FIRST
|
|
setopt SHARE_HISTORY
|
|
unsetopt EXTENDED_HISTORY
|
|
|
|
|
|
alias -- test1=alias
|
|
alias -- test2=alias2
|
|
alias -g -- global=test''}
|
|
'';
|
|
}
|