1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

* A script `nix-prefetch-url' to fetch a URL, place it in the Nix

store, and print its hash.
This commit is contained in:
Eelco Dolstra 2003-08-15 10:13:41 +00:00
parent 01e30360d4
commit e374dbf89b
4 changed files with 64 additions and 5 deletions

View file

@ -1,5 +1,6 @@
#! /usr/bin/perl -w
use strict;
use IPC::Open2;
my $tmpfile = "@localstatedir@/nix/pull.tmp";
@ -85,7 +86,7 @@ $fullexpr .= "]";
# Instantiate Nix expressions from the Fix expressions we created above.
print STDERR "running fix...\n";
$pid = open2(\*READ, \*WRITE, "fix -") or die "cannot run fix";
my $pid = open2(\*READ, \*WRITE, "fix -") or die "cannot run fix";
print WRITE $fullexpr;
close WRITE;
@ -93,9 +94,9 @@ my $i = 0;
while (<READ>) {
chomp;
die unless /^([0-9a-z]{32})$/;
$nid = $1;
my $nid = $1;
die unless ($i < scalar @ids);
$id = $ids[$i++];
my $id = $ids[$i++];
push @subs, $id;
push @subs, $nid;
}