Skip to content

Commit

Permalink
If the (redirected) channel URL contains a version number, use it
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Apr 14, 2012
1 parent 1d0bafb commit 0b5107c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions corepkgs/unpack-channel.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
with import <nix/config.nix>;

{ name, src }:
{ name, channelName, src }:

derivation {
system = builtins.currentSystem;
builder = shell;
args = [ "-e" ./unpack-channel.sh ];
inherit name src bzip2 tar tr;
inherit name channelName src bzip2 tar tr;
PATH = "${nixBinDir}:${coreutils}";
}
2 changes: 1 addition & 1 deletion corepkgs/unpack-channel.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mkdir $out
cd $out
$bzip2 -d < $src | $tar xf -
mv * $out/$name
mv * $out/$channelName
8 changes: 7 additions & 1 deletion scripts/nix-channel.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0b5107c

Please sign in to comment.