@@ -49,8 +49,11 @@ in
4949 # first element of `urls').
5050 name ? ""
5151
52− # Different ways of specifying the hash.
53−, outputHash ? ""
52+, # SRI hash.
53+ hash ? ""
54+
55+, # Legacy ways of specifying the hash.
56+ outputHash ? ""
5457, outputHashAlgo ? ""
5558, md5 ? ""
5659, sha1 ? ""
@@ -103,7 +106,8 @@ let
103106 else throw "fetchurl requires either `url` or `urls` to be set";
104107
105108 hash_ =
106− if md5 != "" then throw "fetchurl does not support md5 anymore, please use sha256 or sha512"
109+ if hash != "" then { outputHashAlgo = null; outputHash = hash; }
110+ else if md5 != "" then throw "fetchurl does not support md5 anymore, please use sha256 or sha512"
107111 else if (outputHash != "" && outputHashAlgo != "") then { inherit outputHashAlgo outputHash; }
108112 else if sha512 != "" then { outputHashAlgo = "sha512"; outputHash = sha512; }
109113 else if sha256 != "" then { outputHashAlgo = "sha256"; outputHash = sha256; }