diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01T23·16+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01T23·16+0000 |
commit | 93aefd9fc0250eda2c47d22a88922d319cde34b8 (patch) | |
tree | 76ed8bbf3758f48a7b8d594552b80dfbf23540ec /scripts | |
parent | a9d15d4f434fece269852a65be836d1338ed787d (diff) |
* Give unpacked channels more sensible names than 0, 1, ... They now
get the basename of the channel URL (e.g., nixpkgs-unstable). The top-level Nix expression of the channel is now an attribute set, the attributes of which are the individual channels (e.g., {nixpkgs_unstable = ...; strategoxt_unstable = ...}). This makes attribute paths ("nix-env -qaA" and "nix-env -iA") more sensible, e.g., "nix-env -iA nixpkgs_unstable.subversion".
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/nix-channel.in | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in index 73096a12baba..095f36d79499 100644 --- a/scripts/nix-channel.in +++ b/scripts/nix-channel.in @@ -89,21 +89,22 @@ sub update { # Create a Nix expression that fetches and unpacks the channel Nix # expressions. - my $nixExpr = "["; + my $inputs = "["; foreach my $url (@channels) { + $url =~ /\/([^\/]+)\/?$/; + my $channelName = $1; + $channelName = "unnamed" unless defined $channelName; + print "$channelName\n"; + my $fullURL = "$url/nixexprs.tar.bz2"; print "downloading Nix expressions from `$fullURL'...\n"; $ENV{"PRINT_PATH"} = 1; my ($hash, $path) = `@bindir@/nix-prefetch-url '$fullURL' 2> /dev/null`; die "cannot fetch `$fullURL'" if $? != 0; chomp $path; - $nixExpr .= $path . " "; + $inputs .= '"' . $channelName . '"' . " " . $path . " "; } - $nixExpr .= "]"; - - $nixExpr = - "(import @datadir@/nix/corepkgs/channels/unpack.nix) " . - "{inputs = $nixExpr; system = \"@system@\";}"; + $inputs .= "]"; # Figure out a name for the GC root. my $userName = getpwuid($<); @@ -113,7 +114,7 @@ sub update { # Instantiate the Nix expression. print "unpacking channel Nix expressions...\n"; - my $storeExpr = `echo '$nixExpr' | @bindir@/nix-instantiate --add-root '$rootFile'.tmp -` + my $storeExpr = `@bindir@/nix-instantiate --add-root '$rootFile'.tmp @datadir@/nix/corepkgs/channels/unpack.nix --argstr system @system@ --arg inputs '$inputs'` or die "cannot instantiate Nix expression"; chomp $storeExpr; |