mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
fetchfossil: simplify and check that multiple hashes were not passed in
This commit is contained in:
parent
f723aa0f66
commit
c3691d772d
@ -1,16 +1,14 @@
|
||||
{stdenv, lib, fossil, cacert}:
|
||||
|
||||
{ name ? null
|
||||
, url
|
||||
, rev
|
||||
, sha256 ? ""
|
||||
, hash ? ""
|
||||
}:
|
||||
lib.fetchers.withNormalizedHash { } (
|
||||
{ name ? null
|
||||
, url
|
||||
, rev
|
||||
, outputHash ? lib.fakeHash
|
||||
, outputHashAlgo ? null
|
||||
}:
|
||||
|
||||
if hash != "" && sha256 != "" then
|
||||
throw "Only one of sha256 or hash can be set"
|
||||
else
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation {
|
||||
name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
|
||||
builder = ./builder.sh;
|
||||
nativeBuildInputs = [fossil cacert];
|
||||
@ -19,15 +17,10 @@ stdenv.mkDerivation {
|
||||
# https://www.fossil-scm.org/index.html/doc/trunk/www/env-opts.md
|
||||
impureEnvVars = [ "http_proxy" ];
|
||||
|
||||
outputHashAlgo = if hash != "" then null else "sha256";
|
||||
inherit outputHash outputHashAlgo;
|
||||
outputHashMode = "recursive";
|
||||
outputHash = if hash != "" then
|
||||
hash
|
||||
else if sha256 != "" then
|
||||
sha256
|
||||
else
|
||||
lib.fakeSha256;
|
||||
|
||||
inherit url rev;
|
||||
preferLocalBuild = true;
|
||||
}
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user