From 909b62fa6e04aa70c691706beac8ff9c5e806281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 23 Nov 2014 17:10:20 +0100 Subject: [PATCH] fetchurl: friendly message if hash is not given --- pkgs/build-support/fetchurl/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index c74131a9e607..0fcbf2f3d0da 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