about summary refs log blame commit diff
path: root/corepkgs/channels/unpack.sh.in
blob: 1f2886a6ab4f7c9001a66866ebff1ace701322dc (plain) (tree)
1
2
3
4
5
6
7
8
9

             

                          


                     
                
 
















                                                 
                                                                                                        

    
                                               

     
                     
#! @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