about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-08T12·16+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-06-08T12·16+0200
commitf2b67fbf2ab7de68ee2e7c12ea090c8190e9546f (patch)
tree6a3d601e9c5b7da501635fc281cc1158bd000f12 /scripts
parentbf8cc4e9b623408923e1b93e982fa692999b4124 (diff)
nix-push: Support -j
Fixes #548.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/nix-push.in7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/nix-push.in b/scripts/nix-push.in
index d5d3bc1e7e79..2d9d83f59b92 100755
--- a/scripts/nix-push.in
+++ b/scripts/nix-push.in
@@ -29,6 +29,7 @@ my $archivesURL;
 my $link = 0;
 my $secretKeyFile;
 my @roots;
+my @buildArgs;
 
 for (my $n = 0; $n < scalar @ARGV; $n++) {
     my $arg = $ARGV[$n];
@@ -64,6 +65,10 @@ for (my $n = 0; $n < scalar @ARGV; $n++) {
         $n++;
         die "$0: ‘$arg’ requires an argument\n" unless $n < scalar @ARGV;
         $secretKeyFile = $ARGV[$n];
+    } elsif ($arg eq "--max-jobs" || $arg eq "-j") {
+        $n++;
+        die "$0: ‘$arg’ requires an argument\n" unless $n < scalar @ARGV;
+        push @buildArgs, ($arg, $ARGV[$n]);
     } elsif (substr($arg, 0, 1) eq "-") {
         die "$0: unknown flag ‘$arg’\n";
     } else {
@@ -153,7 +158,7 @@ close NIX;
 # Build the Nix expression.
 print STDERR "building compressed archives...\n";
 my @narPaths;
-my $pid = open(READ, "$Nix::Config::binDir/nix-build $nixExpr -o $tmpDir/result |")
+my $pid = open(READ, "-|", "$Nix::Config::binDir/nix-build", $nixExpr, "-o", "$tmpDir/result", @buildArgs)
     or die "cannot run nix-build";
 while (<READ>) {
     chomp;