Merge pull request #158968: Make fetchFromGitHub & friends overridable
This commit is contained in:
commit
794b05a09d
11 changed files with 29 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
{ fetchzip }:
|
{ fetchzip, lib }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
{ owner, repo, rev, name ? "source"
|
{ owner, repo, rev, name ? "source"
|
||||||
, ... # For hash agility
|
, ... # For hash agility
|
||||||
}@args: fetchzip ({
|
}@args: fetchzip ({
|
||||||
|
@ -7,3 +8,4 @@
|
||||||
url = "https://bitbucket.org/${owner}/${repo}/get/${rev}.tar.gz";
|
url = "https://bitbucket.org/${owner}/${repo}/get/${rev}.tar.gz";
|
||||||
meta.homepage = "https://bitbucket.org/${owner}/${repo}/";
|
meta.homepage = "https://bitbucket.org/${owner}/${repo}/";
|
||||||
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; }
|
} // removeAttrs args [ "owner" "repo" "rev" ]) // { inherit rev; }
|
||||||
|
)
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
# tag="<tagname>" (get version by tag name)
|
# tag="<tagname>" (get version by tag name)
|
||||||
# If you don't specify neither one date="NOW" will be used (get latest)
|
# 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}:
|
{cvsRoot, module, tag ? null, date ? null, sha256}:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
|
@ -18,3 +19,4 @@ stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
inherit cvsRoot module sha256 tag date;
|
inherit cvsRoot module sha256 tag date;
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{stdenvNoCC, darcs, cacert}:
|
{stdenvNoCC, darcs, cacert, lib}:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
{ url
|
{ url
|
||||||
, rev ? null
|
, rev ? null
|
||||||
, context ? null
|
, context ? null
|
||||||
|
@ -21,3 +22,4 @@ stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
inherit url rev context name;
|
inherit url rev context name;
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
appendShort = lib.optionalString ((builtins.match "[a-f0-9]*" rev) != null) "-${short}";
|
appendShort = lib.optionalString ((builtins.match "[a-f0-9]*" rev) != null) "-${short}";
|
||||||
in "${if matched == null then base else builtins.head matched}${appendShort}";
|
in "${if matched == null then base else builtins.head matched}${appendShort}";
|
||||||
in
|
in
|
||||||
|
lib.makeOverridable (
|
||||||
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", hash ? "", leaveDotGit ? deepClone
|
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", hash ? "", leaveDotGit ? deepClone
|
||||||
, fetchSubmodules ? true, deepClone ? false
|
, fetchSubmodules ? true, deepClone ? false
|
||||||
, branchName ? null
|
, branchName ? null
|
||||||
|
@ -107,3 +108,4 @@ stdenvNoCC.mkDerivation {
|
||||||
gitRepoUrl = url;
|
gitRepoUrl = url;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
{ lib, fetchFromGitHub }:
|
{ lib, fetchFromGitHub }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
{ domain, ... }@args:
|
{ domain, ... }@args:
|
||||||
|
|
||||||
fetchFromGitHub ((removeAttrs args [ "domain" ]) // { githubBase = domain; })
|
fetchFromGitHub ((removeAttrs args [ "domain" ]) // { githubBase = domain; })
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ lib, fetchgit, fetchzip }:
|
{ lib, fetchgit, fetchzip }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
{ owner, repo, rev, name ? "source"
|
{ owner, repo, rev, name ? "source"
|
||||||
, fetchSubmodules ? false, leaveDotGit ? null
|
, fetchSubmodules ? false, leaveDotGit ? null
|
||||||
, deepClone ? false, private ? false, forceFetchGit ? false
|
, deepClone ? false, private ? false, forceFetchGit ? false
|
||||||
|
@ -60,3 +61,4 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
fetcher fetcherArgs // { meta = newMeta; inherit rev owner repo; }
|
fetcher fetcherArgs // { meta = newMeta; inherit rev owner repo; }
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ fetchzip, lib }:
|
{ fetchzip, lib }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
{ url, rev, name ? "source", ... } @ args:
|
{ url, rev, name ? "source", ... } @ args:
|
||||||
|
|
||||||
fetchzip ({
|
fetchzip ({
|
||||||
|
@ -8,3 +9,4 @@ fetchzip ({
|
||||||
stripRoot = false;
|
stripRoot = false;
|
||||||
meta.homepage = url;
|
meta.homepage = url;
|
||||||
} // removeAttrs args [ "url" "rev" ]) // { inherit rev; }
|
} // removeAttrs args [ "url" "rev" ]) // { inherit rev; }
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ fetchgit, fetchzip, lib }:
|
{ fetchgit, fetchzip, lib }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
# gitlab example
|
# gitlab example
|
||||||
{ owner, repo, rev, protocol ? "https", domain ? "gitlab.com", name ? "source", group ? null
|
{ owner, repo, rev, protocol ? "https", domain ? "gitlab.com", name ? "source", group ? null
|
||||||
, fetchSubmodules ? false, leaveDotGit ? false, deepClone ? false
|
, fetchSubmodules ? false, leaveDotGit ? false, deepClone ? false
|
||||||
|
@ -30,3 +31,4 @@ let
|
||||||
in
|
in
|
||||||
|
|
||||||
fetcher fetcherArgs // { meta.homepage = "${protocol}://${domain}/${slug}/"; inherit rev; }
|
fetcher fetcherArgs // { meta.homepage = "${protocol}://${domain}/${slug}/"; inherit rev; }
|
||||||
|
)
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
{ runCommand, git }: src:
|
{ runCommand, git, lib }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
|
src:
|
||||||
|
|
||||||
let
|
let
|
||||||
srcStr = toString src;
|
srcStr = toString src;
|
||||||
|
@ -38,3 +41,4 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in nixPath
|
in nixPath
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ fetchzip }:
|
{ fetchzip, lib }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
# cgit example, snapshot support is optional in cgit
|
# cgit example, snapshot support is optional in cgit
|
||||||
{ repo, rev, name ? "source"
|
{ repo, rev, name ? "source"
|
||||||
, ... # For hash agility
|
, ... # For hash agility
|
||||||
|
@ -8,3 +9,4 @@
|
||||||
url = "https://git.savannah.gnu.org/cgit/${repo}.git/snapshot/${repo}-${rev}.tar.gz";
|
url = "https://git.savannah.gnu.org/cgit/${repo}.git/snapshot/${repo}-${rev}.tar.gz";
|
||||||
meta.homepage = "https://git.savannah.gnu.org/cgit/${repo}.git/";
|
meta.homepage = "https://git.savannah.gnu.org/cgit/${repo}.git/";
|
||||||
} // removeAttrs args [ "repo" "rev" ]) // { inherit rev; }
|
} // removeAttrs args [ "repo" "rev" ]) // { inherit rev; }
|
||||||
|
)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ fetchgit, fetchhg, fetchzip, lib }:
|
{ fetchgit, fetchhg, fetchzip, lib }:
|
||||||
|
|
||||||
|
lib.makeOverridable (
|
||||||
{ owner
|
{ owner
|
||||||
, repo, rev
|
, repo, rev
|
||||||
, domain ? "sr.ht"
|
, domain ? "sr.ht"
|
||||||
|
@ -48,3 +49,4 @@ in cases.${fetcher}.fetch cases.${fetcher}.arguments // {
|
||||||
inherit rev;
|
inherit rev;
|
||||||
meta.homepage = "${baseUrl}";
|
meta.homepage = "${baseUrl}";
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue