aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/nix-build.in4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index 3b5b8413c..4bf85ae13 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -202,7 +202,8 @@ foreach my $expr (@exprs) {
my $rcfile = "$tmpDir/rc";
writeFile(
$rcfile,
- '[ -e ~/.bashrc ] && source ~/.bashrc; ' .
+ 'unset BASH_ENV; ' .
+ '[ -n "$PS1" ] && [ -e ~/.bashrc ] && source ~/.bashrc; ' .
($pure ? '' : 'p=$PATH; ' ) .
'dontAddDisableDepTrack=1; ' .
'[ -e $stdenv/setup ] && source $stdenv/setup; ' .
@@ -212,6 +213,7 @@ foreach my $expr (@exprs) {
'unset NIX_ENFORCE_PURITY; ' .
'shopt -u nullglob; ' .
$envCommand);
+ $ENV{BASH_ENV} = $rcfile;
exec($ENV{NIX_BUILD_SHELL} // "bash", "--rcfile", $rcfile);
die;
}