summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-13 12:56:51 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-04-13 14:11:14 +0200
commit3ecbe604ef751f475a247275ccff8c95f835aa3b (patch)
treea8df91223871adda58c925cd866f793d97d13194 /pkgs/build-support
parentd0fd5518769d14c470643c14fe4d1cfeb649ccec (diff)
downloadnixlib-3ecbe604ef751f475a247275ccff8c95f835aa3b.tar
nixlib-3ecbe604ef751f475a247275ccff8c95f835aa3b.tar.gz
nixlib-3ecbe604ef751f475a247275ccff8c95f835aa3b.tar.bz2
nixlib-3ecbe604ef751f475a247275ccff8c95f835aa3b.tar.lz
nixlib-3ecbe604ef751f475a247275ccff8c95f835aa3b.tar.xz
nixlib-3ecbe604ef751f475a247275ccff8c95f835aa3b.tar.zst
nixlib-3ecbe604ef751f475a247275ccff8c95f835aa3b.zip
fetchurl: Support SHA-512 hashes
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchurl/default.nix7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index d4b46cf9e9d4..3cd64ed1c02f 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -61,6 +61,7 @@ in
 , md5 ? ""
 , sha1 ? ""
 , sha256 ? ""
+, sha512 ? ""
 
 , recursiveHash ? false
 
@@ -91,7 +92,7 @@ assert (urls == []) != (url == "");
 let
 
   hasHash = showURLs || (outputHash != "" && outputHashAlgo != "")
-    || md5 != "" || sha1 != "" || sha256 != "";
+    || md5 != "" || sha1 != "" || sha256 != "" || sha512 != "";
   urls_ = if urls != [] then urls else [url];
 
 in
@@ -114,9 +115,9 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s
 
   # New-style output content requirements.
   outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
-      if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
+      if sha512 != "" then "sha512" else if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
   outputHash = if outputHash != "" then outputHash else
-      if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
+      if sha512 != "" then sha512 else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
 
   outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";