about summary refs log tree commit diff
path: root/corepkgs/unpack-channel.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-27T18·34-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-27T18·34-0400
commit15e1b2c223494ecb5efefc3ea0e3b926a6b1d7dc (patch)
tree49c0c914a6d3d02f54150bfaba3731aa9b98d720 /corepkgs/unpack-channel.nix
parenta9e6752bbd888ab8fbc1cda6e4d539b2858c4cef (diff)
parent9e2fc6951ca049b15149a2c4b75d2f5bff7f07e1 (diff)
Merge branch 'no-manifests'
Diffstat (limited to 'corepkgs/unpack-channel.nix')
-rw-r--r--corepkgs/unpack-channel.nix25
1 files changed, 21 insertions, 4 deletions
diff --git a/corepkgs/unpack-channel.nix b/corepkgs/unpack-channel.nix
index 245430ab0feb..57d5a09a076a 100644
--- a/corepkgs/unpack-channel.nix
+++ b/corepkgs/unpack-channel.nix
@@ -1,14 +1,31 @@
 with import <nix/config.nix>;
 
-{ name, channelName, src }:
+let
+
+  builder = builtins.toFile "unpack-channel.sh"
+    ''
+      mkdir $out
+      cd $out
+      ${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, binaryCacheURL ? "" }:
 
 derivation {
   system = builtins.currentSystem;
   builder = shell;
-  args = [ "-e" ./unpack-channel.sh ];
-  inherit name channelName src bzip2 tar tr;
+  args = [ "-e" builder ];
+  inherit name channelName src binaryCacheURL;
+
   PATH = "${nixBinDir}:${coreutils}";
-  
+
   # No point in doing this remotely.
   preferLocalBuild = true;