Merge pull request #5101 from fzakaria/faridzakaria/fix-nix-shell

nix-shell --pure: Let it work for any derivation
This commit is contained in:
Eelco Dolstra 2021-08-09 14:52:11 +02:00 committed by GitHub
commit 27444d40cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -489,6 +489,9 @@ static void main_nix_build(int argc, char * * argv)
"_nix_shell_clean_tmpdir; ") +
(pure ? "" : "[ -n \"$PS1\" ] && [ -e ~/.bashrc ] && source ~/.bashrc;") +
"%2%"
// always clear PATH.
// when nix-shell is run impure, we rehydrate it with the `p=$PATH` above
"unset PATH;"
"dontAddDisableDepTrack=1;\n"
+ structuredAttrsRC +
"\n[ -e $stdenv/setup ] && source $stdenv/setup; "