zsh: allow configuring history (#1635)
Some checks failed
Test / test-stable (push) Has been cancelled
Test / install-against-stable (push) Has been cancelled
Test / install-flake (push) Has been cancelled
Update website / Build (push) Has been cancelled
Update website / Deploy (push) Has been cancelled

This commit is contained in:
Sam 2025-11-18 22:37:57 +00:00 committed by GitHub
commit 3bda9f6b14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
.DS_Store
*.swp
result*

View file

@ -59,6 +59,18 @@ in
description = "Shell script code used to initialise the zsh prompt.";
};
programs.zsh.histSize = mkOption {
type = types.int;
default = 2000;
description = "Change history size.";
};
programs.zsh.histFile = mkOption {
type = types.str;
default = "$HOME/.zsh_history";
description = "Change history file.";
};
programs.zsh.enableCompletion = mkOption {
type = types.bool;
default = true;
@ -189,10 +201,11 @@ in
if [ -n "$__ETC_ZSHRC_SOURCED" -o -n "$NOSYSZSHRC" ]; then return; fi
__ETC_ZSHRC_SOURCED=1
# history defaults
SAVEHIST=2000
HISTSIZE=2000
HISTFILE=$HOME/.zsh_history
# Setup command line history.
# Don't export these, otherwise other shells (bash) will try to use same HISTFILE.
SAVEHIST=${builtins.toString cfg.histSize}
HISTSIZE=${builtins.toString cfg.histSize}
HISTFILE=${cfg.histFile}
setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK