mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 00:56:15 +02:00
nix-shell: Use $XDG_RUNTIME_DIR
This prevents collisions with other users. Fixes #262.
This commit is contained in:
parent
3bea429ae8
commit
3e5dbb2433
1 changed files with 2 additions and 1 deletions
|
@ -204,6 +204,7 @@ foreach my $expr (@exprs) {
|
||||||
or die "$0: failed to build all dependencies\n";
|
or die "$0: failed to build all dependencies\n";
|
||||||
|
|
||||||
# Set the environment.
|
# Set the environment.
|
||||||
|
my $tmp = $ENV{"TMPDIR"} // $ENV{"XDG_RUNTIME_DIR"} // "/tmp";
|
||||||
if ($pure) {
|
if ($pure) {
|
||||||
foreach my $name (keys %ENV) {
|
foreach my $name (keys %ENV) {
|
||||||
next if grep { $_ eq $name } ("HOME", "USER", "LOGNAME", "DISPLAY", "PATH", "TERM", "IN_NIX_SHELL", "TZ", "PAGER");
|
next if grep { $_ eq $name } ("HOME", "USER", "LOGNAME", "DISPLAY", "PATH", "TERM", "IN_NIX_SHELL", "TZ", "PAGER");
|
||||||
|
@ -212,7 +213,7 @@ 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'} = $ENV{'TEMPDIR'} = $ENV{'TMP'} = $ENV{'TEMP'} = $ENV{'TMPDIR'} // "/tmp";
|
$ENV{'NIX_BUILD_TOP'} = $ENV{'TMPDIR'} = $ENV{'TEMPDIR'} = $ENV{'TMP'} = $ENV{'TEMP'} = $tmp;
|
||||||
$ENV{'NIX_STORE'} = $Nix::Config::storeDir;
|
$ENV{'NIX_STORE'} = $Nix::Config::storeDir;
|
||||||
$ENV{$_} = $drv->{env}->{$_} foreach keys %{$drv->{env}};
|
$ENV{$_} = $drv->{env}->{$_} foreach keys %{$drv->{env}};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue