core/pkgs/build-support/fetch9front/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1 KiB
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{
fetchgit,
fetchzip,
lib,
}:
lib.makeOverridable (
{
owner,
repo,
rev,
domain ? "git.9front.org",
name ? "source",
leaveDotGit ? false,
deepClone ? false,
... # For hash agility
}@args:
let
passthruAttrs = removeAttrs args [
"domain"
"owner"
"repo"
"rev"
"leaveDotGit"
"deepClone"
];
useFetchGit = leaveDotGit || deepClone;
fetcher = if useFetchGit then fetchgit else fetchzip;
gitRepoUrl = "git://${domain}/${owner}/${repo}";
fetcherArgs =
(
if useFetchGit then
{
# git9 does not support shallow fetches
inherit rev leaveDotGit;
url = gitRepoUrl;
}
else
{
url = "https://${domain}/${owner}/${repo}/${rev}/snap.tar.gz";
passthru = {
inherit gitRepoUrl;
2024-06-30 08:16:52 +00:00
};
}
)
2024-05-02 00:46:19 +00:00
// passthruAttrs
2024-06-30 08:16:52 +00:00
// {
2024-05-02 00:46:19 +00:00
inherit name;
};
in
fetcher fetcherArgs // { inherit rev; }
)