about summary refs log tree commit diff
path: root/scripts/nix-build.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/nix-build.in')
-rw-r--r--scripts/nix-build.in6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index a674a00415ea..30ada24e0d7c 100644
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -2,6 +2,8 @@
 
 use strict;
 
+my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
+
 
 my $addDrvLink = 0;
 my $addOutLink = 1;
@@ -124,7 +126,7 @@ foreach my $expr (@exprs) {
     # Instantiate.
     my @drvPaths;
     # !!! would prefer the perl 5.8.0 pipe open feature here.
-    my $pid = open(DRVPATHS, "-|") || exec "@bindir@/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
+    my $pid = open(DRVPATHS, "-|") || exec "$binDir/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
     while (<DRVPATHS>) {chomp; push @drvPaths, $_;}
     close DRVPATHS or exit 1;
 
@@ -135,7 +137,7 @@ foreach my $expr (@exprs) {
 
     # Build.
     my @outPaths;
-    $pid = open(OUTPATHS, "-|") || exec "@bindir@/nix-store", "--add-root", $outLink, "--indirect", "-rv",
+    $pid = open(OUTPATHS, "-|") || exec "$binDir/nix-store", "--add-root", $outLink, "--indirect", "-rv",
         @buildArgs, @drvPaths;
     while (<OUTPATHS>) {chomp; push @outPaths, $_;}
     close OUTPATHS or exit 1;