fetchurl: friendly message if hash is not given
This commit is contained in:
parent
e9c9437445
commit
909b62fa6e
1 changed files with 3 additions and 3 deletions
|
@ -81,16 +81,16 @@ assert builtins.isList urls;
|
||||||
assert urls != [] -> url == "";
|
assert urls != [] -> url == "";
|
||||||
assert url != "" -> urls == [];
|
assert url != "" -> urls == [];
|
||||||
|
|
||||||
assert showURLs || (outputHash != "" && outputHashAlgo != "")
|
|
||||||
|| md5 != "" || sha1 != "" || sha256 != "";
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
hasHash = showURLs || (outputHash != "" && outputHashAlgo != "")
|
||||||
|
|| md5 != "" || sha1 != "" || sha256 != "";
|
||||||
urls_ = if urls != [] then urls else [url];
|
urls_ = if urls != [] then urls else [url];
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenv.lib.concatStringsSep ", " urls_}" else stdenv.mkDerivation {
|
||||||
name =
|
name =
|
||||||
if showURLs then "urls"
|
if showURLs then "urls"
|
||||||
else if name != "" then name
|
else if name != "" then name
|
||||||
|
|
Loading…
Reference in a new issue