Skip to content

Commit

Permalink
Revert "zsh: move sessionVariables from .zshrc to .zshenv (nix-commun…
Browse files Browse the repository at this point in the history
…ity#2708)"

This reverts commit 2116fe6.
  • Loading branch information
jwiegley committed Feb 22, 2022
1 parent 69536af commit ecaee0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
17 changes: 4 additions & 13 deletions modules/programs/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -442,19 +442,6 @@ in
'';
})

{
home.file."${relToDotDir ".zshenv"}".text = ''
# Environment variables
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
# Only source this once
if [[ -z "$__HM_ZSH_SESS_VARS_SOURCED" ]]; then
export __HM_ZSH_SESS_VARS_SOURCED=1
${envVarsStr}
fi
'';
}

{
home.packages = with pkgs; [ zsh ]
++ optional cfg.enableCompletion nix-zsh-completions
Expand Down Expand Up @@ -504,6 +491,10 @@ in
"source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
}
# Environment variables
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
${envVarsStr}
${optionalString cfg.oh-my-zsh.enable ''
# oh-my-zsh extra settings for plugins
${cfg.oh-my-zsh.extraConfig}
Expand Down
6 changes: 3 additions & 3 deletions tests/modules/programs/zsh/session-variables.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ with lib;
test.stubs.zsh = { };

nmt.script = ''
assertFileExists home-files/.zshenv
assertFileRegex home-files/.zshenv 'export V1="v1"'
assertFileRegex home-files/.zshenv 'export V2="v2-v1"'
assertFileExists home-files/.zshrc
assertFileRegex home-files/.zshrc 'export V1="v1"'
assertFileRegex home-files/.zshrc 'export V2="v2-v1"'
'';
};
}

0 comments on commit ecaee0e

Please sign in to comment.