mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
nix-shell --pure: Let it work for any derivation
`nix-shell --pure` when applied to a non stdenv derivation doesn't seem to clear the PATH. It expects the stdenv/setup file to do so. This adds an explicit `unset PATH` by nix-build.cc (nix-shell) itself so that it's not reliant on stdenv/setup anymore. This does not break impure nix-shell since the PATH is persisted as the variable `p` prior in the bash rcfile fixes #5092
This commit is contained in:
parent
e277c0c479
commit
fbf42c55ac
1 changed files with 3 additions and 0 deletions
|
@ -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; "
|
||||
|
|
Loading…
Reference in a new issue