nix-super/corepkgs/channels/unpack.sh.in
Eelco Dolstra bddc83a148 * New builtin function "isFunction". You're not supposed to use it
;-)
* Channels: fix channels that are plain lists of derivations (like
  strategoxt-unstable) instead  of functions (like nixpkgs-unstable).
  This fixes the error message "error: the left-hand side of the
  function call is neither a function nor a primop (built-in
  operation) but a list".
2007-05-16 16:17:04 +00:00

33 lines
751 B
Bash

#! @shell@ -e
@coreutils@/mkdir $out
@coreutils@/mkdir $out/tmp
cd $out/tmp
expr=$out/default.nix
echo '{' > $expr
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 = let e = import ./$dirName; in if builtins.isFunction e then e {} else e;" >> $expr
done
echo '} // {_combineChannels = true;}' >> $expr
cd ..
@coreutils@/rmdir tmp