diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index c74131a9e60..0fcbf2f3d0d 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -81,16 +81,16 @@ assert builtins.isList urls; assert urls != [] -> url == ""; assert url != "" -> urls == []; -assert showURLs || (outputHash != "" && outputHashAlgo != "") - || md5 != "" || sha1 != "" || sha256 != ""; let + hasHash = showURLs || (outputHash != "" && outputHashAlgo != "") + || md5 != "" || sha1 != "" || sha256 != ""; urls_ = if urls != [] then urls else [url]; in -stdenv.mkDerivation { +if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenv.lib.concatStringsSep ", " urls_}" else stdenv.mkDerivation { name = if showURLs then "urls" else if name != "" then name