If the (redirected) channel URL contains a version number, use it

This commit is contained in:
Eelco Dolstra 2012-04-14 21:05:28 +02:00
parent 1d0bafb74d
commit 0b5107c016
3 changed files with 10 additions and 4 deletions

View file

@ -1,11 +1,11 @@
with import <nix/config.nix>; with import <nix/config.nix>;
{ name, src }: { name, channelName, src }:
derivation { derivation {
system = builtins.currentSystem; system = builtins.currentSystem;
builder = shell; builder = shell;
args = [ "-e" ./unpack-channel.sh ]; args = [ "-e" ./unpack-channel.sh ];
inherit name src bzip2 tar tr; inherit name channelName src bzip2 tar tr;
PATH = "${nixBinDir}:${coreutils}"; PATH = "${nixBinDir}:${coreutils}";
} }

View file

@ -1,4 +1,4 @@
mkdir $out mkdir $out
cd $out cd $out
$bzip2 -d < $src | $tar xf - $bzip2 -d < $src | $tar xf -
mv * $out/$name mv * $out/$channelName

View file

@ -108,7 +108,13 @@ sub update {
die "cannot fetch `$fullURL'" if $? != 0; die "cannot fetch `$fullURL'" if $? != 0;
chomp $path; 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 # Unpack the channel tarballs into the Nix store and install them