about summary refs log tree commit diff
path: root/scripts/nix-collect-garbage.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-11-20T15·44+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-11-20T15·44+0000
commit4213b8d8ec8cf478e43b0ec3dc4068e5e55f097a (patch)
tree2b95c8d933bae74c21d06ba7149d2ec1ab8924b0 /scripts/nix-collect-garbage.in
parenteb86b6f5a5429075866eca40d3cc4b864e7499ae (diff)
* Urgh.
Diffstat (limited to 'scripts/nix-collect-garbage.in')
-rw-r--r--scripts/nix-collect-garbage.in6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in
index b92deefc2436..f445c1c71256 100644
--- a/scripts/nix-collect-garbage.in
+++ b/scripts/nix-collect-garbage.in
@@ -4,6 +4,8 @@ use strict;
 
 my $profilesDir = "@localstatedir@/nix/profiles";
 
+my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
+
 
 # Process the command line arguments.
 my @args = ();
@@ -34,7 +36,7 @@ sub removeOldGenerations {
         $name = $dir . "/" . $name;
         if (-l $name && (readlink($name) =~ /link/)) {
             print STDERR "removing old generations of profile $name\n";
-            system("@bindir@/nix-env", "-p", $name, "--delete-generations", "old");
+            system("$binDir/nix-env", "-p", $name, "--delete-generations", "old");
         }
         elsif (! -l $name && -d $name) {
             removeOldGenerations $name;
@@ -48,4 +50,4 @@ removeOldGenerations $profilesDir if $removeOld;
 
 
 # Run the actual garbage collector.
-exec "@bindir@/nix-store", "--gc", @args;
+exec "$binDir/nix-store", "--gc", @args;