about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2022-08-24 17:04:57 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2022-08-24 17:05:37 +0200
commit0e304ff0d9db453a4b230e9386418fd974d5804a (patch)
tree28a3ca480c99f3e8ae33c8b07aed404c95a80d84 /pkgs/build-support
parent8d3fc481a4cbd2ec474ff05996b91c76ede3132e (diff)
parentad8d5e0c3b3ab8fe5dece06b259435231d551d8c (diff)
Merge #182953: fetchurl: disallow specifying both `sha256` and `hash`
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchurl/default.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index 7ec831c61ac70..a85d53adb8292 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -117,6 +117,9 @@ let
     else throw "fetchurl requires either `url` or `urls` to be set";
 
   hash_ =
+    # Many other combinations don't make sense, but this is the most common one:
+    if hash != "" && sha256 != "" then throw "multiple hashes passed to fetchurl" else
+
     if hash != "" then { outputHashAlgo = null; outputHash = hash; }
     else if md5 != "" then throw "fetchurl does not support md5 anymore, please use sha256 or sha512"
     else if (outputHash != "" && outputHashAlgo != "") then { inherit outputHashAlgo outputHash; }