1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

programs.zsh: export variables in zshenv

This commit is contained in:
Daiderd Jordan 2017-01-08 22:56:16 +01:00
parent 4c7f6b61bc
commit 4581746213
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 32 additions and 41 deletions

View file

@ -15,17 +15,6 @@ let
makeWrapper ${pkgs.bash}/bin/bash $out/bin/bash
'';
interactiveShellInit = ''
export PATH=${config.environment.systemPath}''${PATH:+:$PATH}
${config.system.build.setEnvironment}
${config.system.build.setAliases}
${config.environment.extraInit}
${config.environment.interactiveShellInit}
${cfg.interactiveShellInit}
'';
in
{
@ -67,7 +56,13 @@ in
if [ -n "$__ETC_BASHRC_SOURCED" -o -n "$NOSYSBASHRC" ]; then return; fi
__ETC_BASHRC_SOURCED=1
${interactiveShellInit}
export PATH=${config.environment.systemPath}''${PATH:+:$PATH}
${config.system.build.setEnvironment}
${config.system.build.setAliases}
${config.environment.extraInit}
${config.environment.interactiveShellInit}
${cfg.interactiveShellInit}
# Read system-wide modifications.
if test -f /etc/bash.local; then

View file

@ -18,33 +18,6 @@ let
makeWrapper ${pkgs.zsh}/bin/zsh $out/bin/zsh
'';
interactiveShellInit = ''
# history defaults
SAVEHIST=2000
HISTSIZE=2000
HISTFILE=$HOME/.zsh_history
setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
export PATH=${config.environment.systemPath}''${PATH:+:$PATH}
${config.system.build.setEnvironment}
${config.system.build.setAliases}
${config.environment.extraInit}
${config.environment.interactiveShellInit}
${cfg.interactiveShellInit}
${cfg.promptInit}
# Tell zsh how to find installed completions
for p in ''${(z)NIX_PROFILES}; do
fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions)
done
${optionalString cfg.enableCompletion "autoload -U compinit && compinit"}
${optionalString cfg.enableBashCompletion "autoload -U bashcompinit && bashcompinit"}
'';
in
{
@ -140,6 +113,9 @@ in
if [ -n "$__ETC_ZSHENV_SOURCED" ]; then return; fi
export __ETC_ZSHENV_SOURCED=1
export PATH=${config.environment.systemPath}''${PATH:+:$PATH}
${config.system.build.setEnvironment}
${cfg.shellInit}
# Read system-wide modifications.
@ -174,7 +150,27 @@ in
if [ -n "$__ETC_ZSHRC_SOURCED" -o -n "$NOSYSZSHRC" ]; then return; fi
__ETC_ZSHRC_SOURCED=1
${interactiveShellInit}
# history defaults
SAVEHIST=2000
HISTSIZE=2000
HISTFILE=$HOME/.zsh_history
setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
${config.system.build.setAliases}
${config.environment.extraInit}
${config.environment.interactiveShellInit}
${cfg.interactiveShellInit}
${cfg.promptInit}
# Tell zsh how to find installed completions
for p in ''${(z)NIX_PROFILES}; do
fpath+=($p/share/zsh/site-functions $p/share/zsh/$ZSH_VERSION/functions)
done
${optionalString cfg.enableCompletion "autoload -U compinit && compinit"}
${optionalString cfg.enableBashCompletion "autoload -U bashcompinit && bashcompinit"}
# Read system-wide modifications.
if test -f /etc/zshrc.local; then

View file

@ -40,7 +40,7 @@ in
system.activationScripts.etc.text = ''
# Set up the statically computed bits of /etc.
echo "setting up /etc..."
echo "setting up /etc..." >&2
ln -sfn "$(readlink -f $systemConfig/etc)" /etc/static