Describe the bug
After #3608 nix-daemon is being sourced from /etc/zshenv instead of /etc/zshrc which leads to system binaries getting priority over ones installed in Nix profile.
Steps To Reproduce
- Install Nix in daemon mode
- Open zsh shell
- Install git
nix-env -iA nixpkgs.git
- Run
git
- Observe request from the system to download and install Xcode utilities.
Expected behavior
Git should run from Nix.
nix-env --version output
Additional context
The order of files run by zsh is:
/etc/zshenv and ~/.zshenv
/etc/zprofile and ~/.zprofile
/etc/zshrc and ~/.zshrc
/etc/zprofile on macOS contains a call to /usr/libexec/path_helper that overrides PATH variable prepending all system paths from /etc/paths file and /etc/paths.d dir. Before #3608 nix-daemon.sh was sourced in /etc/zshrc after this call and Nix paths were in the front of the resulting PATH variable. After #3608 it is sourced in /etc/zshenv which leads to Nix paths ending up in the very end of PATH.
Describe the bug
After #3608
nix-daemonis being sourced from/etc/zshenvinstead of/etc/zshrcwhich leads to system binaries getting priority over ones installed in Nix profile.Steps To Reproduce
nix-env -iA nixpkgs.gitgitExpected behavior
Git should run from Nix.
nix-env --versionoutputAdditional context
The order of files run by zsh is:
/etc/zshenvand~/.zshenv/etc/zprofileand~/.zprofile/etc/zshrcand~/.zshrc/etc/zprofileon macOS contains a call to/usr/libexec/path_helperthat overrides PATH variable prepending all system paths from/etc/pathsfile and/etc/paths.ddir. Before #3608nix-daemon.shwas sourced in/etc/zshrcafter this call and Nix paths were in the front of the resulting PATH variable. After #3608 it is sourced in/etc/zshenvwhich leads to Nix paths ending up in the very end of PATH.