fetchfossil: simplify and check that multiple hashes were not passed in
This commit is contained in:
parent
f723aa0f66
commit
c3691d772d
@ -1,33 +1,26 @@
|
|||||||
{stdenv, lib, fossil, cacert}:
|
{stdenv, lib, fossil, cacert}:
|
||||||
|
|
||||||
{ name ? null
|
lib.fetchers.withNormalizedHash { } (
|
||||||
, url
|
{ name ? null
|
||||||
, rev
|
, url
|
||||||
, sha256 ? ""
|
, rev
|
||||||
, hash ? ""
|
, outputHash ? lib.fakeHash
|
||||||
}:
|
, outputHashAlgo ? null
|
||||||
|
}:
|
||||||
|
|
||||||
if hash != "" && sha256 != "" then
|
stdenv.mkDerivation {
|
||||||
throw "Only one of sha256 or hash can be set"
|
name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
|
||||||
else
|
builder = ./builder.sh;
|
||||||
stdenv.mkDerivation {
|
nativeBuildInputs = [fossil cacert];
|
||||||
name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
|
|
||||||
builder = ./builder.sh;
|
|
||||||
nativeBuildInputs = [fossil cacert];
|
|
||||||
|
|
||||||
# Envvar docs are hard to find. A link for the future:
|
# Envvar docs are hard to find. A link for the future:
|
||||||
# https://www.fossil-scm.org/index.html/doc/trunk/www/env-opts.md
|
# https://www.fossil-scm.org/index.html/doc/trunk/www/env-opts.md
|
||||||
impureEnvVars = [ "http_proxy" ];
|
impureEnvVars = [ "http_proxy" ];
|
||||||
|
|
||||||
outputHashAlgo = if hash != "" then null else "sha256";
|
inherit outputHash outputHashAlgo;
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHash = if hash != "" then
|
|
||||||
hash
|
|
||||||
else if sha256 != "" then
|
|
||||||
sha256
|
|
||||||
else
|
|
||||||
lib.fakeSha256;
|
|
||||||
|
|
||||||
inherit url rev;
|
inherit url rev;
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user