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.in12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index 645fdb1e6486..fab8fae84e74 100644
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -77,6 +77,12 @@ EOF
         push @instArgs, ("--attr", $ARGV[$n]);
     }
 
+    elsif ($arg eq "--arg") {
+        die "$0: `--arg' requires two arguments\n" unless $n + 2 < scalar @ARGV;
+        push @instArgs, ("--arg", $ARGV[$n + 1], $ARGV[$n + 2]);
+        $n += 2;
+    }
+
     elsif (substr($arg, 0, 1) eq "-") {
         push @buildArgs, $arg;
     }
@@ -103,8 +109,10 @@ if (!defined $outLink) {
 foreach my $expr (@exprs) {
 
     # Instantiate.
-    my $drvPaths = `@bindir@/nix-instantiate --add-root "$drvLink" --indirect @instArgs "$expr"`;
-    my @drvPaths = split ' ', $drvPaths;
+    my @drvPaths;
+    open DRVPATHS, "-|", "@bindir@/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
+    while (<DRVPATHS>) {chomp; push @drvPaths, $_;}
+    close DRVPATHS;
 
     foreach my $drvPath (@drvPaths) {
         my $target = readlink $drvPath;