diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-01T21·56-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-08-01T21·56-0400 |
commit | 5170c5691aac1bd6abc69be65cf880316e11fe24 (patch) | |
tree | 4baffdd01e5406c7cae3c70e7ae0dedc9ce1f27b /scripts/download-from-binary-cache.pl.in | |
parent | 79bba3782c275f03954cc9fc03f92aff487db953 (diff) |
nix-channel: Use binary caches advertised by channels
Channels can now advertise a binary cache by creating a file <channel-url>/binary-cache-url. The channel unpacker puts these in its "binary-caches" subdirectory. Thus, the URLS of the binary caches for the channels added by root appear in /nix/var/nix/profiles/per-user/eelco/channels/binary-caches/*. The binary cache substituter reads these and adds them to the list of binary caches.
Diffstat (limited to 'scripts/download-from-binary-cache.pl.in')
-rw-r--r-- | scripts/download-from-binary-cache.pl.in | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/download-from-binary-cache.pl.in b/scripts/download-from-binary-cache.pl.in index f7f1f73460da..76306405cc05 100644 --- a/scripts/download-from-binary-cache.pl.in +++ b/scripts/download-from-binary-cache.pl.in @@ -176,6 +176,16 @@ sub getAvailableCaches { ($Nix::Config::config{"binary-caches"} // ($Nix::Config::storeDir eq "/nix/store" ? "http://nixos.org/binary-cache" : "")); + my $urlsFiles = $Nix::Config::config{"binary-cache-files"} + // "/nix/var/nix/profiles/per-user/root/channels/binary-caches/*"; + foreach my $urlFile (glob $urlsFiles) { + next unless -f $urlFile; + open FILE, "<$urlFile" or die "cannot open ‘$urlFile’\n"; + my $url = <FILE>; chomp $url; + close FILE; + push @urls, strToList($url); + } + # Allow Nix daemon users to override the binary caches to a subset # of those listed in the config file. Note that ‘untrusted-*’ # denotes options passed by the client. |