diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2017-01-08 22:56:16 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2017-01-08 22:56:16 +0100 |
| commit | 45817462135e24652003232561778c4a9d8a7b87 (patch) | |
| tree | 533967558432b98c3452012845ae7d73860bbf1c /modules/programs | |
| parent | 4c7f6b61bcae4ae846b9e8c14f01ce89ec8825c1 (diff) | |
programs.zsh: export variables in zshenv
Diffstat (limited to 'modules/programs')
| -rw-r--r-- | modules/programs/bash.nix | 19 | ||||
| -rw-r--r-- | modules/programs/zsh.nix | 52 |
2 files changed, 31 insertions, 40 deletions
diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix index 5317a23..081e083 100644 --- a/modules/programs/bash.nix +++ b/modules/programs/bash.nix @@ -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 diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 882c789..f9c063f 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -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 |
