2024-05-02 00:46:19 +00:00
|
|
|
{ fetchgit, fetchzip, lib }:
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
lib.makeOverridable ({ owner, repo, rev, domain ? "git.9front.org"
|
|
|
|
, name ? "source", leaveDotGit ? false, deepClone ? false
|
2024-05-02 00:46:19 +00:00
|
|
|
, ... # For hash agility
|
2024-05-13 21:24:10 +00:00
|
|
|
}@args:
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
let
|
2024-05-13 21:24:10 +00:00
|
|
|
passthruAttrs = removeAttrs args [
|
|
|
|
"domain"
|
|
|
|
"owner"
|
|
|
|
"repo"
|
|
|
|
"rev"
|
|
|
|
"leaveDotGit"
|
|
|
|
"deepClone"
|
|
|
|
];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
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";
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
passthru = { inherit gitRepoUrl; };
|
|
|
|
}) // passthruAttrs // {
|
|
|
|
inherit name;
|
|
|
|
};
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
in fetcher fetcherArgs // { inherit rev; })
|