Add an environment variable $NIX_BINARY_CACHES specifying URLs of binary caches

This commit is contained in:
Eelco Dolstra 2012-07-01 21:55:36 -04:00
parent f4190c38ba
commit 440adfbdd1
1 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,9 @@ use strict;
use Nix::Config;
use Nix::Store;
my @binaryCacheUrls = ("file:///tmp/binary-cache2");
my @binaryCacheUrls = split / /, ($ENV{"NIX_BINARY_CACHES"} || "");
sub getInfoFrom {
my ($storePath, $pathHash, $binaryCacheUrl) = @_;
@ -12,7 +14,7 @@ sub getInfoFrom {
#print STDERR "checking $infoUrl...\n";
my $s = `$Nix::Config::curl --fail --silent --location ${infoUrl}`;
if ($? != 0) {
print STDERR "GOT CURL REPLY ", $? >> 8, "\n";
#print STDERR "GOT CURL REPLY ", $? >> 8, "\n";
return undef;
}
my ($storePath2, $url, $compression, $fileHash, $fileSize, $narHash, $narSize, $deriver);
@ -45,6 +47,7 @@ sub getInfoFrom {
}
}
sub getInfo {
my ($storePath) = @_;
@ -58,6 +61,7 @@ sub getInfo {
return undef;
}
sub downloadBinary {
my ($storePath) = @_;
@ -82,6 +86,7 @@ sub downloadBinary {
return 0;
}
if ($ARGV[0] eq "--query") {
while (<STDIN>) {