about summary refs log tree commit diff
path: root/corepkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-14T16·38+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-14T16·38+0200
commite855c7e2c9a9a5cbe4406c1f9351181a9ebe6283 (patch)
tree1de5115d72e5ec55080a831297058dd0eb49b3be /corepkgs
parent969a14599d2f7bfd02971475b5b2be49fb965117 (diff)
nix-channel improvements
"nix-channel --add" now accepts a second argument: the channel name.
This allows channels to have a nicer name than (say) nixpkgs_unstable.
If no name is given, it defaults to the last component of the URL
(with "-unstable" or "-stable" removed).

Also, channels are now stored in a profile
(/nix/var/nix/profiles/per-user/$USER/channels).  One advantage of
this is that it allows rollbacks (e.g. if "nix-channel --update" gives
an undesirable update).
Diffstat (limited to 'corepkgs')
-rw-r--r--corepkgs/unpack-channel.nix6
-rw-r--r--corepkgs/unpack-channel.sh32
2 files changed, 6 insertions, 32 deletions
diff --git a/corepkgs/unpack-channel.nix b/corepkgs/unpack-channel.nix
index 5e6ccf23fd47..eba957dff4e7 100644
--- a/corepkgs/unpack-channel.nix
+++ b/corepkgs/unpack-channel.nix
@@ -1,11 +1,11 @@
 with import <nix/config.nix>;
 
-{ system, inputs }:
+{ name, src }:
 
 derivation {
-  name = "channels";
+  system = builtins.currentSystem;
   builder = shell;
   args = [ "-e" ./unpack-channel.sh ];
-  inherit system inputs bzip2 tar tr;
+  inherit name src bzip2 tar tr;
   PATH = "${nixBinDir}:${coreutils}";
 }
diff --git a/corepkgs/unpack-channel.sh b/corepkgs/unpack-channel.sh
index 7c244a6a8552..0b7d89bc4630 100644
--- a/corepkgs/unpack-channel.sh
+++ b/corepkgs/unpack-channel.sh
@@ -1,30 +1,4 @@
 mkdir $out
-mkdir $out/tmp
-cd $out/tmp
-
-inputs=($inputs)
-for ((n = 0; n < ${#inputs[*]}; n += 2)); do
-    channelName=${inputs[n]}
-    channelTarball=${inputs[n+1]}
-    
-    echo "unpacking channel $channelName"
-    
-    $bzip2 -d < $channelTarball | $tar xf -
-
-    if test -e */channel-name; then
-        channelName="$(cat */channel-name)"
-    fi
-
-    nr=1
-    attrName=$(echo $channelName | $tr -- '- ' '__')
-    dirName=$attrName
-    while test -e ../$dirName; do
-        nr=$((nr+1))
-        dirName=$attrName-$nr
-    done
-
-    mv * ../$dirName # !!! hacky
-done
-
-cd ..
-rmdir tmp
+cd $out
+$bzip2 -d < $src | $tar xf -
+mv * $out/$name