summaryrefslogtreecommitdiffstats
path: root/corepkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-01 17:56:11 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-01 17:56:11 -0400
commit5170c5691aac1bd6abc69be65cf880316e11fe24 (patch)
tree4baffdd01e5406c7cae3c70e7ae0dedc9ce1f27b /corepkgs
parent79bba3782c275f03954cc9fc03f92aff487db953 (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 'corepkgs')
-rw-r--r--corepkgs/unpack-channel.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/corepkgs/unpack-channel.nix b/corepkgs/unpack-channel.nix
index bbc54c7d1..57d5a09a0 100644
--- a/corepkgs/unpack-channel.nix
+++ b/corepkgs/unpack-channel.nix
@@ -6,19 +6,23 @@ let
''
mkdir $out
cd $out
- ${bzip2} -d < $src | ${tar} xf - --warning=no-timestamp
+ ${bzip2} -d < $src | ${tar} xf - --warning=no-timestamp
mv * $out/$channelName
+ if [ -n "$binaryCacheURL" ]; then
+ mkdir $out/binary-caches
+ echo -n "$binaryCacheURL" > $out/binary-caches/$channelName
+ fi
'';
in
-{ name, channelName, src }:
+{ name, channelName, src, binaryCacheURL ? "" }:
derivation {
system = builtins.currentSystem;
builder = shell;
args = [ "-e" builder ];
- inherit name channelName src;
+ inherit name channelName src binaryCacheURL;
PATH = "${nixBinDir}:${coreutils}";