[Nix-dev] nix-build $CONFIG -A package

Mathijs Kwik mathijs at bluescreen303.nl
Fri Apr 13 19:36:55 CEST 2012


#!/bin/sh

# Unpacks the target
unpack () {
        local curSrc="$1"
        local friendlyName="$2"
        test -z "$curSrc" && return 2
        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 - ;;
                *.tar.xz) tar xvf $curSrc ;;
                *.zip) unzip $curSrc ;;
                *) if test -d "$curSrc" ; then
                                if test -n "$friendlyName" ; then
                                        cp -prvd "$curSrc" "./$friendlyName"
                                else
                                        cp -prvd "$curSrc" .
                                fi
                        else
                                echo "source archive $curSrc has
unknown type" >&2
                                return 1
                        fi ;;
        esac
}

# Fetches the tarball into a store
fetch () {
        nix-build $NIXPKGS_ALL -A $1.src --show-trace
}

NIXPKGS_ALL=/etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix
unpack `fetch $1` $1


On Fri, Apr 13, 2012 at 7:04 PM, Sergey Mironov <ierton at gmail.com> wrote:
> Hi!
>
> I used to call function
>
> fetch () {
>        nix-build $NIXPKGS_ALL -A $1.src --show-trace
> }
>
> to download a source tarball for a package.
>
> But it doesn't work anymore! That is because of absence of
> $NIXPKGS_ALL in my environment. How to fix it? I've tried the
> following, also unsuccessfully:
>
> $ nix-build /etc/nixos/configuration.nix -A firefox.src --show-trace
> error: cannot auto-call a function that has an argument without a
> default value (`config')
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list