On Sun, Jan 29, 2012 at 11:56:20AM +0100, Marc Weber wrote:
> I use the followiing two functions, the first is a copy paste from
> unpack phase
> 
> alias nb="nix-build $(NIXPKGS_ALL) -A"
> 
> cdunpack () {
>       local curSrc="$1"
>       local b=$(basename "$1")
>       local dir="/tmp/${b}-unpacked"
>       [ -e "$dir" ] || {
>               mdc "$dir"
>               case "$curSrc" in
>                       (*.tar) tar xvf $curSrc ;;
>                       (*.tar.gz|*.tgz|*.tar.Z) gzip -d < $curSrc | tar xvf - 
> ;;
>                       (*.tar.bz2|*.tbz2) bzip2 -d < $curSrc | tar xvf - ;;
>                       (*.zip) unzip $curSrc ;;
>                       (*) if test -d "$curSrc"
>                               then
>                                       stripHash $curSrc
>                                       cp -prvd $curSrc $strippedName
>                               else
>                                       if test -z "$unpackCmd"
>                                       then
>                                               echo "source archive $curSrc 
> has unknown type"
>                                               return 1
>                                       fi
>                                       runHook unpackCmd
>                               fi ;;
>               esac
>       }
>       cd $dir
> }
> 
> cdsrc () {
>       cdunpack "$(nb ${1}.src --show-trace )"
> }
> 
> Adjust to your liking.

Thanks, I've created a wiki page describing that.
http://nixos.org/wiki/How_to_unpack_a_package%27s_sourcecode

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to