Add support for fetching URLs as inputs.

This commit is contained in:
Petr Rockai 2013-02-05 19:52:46 +01:00
parent 5a35912956
commit bb8059e50c

View file

@ -34,8 +34,13 @@ sub fetchInput {
} else { } else {
print STDERR "copying input ", $name, " from $uri\n"; print STDERR "copying input ", $name, " from $uri\n";
if ( $uri =~ /^\// ) {
$storePath = `nix-store --add "$uri"` $storePath = `nix-store --add "$uri"`
or die "cannot copy path $uri to the Nix store.\n"; or die "cannot copy path $uri to the Nix store.\n";
} else {
$storePath = `PRINT_PATH=1 nix-prefetch-url "$uri" | tail -n 1`
or die "cannot fetch $uri to the Nix store.\n";
}
chomp $storePath; chomp $storePath;
$sha256 = (queryPathInfo($storePath, 0))[1] or die; $sha256 = (queryPathInfo($storePath, 0))[1] or die;