From afa7e0187815d89c8af93fa9c1081bf67ab0f10e Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Wed, 1 Aug 2012 16:34:17 -0400
Subject: [PATCH] Inline unpack-channel.sh

---
 corepkgs/Makefile.am        |  2 +-
 corepkgs/unpack-channel.nix | 19 ++++++++++++++++---
 corepkgs/unpack-channel.sh  |  4 ----
 3 files changed, 17 insertions(+), 8 deletions(-)
 delete mode 100644 corepkgs/unpack-channel.sh

diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am
index 4b0b8860b..111b667d0 100644
--- a/corepkgs/Makefile.am
+++ b/corepkgs/Makefile.am
@@ -1,6 +1,6 @@
 all-local: config.nix
 
-files = nar.nix buildenv.nix buildenv.pl unpack-channel.nix unpack-channel.sh derivation.nix fetchurl.nix \
+files = nar.nix buildenv.nix buildenv.pl unpack-channel.nix derivation.nix fetchurl.nix \
 	imported-drv-to-derivation.nix
 
 install-exec-local:
diff --git a/corepkgs/unpack-channel.nix b/corepkgs/unpack-channel.nix
index 245430ab0..b26bece30 100644
--- a/corepkgs/unpack-channel.nix
+++ b/corepkgs/unpack-channel.nix
@@ -1,14 +1,27 @@
 with import <nix/config.nix>;
 
+let
+
+  builder = builtins.toFile "unpack-channel.sh"
+    ''
+      mkdir $out
+      cd $out
+      ${bzip2} -d < $src | ${tar} xf -
+      mv * $out/$channelName
+    '';
+
+in
+
 { name, channelName, src }:
 
 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;
+
   PATH = "${nixBinDir}:${coreutils}";
-  
+
   # No point in doing this remotely.
   preferLocalBuild = true;
 
diff --git a/corepkgs/unpack-channel.sh b/corepkgs/unpack-channel.sh
deleted file mode 100644
index f42b0870a..000000000
--- a/corepkgs/unpack-channel.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-mkdir $out
-cd $out
-$bzip2 -d < $src | $tar xf -
-mv * $out/$channelName
-- 
GitLab