mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
fetchipfs: simplify, error-out when given multiple hashes
Also dropped the `md5` attribute, as `stdenv.mkDerivation` rejects
MD5 since last year (87c22100a6
)
This commit is contained in:
parent
30361c578f
commit
7c19bb37a3
@ -1,40 +1,25 @@
|
||||
{ stdenv
|
||||
{ lib
|
||||
, stdenv
|
||||
, curl
|
||||
}:
|
||||
|
||||
lib.fetchers.withNormalizedHash { hashTypes = [ "sha1" "sha256" "sha512" ]; } (
|
||||
{ ipfs
|
||||
, url ? ""
|
||||
, curlOpts ? ""
|
||||
, outputHash ? ""
|
||||
, outputHashAlgo ? ""
|
||||
, md5 ? ""
|
||||
, sha1 ? ""
|
||||
, sha256 ? ""
|
||||
, sha512 ? ""
|
||||
, outputHash
|
||||
, outputHashAlgo
|
||||
, meta ? {}
|
||||
, port ? "8080"
|
||||
, postFetch ? ""
|
||||
, preferLocalBuild ? true
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
hasHash = (outputHash != "" && outputHashAlgo != "")
|
||||
|| md5 != "" || sha1 != "" || sha256 != "" || sha512 != "";
|
||||
|
||||
in
|
||||
|
||||
if (!hasHash) then throw "Specify sha for fetchipfs fixed-output derivation" else stdenv.mkDerivation {
|
||||
stdenv.mkDerivation {
|
||||
name = ipfs;
|
||||
builder = ./builder.sh;
|
||||
nativeBuildInputs = [ curl ];
|
||||
|
||||
# New-style output content requirements.
|
||||
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
|
||||
if sha512 != "" then "sha512" else if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
|
||||
outputHash = if outputHash != "" then outputHash else
|
||||
if sha512 != "" then sha512 else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
|
||||
|
||||
inherit outputHash outputHashAlgo;
|
||||
outputHashMode = "recursive";
|
||||
|
||||
inherit curlOpts
|
||||
@ -48,3 +33,4 @@ if (!hasHash) then throw "Specify sha for fetchipfs fixed-output derivation" els
|
||||
# traffic, so don't do that.
|
||||
inherit preferLocalBuild;
|
||||
}
|
||||
)
|
||||
|
@ -1141,9 +1141,7 @@ with pkgs;
|
||||
|
||||
fetchRepoProject = callPackage ../build-support/fetchrepoproject { };
|
||||
|
||||
fetchipfs = import ../build-support/fetchipfs {
|
||||
inherit curl stdenv;
|
||||
};
|
||||
fetchipfs = callPackage ../build-support/fetchipfs { };
|
||||
|
||||
fetchit = callPackage ../applications/networking/cluster/fetchit { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user