diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/nix-prefetch-url.in | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in index 9a67ca1417f2..c4731f3f627b 100644 --- a/scripts/nix-prefetch-url.in +++ b/scripts/nix-prefetch-url.in @@ -3,6 +3,8 @@ url=$1 hash=$2 +hashType="sha1" + if test -z "$url"; then echo "syntax: nix-prefetch-url URL" >&2 exit 1 @@ -27,7 +29,7 @@ if test -z "$hash"; then @curl@ --fail --location --max-redirs 20 "$url" > $tmpPath1 # Compute the hash. - hash=$(@bindir@/nix-hash --flat $tmpPath1) + hash=$(@bindir@/nix-hash --base32 --type "$hashType" --flat $tmpPath1) if ! test -n "$QUIET"; then echo "hash is $hash" >&2; fi # Rename it so that the fetchurl builder can find it. @@ -41,9 +43,11 @@ fi # Create a Nix expression that does a fetchurl. storeExpr=$( \ echo "(import @datadir@/nix/corepkgs/fetchurl) \ - {url = $url; md5 = \"$hash\"; system = \"@system@\";}" \ + {url = $url; outputHashAlgo = \"$hashType\"; outputHash = \"$hash\"; system = \"@system@\";}" \ | @bindir@/nix-instantiate -) +echo "$storeExpr" + # Realise it. finalPath=$(@bindir@/nix-store -qnB --force-realise $storeExpr) |