about summary refs log tree commit diff
path: root/corepkgs/fetchurl.nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-02-16T13·06+0100
committerEelco Dolstra <edolstra@gmail.com>2017-02-16T13·06+0100
commitb63f79175e128f8ae394d2be7d65999263eebe27 (patch)
treed7b2a160baadf566d38a168c5b61f434c958299a /corepkgs/fetchurl.nix
parent40f0e3b366458a6f1bc09a366a218abf13a1af1e (diff)
<nix/fetchurl.nix>: Remove unnecessary assertion
Diffstat (limited to 'corepkgs/fetchurl.nix')
-rw-r--r--corepkgs/fetchurl.nix14
1 files changed, 5 insertions, 9 deletions
diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix
index 042705b1abb0..62359433971d 100644
--- a/corepkgs/fetchurl.nix
+++ b/corepkgs/fetchurl.nix
@@ -1,24 +1,20 @@
 { system ? builtins.currentSystem
 , url
-, outputHash ? ""
-, outputHashAlgo ? ""
 , md5 ? "", sha1 ? "", sha256 ? ""
+, outputHash ?
+    if sha1 != "" then sha1 else if md5 != "" then md5 else sha256
+, outputHashAlgo ?
+    if sha1 != "" then "sha1" else if md5 != "" then "md5" else "sha256"
 , executable ? false
 , unpack ? false
 , name ? baseNameOf (toString url)
 }:
 
-assert (outputHash != "" && outputHashAlgo != "")
-    || md5 != "" || sha1 != "" || sha256 != "";
-
 derivation {
   builder = "builtin:fetchurl";
 
   # New-style output content requirements.
-  outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
-      if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
-  outputHash = if outputHash != "" then outputHash else
-      if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
+  inherit outputHashAlgo outputHash;
   outputHashMode = if unpack || executable then "recursive" else "flat";
 
   inherit name system url executable unpack;