fetchgithub: support fetchLFS

This commit is contained in:
sohalt 2023-10-13 20:33:18 +02:00
parent 3e4235b74f
commit b60d3f6270

View File

@ -4,6 +4,7 @@ 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
, fetchLFS ? false
, sparseCheckout ? [] , sparseCheckout ? []
, githubBase ? "github.com", varPrefix ? null , githubBase ? "github.com", varPrefix ? null
, meta ? { } , meta ? { }
@ -25,7 +26,7 @@ let
}; };
passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ]; passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ];
varBase = "NIX${lib.optionalString (varPrefix != null) "_${varPrefix}"}_GITHUB_PRIVATE_"; varBase = "NIX${lib.optionalString (varPrefix != null) "_${varPrefix}"}_GITHUB_PRIVATE_";
useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || (sparseCheckout != []); useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || fetchLFS || (sparseCheckout != []);
# We prefer fetchzip in cases we don't need submodules as the hash # We prefer fetchzip in cases we don't need submodules as the hash
# is more stable in that case. # is more stable in that case.
fetcher = fetcher =
@ -52,7 +53,7 @@ let
fetcherArgs = (if useFetchGit fetcherArgs = (if useFetchGit
then { then {
inherit rev deepClone fetchSubmodules sparseCheckout; url = gitRepoUrl; inherit rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl;
} // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; } } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; }
else { else {
url = "${baseUrl}/archive/${rev}.tar.gz"; url = "${baseUrl}/archive/${rev}.tar.gz";