treewide: Make some fetchers overridable

This commit is contained in:
piegames 2022-02-10 14:40:58 +01:00
parent 60d3ce948e
commit a205795c8a
11 changed files with 29 additions and 5 deletions

View File

@ -1,5 +1,6 @@
{ fetchzip }:
{ fetchzip, lib }:
lib.makeOverridable (
{ owner, repo, rev, name ? "source"
, ... # For hash agility
}@args: fetchzip ({
@ -7,3 +8,4 @@
url = "https://bitbucket.org/${owner}/${repo}/get/${rev}.tar.gz";
meta.homepage = "https://bitbucket.org/${owner}/${repo}/";
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; }
)

View File

@ -3,8 +3,9 @@
# tag="<tagname>" (get version by tag name)
# If you don't specify neither one date="NOW" will be used (get latest)
{stdenvNoCC, cvs, openssh}:
{stdenvNoCC, cvs, openssh, lib}:
lib.makeOverridable (
{cvsRoot, module, tag ? null, date ? null, sha256}:
stdenvNoCC.mkDerivation {
@ -18,3 +19,4 @@ stdenvNoCC.mkDerivation {
inherit cvsRoot module sha256 tag date;
}
)

View File

@ -1,5 +1,6 @@
{stdenvNoCC, darcs, cacert}:
{stdenvNoCC, darcs, cacert, lib}:
lib.makeOverridable (
{ url
, rev ? null
, context ? null
@ -21,3 +22,4 @@ stdenvNoCC.mkDerivation {
inherit url rev context name;
}
)

View File

@ -10,6 +10,7 @@
appendShort = lib.optionalString ((builtins.match "[a-f0-9]*" rev) != null) "-${short}";
in "${if matched == null then base else builtins.head matched}${appendShort}";
in
lib.makeOverridable (
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", hash ? "", leaveDotGit ? deepClone
, fetchSubmodules ? true, deepClone ? false
, branchName ? null
@ -107,3 +108,4 @@ stdenvNoCC.mkDerivation {
gitRepoUrl = url;
};
}
)

View File

@ -2,6 +2,8 @@
{ lib, fetchFromGitHub }:
lib.makeOverridable (
{ domain, ... }@args:
fetchFromGitHub ((removeAttrs args [ "domain" ]) // { githubBase = domain; })
)

View File

@ -1,5 +1,6 @@
{ lib, fetchgit, fetchzip }:
lib.makeOverridable (
{ owner, repo, rev, name ? "source"
, fetchSubmodules ? false, leaveDotGit ? null
, deepClone ? false, private ? false, forceFetchGit ? false
@ -60,3 +61,4 @@ let
in
fetcher fetcherArgs // { meta = newMeta; inherit rev owner repo; }
)

View File

@ -1,5 +1,6 @@
{ fetchzip, lib }:
lib.makeOverridable (
{ url, rev, name ? "source", ... } @ args:
fetchzip ({
@ -8,3 +9,4 @@ fetchzip ({
stripRoot = false;
meta.homepage = url;
} // removeAttrs args [ "url" "rev" ]) // { inherit rev; }
)

View File

@ -1,5 +1,6 @@
{ fetchgit, fetchzip, lib }:
lib.makeOverridable (
# gitlab example
{ owner, repo, rev, protocol ? "https", domain ? "gitlab.com", name ? "source", group ? null
, fetchSubmodules ? false, leaveDotGit ? false, deepClone ? false
@ -30,3 +31,4 @@ let
in
fetcher fetcherArgs // { meta.homepage = "${protocol}://${domain}/${slug}/"; inherit rev; }
)

View File

@ -1,4 +1,7 @@
{ runCommand, git }: src:
{ runCommand, git, lib }:
lib.makeOverridable (
src:
let
srcStr = toString src;
@ -38,3 +41,4 @@ let
'';
in nixPath
)

View File

@ -1,5 +1,6 @@
{ fetchzip }:
{ fetchzip, lib }:
lib.makeOverridable (
# cgit example, snapshot support is optional in cgit
{ repo, rev, name ? "source"
, ... # For hash agility
@ -8,3 +9,4 @@
url = "https://git.savannah.gnu.org/cgit/${repo}.git/snapshot/${repo}-${rev}.tar.gz";
meta.homepage = "https://git.savannah.gnu.org/cgit/${repo}.git/";
} // removeAttrs args [ "repo" "rev" ]) // { inherit rev; }
)

View File

@ -1,5 +1,6 @@
{ fetchgit, fetchhg, fetchzip, lib }:
lib.makeOverridable (
{ owner
, repo, rev
, domain ? "sr.ht"
@ -48,3 +49,4 @@ in cases.${fetcher}.fetch cases.${fetcher}.arguments // {
inherit rev;
meta.homepage = "${baseUrl}";
}
)