* Adapted nix-pull to use the new substitute mechanism.
This commit is contained in:
parent
3f3a3ae87b
commit
37ee6cef99
8 changed files with 99 additions and 58 deletions
|
@ -1 +1 @@
|
|||
SUBDIRS = fetchurl nar buildenv channels
|
||||
SUBDIRS = fetchurl nar buildenv channels nix-pull
|
||||
|
|
11
corepkgs/nix-pull/Makefile.am
Normal file
11
corepkgs/nix-pull/Makefile.am
Normal file
|
@ -0,0 +1,11 @@
|
|||
all-local: builder.sh
|
||||
|
||||
install-exec-local:
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull
|
||||
$(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull
|
||||
$(INSTALL_PROGRAM) builder.sh $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull
|
||||
|
||||
include ../../substitute.mk
|
||||
|
||||
EXTRA_DIST = default.nix builder.sh.in
|
34
corepkgs/nix-pull/builder.sh.in
Normal file
34
corepkgs/nix-pull/builder.sh.in
Normal file
|
@ -0,0 +1,34 @@
|
|||
#! @shell@ -e
|
||||
|
||||
export PATH=/bin:/usr/bin
|
||||
|
||||
mkdir $out
|
||||
|
||||
cat > $out/fetch <<EOF
|
||||
#! @shell@ -e
|
||||
|
||||
export PATH=/bin:/usr/bin
|
||||
|
||||
echo "downloading \$2..."
|
||||
|
||||
export PRINT_PATH=1
|
||||
result=(\$(@bindir@/nix-prefetch-url \$2))
|
||||
|
||||
hash=\${result[0]}
|
||||
path=\${result[1]}
|
||||
|
||||
if test "\$hash" != "\$3"; then
|
||||
echo "hash is \$hash, expected \$3"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "unpacking into \$1..."
|
||||
|
||||
if ! @bunzip2@ < "\$path" | @bindir@/nix-store --restore "\$1"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
chmod +x $out/fetch
|
7
corepkgs/nix-pull/default.nix
Normal file
7
corepkgs/nix-pull/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{system}:
|
||||
|
||||
derivation {
|
||||
name = "nix-pull";
|
||||
builder = ./builder.sh;
|
||||
inherit system;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue