* 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".
This commit is contained in:
Eelco Dolstra 2007-05-01 23:16:38 +00:00
parent a9d15d4f43
commit 93aefd9fc0
5 changed files with 43 additions and 20 deletions

View file

@ -5,18 +5,29 @@
cd $out/tmp
expr=$out/default.nix
echo '[' > $expr
echo '{' > $expr
nr=0
for i in $inputs; do
echo "unpacking $i"
@bunzip2@ < $i | @tar@ xf -
@coreutils@/mv * ../$nr # !!! hacky
echo "(import ./$nr)" >> $expr
nr=$(($nr + 1))
inputs=($inputs)
for ((n = 0; n < ${#inputs[*]}; n += 2)); do
channelName=${inputs[n]}
channelTarball=${inputs[n+1]}
echo "unpacking channel $channelName"
@bunzip2@ < $channelTarball | @tar@ xf -
nr=1
dirName=$channelName
while test -e ../$dirName; do
nr=$((nr+1))
dirName=$channelName-$nr
done
@coreutils@/mv * ../$dirName # !!! hacky
attrName=$(echo $dirName | @tr@ -- '- ' '__')
echo "$attrName = import ./$dirName {};" >> $expr
done
echo ']' >> $expr
echo '} // {_combineChannels = true;}' >> $expr
cd ..
@coreutils@/rmdir tmp