fetchurl: friendly message if hash is not given

This commit is contained in:
Domen Kožar 2014-11-23 17:10:20 +01:00
parent e9c9437445
commit 909b62fa6e

View File

@ -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