2021-01-27 05:50:30 +00:00
|
|
|
{ lib, stdenvNoCC, mercurial }:
|
2018-12-31 07:10:28 +00:00
|
|
|
{ name ? null
|
|
|
|
, url
|
|
|
|
, rev ? null
|
|
|
|
, sha256 ? null
|
2023-04-03 10:36:38 +00:00
|
|
|
, hash ? null
|
2018-12-31 07:10:28 +00:00
|
|
|
, fetchSubrepos ? false
|
|
|
|
, preferLocalBuild ? true }:
|
2007-09-04 12:45:00 +00:00
|
|
|
|
2023-07-16 06:24:53 +00:00
|
|
|
if hash != null && sha256 != null then
|
2023-04-03 10:36:38 +00:00
|
|
|
throw "Only one of sha256 or hash can be set"
|
2017-03-13 12:31:44 +00:00
|
|
|
else
|
2009-11-14 20:14:21 +00:00
|
|
|
# TODO: statically check if mercurial as the https support if the url starts woth https.
|
2018-01-09 23:38:19 +00:00
|
|
|
stdenvNoCC.mkDerivation {
|
2023-02-06 20:49:02 +00:00
|
|
|
name = "hg-archive" + (lib.optionalString (name != null) "-${name}");
|
2007-09-04 12:45:00 +00:00
|
|
|
builder = ./builder.sh;
|
2018-01-09 20:36:14 +00:00
|
|
|
nativeBuildInputs = [mercurial];
|
2007-09-04 12:45:00 +00:00
|
|
|
|
2021-01-27 05:50:30 +00:00
|
|
|
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
2015-04-28 20:35:39 +00:00
|
|
|
|
2023-02-06 20:49:02 +00:00
|
|
|
subrepoClause = lib.optionalString fetchSubrepos "S";
|
2015-04-01 14:02:07 +00:00
|
|
|
|
2023-04-03 10:36:38 +00:00
|
|
|
outputHashAlgo = if hash != null then null else "sha256";
|
2007-09-04 12:45:00 +00:00
|
|
|
outputHashMode = "recursive";
|
2023-04-03 10:36:38 +00:00
|
|
|
outputHash = if hash != null then
|
|
|
|
hash
|
|
|
|
else if sha256 != null then
|
|
|
|
sha256
|
|
|
|
else
|
|
|
|
lib.fakeSha256;
|
2015-04-28 20:35:39 +00:00
|
|
|
|
2014-06-28 18:33:28 +00:00
|
|
|
inherit url rev;
|
2018-12-31 07:10:28 +00:00
|
|
|
inherit preferLocalBuild;
|
2007-09-04 12:45:00 +00:00
|
|
|
}
|