NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.14k stars 13.42k forks source link

NixOS zsh configuration clobbers $PATH in /etc/profile by default #41290

Open colonelpanic8 opened 6 years ago

colonelpanic8 commented 6 years ago

Issue description

NixOS clobbers $PATH in /etc/profile by default.

export PATH="/etc/profiles/per-user/$USER/bin:$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"

I don't think it makes sense for it to do this. The existing value of $PATH should appear in this statement somewhere.

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the results.

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 4.14.44, NixOS, 18.03.132535.2ee48415afc (Impala)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.0.2`
 - channels(root): `"nixos-18.03.132535.2ee48415afc"`
 - channels(imalison): `"nixpkgs-18.09pre140731.c29d2fde74d"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`
edolstra commented 6 years ago

I assume you're talking about NixOS rather than Nix. In any case, /etc/profile is executed for login shells, so the previous contents of the environment (if any) should be irrelevant. Indeed, overwriting rather than appending ensures a more predictable environment.

colonelpanic8 commented 6 years ago

@edolstra .zshenv will run BEFORE /etc/profile, actually, and according to the zsh manual, this is where user path should be configured.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.