zsh: use new option to set internal session vars
This commit is contained in:
parent
12ebf21be5
commit
ee7f2413ed
|
@ -230,14 +230,16 @@ in
|
||||||
++ optional cfg.enableCompletion nix-zsh-completions
|
++ optional cfg.enableCompletion nix-zsh-completions
|
||||||
++ optional cfg.oh-my-zsh.enable oh-my-zsh;
|
++ optional cfg.oh-my-zsh.enable oh-my-zsh;
|
||||||
|
|
||||||
|
programs.zsh.sessionVariables = {
|
||||||
|
HISTSIZE = cfg.history.size;
|
||||||
|
HISTFILE = "$HOME/" + cfg.history.path;
|
||||||
|
};
|
||||||
|
|
||||||
home.file."${relToDotDir ".zshenv"}".text = ''
|
home.file."${relToDotDir ".zshenv"}".text = ''
|
||||||
${envVarsStr}
|
${envVarsStr}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
home.file."${relToDotDir ".zshrc"}".text = ''
|
home.file."${relToDotDir ".zshrc"}".text = ''
|
||||||
${export "HISTSIZE" cfg.history.size}
|
|
||||||
${export "HISTFILE" ("$HOME/" + cfg.history.path)}
|
|
||||||
|
|
||||||
setopt HIST_FCNTL_LOCK
|
setopt HIST_FCNTL_LOCK
|
||||||
${if cfg.history.ignoreDups then "setopt" else "unsetopt"} HIST_IGNORE_DUPS
|
${if cfg.history.ignoreDups then "setopt" else "unsetopt"} HIST_IGNORE_DUPS
|
||||||
${if cfg.history.share then "setopt" else "unsetopt"} SHARE_HISTORY
|
${if cfg.history.share then "setopt" else "unsetopt"} SHARE_HISTORY
|
||||||
|
@ -259,9 +261,6 @@ in
|
||||||
|
|
||||||
${optionalString cfg.oh-my-zsh.enable ''
|
${optionalString cfg.oh-my-zsh.enable ''
|
||||||
# oh-my-zsh configuration generated by NixOS
|
# oh-my-zsh configuration generated by NixOS
|
||||||
export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh
|
|
||||||
export ZSH_CACHE_DIR=''${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh
|
|
||||||
|
|
||||||
${optionalString (cfg.oh-my-zsh.plugins != [])
|
${optionalString (cfg.oh-my-zsh.plugins != [])
|
||||||
"plugins=(${concatStringsSep " " cfg.oh-my-zsh.plugins})"
|
"plugins=(${concatStringsSep " " cfg.oh-my-zsh.plugins})"
|
||||||
}
|
}
|
||||||
|
@ -283,6 +282,14 @@ in
|
||||||
${aliasesStr}
|
${aliasesStr}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(mkIf cfg.oh-my-zsh.enable {
|
||||||
|
programs.zsh.sessionVariables = {
|
||||||
|
ZSH = "${pkgs.oh-my-zsh}/share/oh-my-zsh";
|
||||||
|
ZSH_CACHE_DIR = "\${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
(mkIf (cfg.dotDir != null) {
|
(mkIf (cfg.dotDir != null) {
|
||||||
programs.zsh.sessionVariables.ZDOTDIR = zdotdir;
|
programs.zsh.sessionVariables.ZDOTDIR = zdotdir;
|
||||||
|
|
||||||
|
@ -294,12 +301,14 @@ in
|
||||||
source ${zdotdir}/.zshenv
|
source ${zdotdir}/.zshenv
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf cfg.oh-my-zsh.enable {
|
(mkIf cfg.oh-my-zsh.enable {
|
||||||
# Oh-My-Zsh calls compinit during initialization,
|
# Oh-My-Zsh calls compinit during initialization,
|
||||||
# calling it twice causes sight start up slowdown
|
# calling it twice causes sight start up slowdown
|
||||||
# as all $fpath entries will be traversed again.
|
# as all $fpath entries will be traversed again.
|
||||||
programs.zsh.enableCompletion = mkForce false;
|
programs.zsh.enableCompletion = mkForce false;
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (cfg.plugins != []) {
|
(mkIf (cfg.plugins != []) {
|
||||||
# Many plugins require compinit to be called
|
# Many plugins require compinit to be called
|
||||||
# but allow the user to opt out.
|
# but allow the user to opt out.
|
||||||
|
|
Loading…
Reference in a new issue