about summary refs log tree commit diff
path: root/scripts/nix-reduce-build.in
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2008-08-02T16·43+0000
committerMichael Raskin <7c6f434c@mail.ru>2008-08-02T16·43+0000
commitb3c26180e33856f16e1e5ceea30b951065b4ebc1 (patch)
treebd480a3cb0a770c926a27238accf87f9e4ffd4af /scripts/nix-reduce-build.in
parent3c92ea399d717dc45b3fa91424c0dadc0239ebf2 (diff)
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
Diffstat (limited to 'scripts/nix-reduce-build.in')
-rw-r--r--scripts/nix-reduce-build.in33
1 files changed, 32 insertions, 1 deletions
diff --git a/scripts/nix-reduce-build.in b/scripts/nix-reduce-build.in
index 5fc731c7ec8c..7da368a22cf5 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;