about summary refs log tree commit diff
path: root/scripts/nix-pull.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/nix-pull.in')
-rw-r--r--scripts/nix-pull.in18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index a802760a5293..66d99ff7c9b5 100644
--- a/scripts/nix-pull.in
+++ b/scripts/nix-pull.in
@@ -19,14 +19,24 @@ my $confFile = "@sysconfdir@/nix/prebuilts.conf";
 my %storePaths2urls;
 my %urls2hashes;
 my %successors;
-sub doURL {
+
+sub processURL {
     my $url = shift;
-    processURL $manifest, $url, \%storePaths2urls, \%urls2hashes, \%successors;
+
+    $url =~ s/\/$//;
+    print "obtaining list of Nix archives at $url...\n";
+
+    system("@curl@ --fail --silent --show-error --location --max-redirs 20 " .
+           "'$url' > '$manifest'") == 0
+           or die "curl failed: $?";
+    
+    readManifest $manifest, \%storePaths2urls, \%urls2hashes, \%successors;
 }
+
 if (scalar @ARGV > 0) {
     while (@ARGV) {
         my $url = shift @ARGV;
-	doURL $url;
+	processURL $url;
     }
 } else {
     open CONFFILE, "<$confFile";
@@ -34,7 +44,7 @@ if (scalar @ARGV > 0) {
         chomp;
         if (/^\s*(\S+)\s*(\#.*)?$/) {
             my $url = $1;
-	    doURL $url;
+	    processURL $url;
         }
     }
     close CONFFILE;