Skip to content

Commit

Permalink
fetchurl: disallow specifying both sha256 and hash
Browse files Browse the repository at this point in the history
A full check would be more complicated to write -
and more importantly - probably also more expensive.

Motivation: eval-time catch for errors like in commit 8198636.
  • Loading branch information
vcunat committed Jul 26, 2022
1 parent 59d1371 commit cb704bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkgs/build-support/fetchurl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit cb704bf

Please sign in to comment.