From 0b5107c016080e70d30ccba3afa0f9aa7a90a891 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 14 Apr 2012 21:05:28 +0200 Subject: If the (redirected) channel URL contains a version number, use it --- scripts/nix-channel.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts/nix-channel.in') 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 -- cgit 1.4.1