From b3c26180e33856f16e1e5ceea30b951065b4ebc1 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Sat, 2 Aug 2008 16:43:25 +0000 Subject: [PATCH] Updates to nix-reduce-build: only realize fixed derivations if user asks so, or only use substituters. Oh, and add possibility to use : for things like /etc/nixos/nixpkgs:-A:gnused --- scripts/nix-reduce-build.in | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/scripts/nix-reduce-build.in b/scripts/nix-reduce-build.in index 5fc731c7e..7da368a22 100644 --- a/scripts/nix-reduce-build.in +++ b/scripts/nix-reduce-build.in @@ -20,6 +20,10 @@ if test -z "$1" || test "a--help" = "a$1" ; then echo "nix-reduce-build /e.nix -- nix-daemon:// nix-self://" >&2 echo " nix-daemon:// builds using daemon" echo " nix-self:// builds directly using nix-store from current installation" >&2 + echo " nix-daemon-fixed:// and nix-self-fixed:// do the same, but only for" >&2; + echo "derivations with specified output hash (sha256, sha1 or md5)." >&2 + echo " nix-daemon-substitute:// and nix-self-substitute:// try to substitute" >&2; + echo "maximum amount of paths" >&2; exit; fi; @@ -36,7 +40,10 @@ while read ; do echo "$REPLY" >> paths; >&2 ;; *) - nix-instantiate "$REPLY" >> paths; + ( + IFS=: ; + nix-instantiate $REPLY >> paths; + ); ;; esac; done < initial; @@ -106,6 +113,30 @@ for i in "$@"; do echo "Realising $REPLY using direct Nix build" >&2 NIX_REMOTE= @bindir@/nix-store -r "${REPLY}" done; + elif [ "$i" = "nix-daemon-fixed://" ] ; then + cat derivers-closure | while read; do + if egrep '"(md5|sha1|sha256)"' "$REPLY" &>/dev/null; then + echo "Realising $REPLY using nix-daemon" >&2 + NIX_REMOTE=daemon @bindir@/nix-store -r "${REPLY}" + fi; + done; + elif [ "$i" = "nix-self-fixed://" ] ; then + cat derivers-closure | while read; do + if egrep '"(md5|sha1|sha256)"' "$REPLY" &>/dev/null; then + echo "Realising $REPLY using direct Nix build" >&2 + NIX_REMOTE= @bindir@/nix-store -r "${REPLY}" + fi; + done; + elif [ "$i" = "nix-daemon-substitute://" ] ; then + cat needed-paths | while read ; do + echo "Substituting $REPLY using nix-daemon" >&2 + NIX_REMOTE=daemon @bindir@/nix-store -r "${NIX_STORE_DIR:-/nix/store}/${REPLY##*/}" + done; + elif [ "$i" = "nix-self-substitute://" ] ; then + cat needed-paths | while read ; do + echo "Substituting $REPLY using direct Nix build" >&2 + NIX_REMOTE= @bindir@/nix-store -r "${NIX_STORE_DIR:-/nix/store}/${REPLY##*/}" + done; fi; mv needed-paths wanted-paths; cat wanted-paths | xargs nix-store --check-validity --print-invalid > needed-paths;