Luke Granger-Brown
57725ef3ec
git-subtree-dir: third_party/nixpkgs git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
36 lines
854 B
Nix
36 lines
854 B
Nix
{ 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;
|
|
};
|
|
}) // passthruAttrs // { inherit name; };
|
|
in
|
|
|
|
fetcher fetcherArgs // { inherit rev; }
|
|
)
|