From a838881cdacef7685b95f0c9088c6ed14228dc1f Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Sat, 18 Nov 2023 13:14:08 +0100 Subject: fetchgitlab: add option for sparse checkout --- pkgs/build-support/fetchgitlab/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pkgs/build-support/fetchgitlab') diff --git a/pkgs/build-support/fetchgitlab/default.nix b/pkgs/build-support/fetchgitlab/default.nix index 69361fcbdf818..33c19bd1cab93 100644 --- a/pkgs/build-support/fetchgitlab/default.nix +++ b/pkgs/build-support/fetchgitlab/default.nix @@ -5,6 +5,7 @@ lib.makeOverridable ( { owner, repo, rev, protocol ? "https", domain ? "gitlab.com", name ? "source", group ? null , fetchSubmodules ? false, leaveDotGit ? false , deepClone ? false +, sparseCheckout ? [] , ... # For hash agility } @ args: @@ -14,13 +15,13 @@ let escapedRev = lib.replaceStrings [ "+" "%" "/" ] [ "%2B" "%25" "%2F" ] rev; passthruAttrs = removeAttrs args [ "protocol" "domain" "owner" "group" "repo" "rev" "fetchSubmodules" "leaveDotGit" "deepClone" ]; - useFetchGit = fetchSubmodules || leaveDotGit || deepClone; + useFetchGit = fetchSubmodules || leaveDotGit || deepClone || (sparseCheckout != []); fetcher = if useFetchGit then fetchgit else fetchzip; gitRepoUrl = "${protocol}://${domain}/${slug}.git"; fetcherArgs = (if useFetchGit then { - inherit rev deepClone fetchSubmodules leaveDotGit; + inherit rev deepClone fetchSubmodules sparseCheckout leaveDotGit; url = gitRepoUrl; } else { url = "${protocol}://${domain}/api/v4/projects/${escapedSlug}/repository/archive.tar.gz?sha=${escapedRev}"; -- cgit 1.4.1