diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-07-28T16·03+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-07-28T16·03+0000 |
commit | 4661282fde9f37780877fbeeb34b06b0c221e6bf (patch) | |
tree | 234537580ad8a9f51b0738cd990aa35c31247b54 /scripts | |
parent | c11839d7b24993f9639d59f9fa3420e8ccc22e02 (diff) |
* `nix-instantiate ... --arg NAME VALUE': allow arguments to be passed
to functions from the command line. * nix-build: started removing backticks.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/nix-build.in | 12 |
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; |