diff options
-rw-r--r-- | scripts/nix-reduce-build.in | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/nix-reduce-build.in b/scripts/nix-reduce-build.in index 6d7f8bdd7f63..7e546aa60fbb 100644 --- a/scripts/nix-reduce-build.in +++ b/scripts/nix-reduce-build.in @@ -56,9 +56,18 @@ if test -z "$1" ; then fi; for i in "$@"; do - cat needed-paths | while read; do - nix-copy-closure --from "$i" --gzip "$REPLY" </dev/null || true; - done; + sshHost="${i#ssh://}"; + httpHost="${i#http://}"; + httpsHost="${i#https://}"; + if [ "$i" != "$sshHost" ]; then + cat needed-paths | while read; do + nix-copy-closure --from "$sshHost" --gzip "$REPLY" </dev/null || true; + done; + elif [ "$i" != "$httpHost" ] || [ "$i" != "$httpsHost" ]; then + cat needed-paths | while read; do + curl -L "$i${REPLY##*/}" | gunzip | nix-store --import; + done; + fi; mv needed-paths wanted-paths; cat wanted-paths | xargs nix-store --check-validity --print-invalid > needed-paths; echo We still need $(cat needed-paths | wc -l) paths. >&2 |