about summary refs log tree commit diff
path: root/pkgs/build-support/fetchgitlab
diff options
context:
space:
mode:
authorNicolas Benes <nbenes.gh@xandea.de>2023-11-18 13:14:08 +0100
committerNicolas Benes <nbenes.gh@xandea.de>2023-11-18 13:14:08 +0100
commita838881cdacef7685b95f0c9088c6ed14228dc1f (patch)
tree7b861e1f22bb829f0e2d42465fc9e58d970aac36 /pkgs/build-support/fetchgitlab
parent9375cf20083c296b6db94f8534b3372c21f0cb69 (diff)
fetchgitlab: add option for sparse checkout
Diffstat (limited to 'pkgs/build-support/fetchgitlab')
-rw-r--r--pkgs/build-support/fetchgitlab/default.nix5
1 files changed, 3 insertions, 2 deletions
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}";