Skip to content
Snippets Groups Projects
Commit 48858ad5 authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

nix-shell: Set some environment variables also set by build.cc

Setting $NIX_STORE causes the purity checks in gcc/ld-wrapper to kick
in, so that's why we unset $NIX_ENFORCE_PURITY.
parent 2bc5de86
No related branches found
No related tags found
No related merge requests found
...@@ -184,7 +184,8 @@ foreach my $expr (@exprs) { ...@@ -184,7 +184,8 @@ foreach my $expr (@exprs) {
# NixOS hack: prevent /etc/bashrc from sourcing /etc/profile. # NixOS hack: prevent /etc/bashrc from sourcing /etc/profile.
$ENV{'__ETC_PROFILE_SOURCED'} = 1; $ENV{'__ETC_PROFILE_SOURCED'} = 1;
} }
$ENV{'NIX_BUILD_TOP'} = $ENV{'TMPDIR'} || "/tmp"; $ENV{'NIX_BUILD_TOP'} = $ENV{'TMPDIR'} = $ENV{'TEMPDIR'} = $ENV{'TMP'} = $ENV{'TEMP'} = $ENV{'TMPDIR'} // "/tmp";
$ENV{'NIX_STORE'} = $Nix::Config::storeDir;
$ENV{$_} = $drv->{env}->{$_} foreach keys %{$drv->{env}}; $ENV{$_} = $drv->{env}->{$_} foreach keys %{$drv->{env}};
# Run a shell using the derivation's environment. For # Run a shell using the derivation's environment. For
...@@ -200,6 +201,7 @@ foreach my $expr (@exprs) { ...@@ -200,6 +201,7 @@ foreach my $expr (@exprs) {
($pure ? '' : 'PATH=$PATH:$p; ') . ($pure ? '' : 'PATH=$PATH:$p; ') .
'set +e; ' . 'set +e; ' .
'PS1="\n\[\033[1;32m\][nix-shell:\w]$\[\033[0m\] "; ' . 'PS1="\n\[\033[1;32m\][nix-shell:\w]$\[\033[0m\] "; ' .
'unset NIX_ENFORCE_PURITY; ' .
$envCommand); $envCommand);
exec($ENV{NIX_BUILD_SHELL} // "bash", "--rcfile", $rcfile); exec($ENV{NIX_BUILD_SHELL} // "bash", "--rcfile", $rcfile);
die; die;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment