forked from mirrors/nixpkgs
Merge pull request #269141 from fgaz/fetchfossil/sri-hash
fetchfossil: support SRI hashes
This commit is contained in:
commit
6cb7677277
|
@ -1,7 +1,15 @@
|
||||||
{stdenv, lib, fossil, cacert}:
|
{stdenv, lib, fossil, cacert}:
|
||||||
|
|
||||||
{name ? null, url, rev, sha256}:
|
{ name ? null
|
||||||
|
, url
|
||||||
|
, rev
|
||||||
|
, sha256 ? ""
|
||||||
|
, hash ? ""
|
||||||
|
}:
|
||||||
|
|
||||||
|
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}");
|
name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
|
@ -11,9 +19,14 @@ stdenv.mkDerivation {
|
||||||
# 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 = "sha256";
|
outputHashAlgo = if hash != "" then null else "sha256";
|
||||||
outputHashMode = "recursive";
|
outputHashMode = "recursive";
|
||||||
outputHash = sha256;
|
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 a new issue