about summary refs log tree commit diff
path: root/scripts/nix-channel.in
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-14T19·05+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-04-14T19·05+0200
commit0b5107c016080e70d30ccba3afa0f9aa7a90a891 (patch)
tree176724458a501591ae129aed133c95d2ecea1e71 /scripts/nix-channel.in
parent1d0bafb74d17f14778005a633ee332ad0ad9ba9e (diff)
If the (redirected) channel URL contains a version number, use it
Diffstat (limited to 'scripts/nix-channel.in')
-rwxr-xr-xscripts/nix-channel.in8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index b3251975b52b..64e5aa01282b 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -108,7 +108,13 @@ sub update {
         die "cannot fetch `$fullURL'" if $? != 0;
         chomp $path;
 
-        $exprs .= "'f: f { name = \"$name\"; src = builtins.storePath \"$path\"; }' ";
+        # If the URL contains a version number, append it to the name
+        # attribute (so that "nix-env -q" on the channels profile
+        # shows something useful).
+        my $cname = $name;
+        $cname .= $1 if basename($url) =~ /(-\d.*)$/;
+
+        $exprs .= "'f: f { name = \"$cname\"; channelName = \"$name\"; src = builtins.storePath \"$path\"; }' ";
     }
 
     # Unpack the channel tarballs into the Nix store and install them