* nix-install-package: don't pollute /nix/var/nix/manifests.

This commit is contained in:
Eelco Dolstra 2009-02-27 14:06:38 +00:00
parent d4ca5c3952
commit 1273d355ac
3 changed files with 11 additions and 11 deletions

View file

@ -9,7 +9,7 @@ my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
STDOUT->autoflush(1); STDOUT->autoflush(1);
my $manifestDir = "@localstatedir@/nix/manifests"; my $manifestDir = ($ENV{"NIX_MANIFESTS_DIR"} or "@localstatedir@/nix/manifests");
my $logFile = "@localstatedir@/log/nix/downloads"; my $logFile = "@localstatedir@/log/nix/downloads";

View file

@ -123,6 +123,11 @@ if ($interactive) {
} }
# Store the manifest in the temporary directory so that we don't
# pollute /nix/var/nix/manifests.
$ENV{NIX_MANIFESTS_DIR} = $tmpDir;
print "\nPulling manifests...\n"; print "\nPulling manifests...\n";
system("$binDir/nix-pull", $manifestURL) == 0 system("$binDir/nix-pull", $manifestURL) == 0
or barf "nix-pull failed: $?"; or barf "nix-pull failed: $?";

View file

@ -8,15 +8,10 @@ my $tmpDir = tempdir("nix-pull.XXXXXX", CLEANUP => 1, TMPDIR => 1)
or die "cannot create a temporary directory"; or die "cannot create a temporary directory";
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@"; my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
my $libexecDir = ($ENV{"NIX_LIBEXEC_DIR"} or "@libexecdir@");
my $libexecDir = $ENV{"NIX_LIBEXEC_DIR"}; my $storeDir = ($ENV{"NIX_STORE_DIR"} or "@storedir@");
$libexecDir = "@libexecdir@" unless defined $libexecDir; my $stateDir = ($ENV{"NIX_STATE_DIR"} or "@localstatedir@/nix");
my $manifestDir = ($ENV{"NIX_MANIFESTS_DIR"} or "$stateDir/manifests");
my $stateDir = $ENV{"NIX_STATE_DIR"};
$stateDir = "@localstatedir@/nix" unless defined $stateDir;
my $storeDir = $ENV{"NIX_STORE_DIR"};
$storeDir = "@storedir@" unless defined $storeDir;
# Prevent access problems in shared-stored installations. # Prevent access problems in shared-stored installations.
@ -92,7 +87,7 @@ sub processURL {
or die "cannot hash `$manifest'"; or die "cannot hash `$manifest'";
chomp $hash; chomp $hash;
my $finalPath = "$stateDir/manifests/$baseName-$hash.nixmanifest"; my $finalPath = "$manifestDir/$baseName-$hash.nixmanifest";
system("@coreutils@/ln", "-sfn", "$manifest", "$finalPath") == 0 system("@coreutils@/ln", "-sfn", "$manifest", "$finalPath") == 0
or die "cannot link `$finalPath to `$manifest'"; or die "cannot link `$finalPath to `$manifest'";