diff options
author | nicoo <nicoo@mur.at> | 2023-08-30 09:45:56 +0000 |
---|---|---|
committer | nicoo <nicoo@mur.at> | 2023-08-30 09:51:22 +0000 |
commit | af5682b3e1ced9d3f764a548ee7e1459fbcc5969 (patch) | |
tree | 6427bbfe83c467b32fc05530319abc67c0027ed8 | |
parent | a59f03079c8d87cbfef51c8ffd61e8da28d9bce4 (diff) | |
download | nixpkgs-af5682b3e1ced9d3f764a548ee7e1459fbcc5969.tar nixpkgs-af5682b3e1ced9d3f764a548ee7e1459fbcc5969.tar.gz nixpkgs-af5682b3e1ced9d3f764a548ee7e1459fbcc5969.tar.bz2 nixpkgs-af5682b3e1ced9d3f764a548ee7e1459fbcc5969.tar.lz nixpkgs-af5682b3e1ced9d3f764a548ee7e1459fbcc5969.tar.xz nixpkgs-af5682b3e1ced9d3f764a548ee7e1459fbcc5969.tar.zst nixpkgs-af5682b3e1ced9d3f764a548ee7e1459fbcc5969.zip |
fetchurl: Correctly handle { outputHash != ""; outputHashAlgo = "" }
Previously, the error that would be thrown would have been confusing: ``` fetchurl requires a hash for fixed-output derivation ```
-rw-r--r-- | pkgs/build-support/fetchurl/default.nix | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index 4d52020fe21..a9c2c7c46d1 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -124,7 +124,9 @@ let then throw "multiple hashes passed to fetchurl" else if hash != "" then { outputHashAlgo = null; outputHash = hash; } - else if (outputHash != "" && outputHashAlgo != "") then { inherit outputHashAlgo outputHash; } + else if outputHash != "" then + if outputHashAlgo != "" then { inherit outputHashAlgo outputHash; } + else throw "fetchurl was passed outputHash without outputHashAlgo" else if sha512 != "" then { outputHashAlgo = "sha512"; outputHash = sha512; } else if sha256 != "" then { outputHashAlgo = "sha256"; outputHash = sha256; } else if sha1 != "" then { outputHashAlgo = "sha1"; outputHash = sha1; } |