Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATH should prioritize user defined packages #2063

Closed
fkorotkov opened this issue Apr 9, 2018 · 2 comments
Closed

PATH should prioritize user defined packages #2063

fkorotkov opened this issue Apr 9, 2018 · 2 comments

Comments

@fkorotkov
Copy link

When I'm trying to run a script using nix-shell, $PATH contains several folders starting with coreutils from standard environment:

$: nix-shell --packages darwin.shell_cmds --pure --run "echo \$PATH"
/nix/store/s28xb9v7xf6axvf4a3av2mnczws2hsdg-coreutils-8.29/bin:/nix/store/j2z3v4g8y39ph0z03mh2cv2xaqvfmrai-shell_cmds-osx-10.11.6/bin

Unfortunately, since coreutils is in front, it will be looked into first. That means, in case of a conflict, binaries from coreutils will always be picked.

In the case above, shell_cmds contains mktemp for Mac OS which is slightly different from GNU's one, but there is no easy way to make the script inside nix-shell to use mktemp from shell_cmds.

I think a solution here is to always put packages defined by user in front of the PATH and put all the default stuff in the end.

@edolstra
Copy link
Member

edolstra commented Apr 9, 2018

I think this is more a Nixpkgs (stdenv) issue than a Nix issue. nix-shell just uses whatever $PATH stdenv computes.

@fkorotkov
Copy link
Author

My bad. I'm just starting with Nix so wasn't aware of how PATH is provided. Created a separate issue in nixpkgs: NixOS/nixpkgs#38657

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants