fetchhg: format with nixfmt-rfc-style

This commit is contained in:
Yueh-Shun Li 2025-07-01 17:47:25 +08:00
parent ef2f8315bf
commit 34a5b1eb23

View File

@ -9,43 +9,41 @@ lib.extendMkDerivation {
extendDrvArgs = extendDrvArgs =
finalAttrs: finalAttrs:
{ {
name ? null, name ? null,
url, url,
rev ? null, rev ? null,
sha256 ? null, sha256 ? null,
hash ? null, hash ? null,
fetchSubrepos ? false, fetchSubrepos ? false,
preferLocalBuild ? true, preferLocalBuild ? true,
}: }:
# TODO: statically check if mercurial as the https support if the url starts with https. # TODO: statically check if mercurial as the https support if the url starts with https.
{ {
name = "hg-archive" + (lib.optionalString (name != null) "-${name}"); name = "hg-archive" + (lib.optionalString (name != null) "-${name}");
builder = ./builder.sh; builder = ./builder.sh;
nativeBuildInputs = [ mercurial ]; nativeBuildInputs = [ mercurial ];
impureEnvVars = lib.fetchers.proxyImpureEnvVars; impureEnvVars = lib.fetchers.proxyImpureEnvVars;
subrepoClause = lib.optionalString fetchSubrepos "S"; subrepoClause = lib.optionalString fetchSubrepos "S";
outputHashAlgo = if finalAttrs.hash != null && finalAttrs.hash != "" then null else "sha256"; outputHashAlgo = if finalAttrs.hash != null && finalAttrs.hash != "" then null else "sha256";
outputHashMode = "recursive"; outputHashMode = "recursive";
outputHash = outputHash =
lib.throwIf lib.throwIf (finalAttrs.hash != null && sha256 != null) "Only one of sha256 or hash can be set"
(finalAttrs.hash != null && sha256 != null) (
"Only one of sha256 or hash can be set" if finalAttrs.hash != null then
( finalAttrs.hash
if finalAttrs.hash != null then else if sha256 != null then
finalAttrs.hash sha256
else if sha256 != null then else
sha256 ""
else );
""
);
inherit url rev hash; inherit url rev hash;
inherit preferLocalBuild; inherit preferLocalBuild;
}; };
# No ellipsis # No ellipsis
inheritFunctionArgs = false; inheritFunctionArgs = false;