about summary refs log tree commit diff
path: root/pkgs/build-support/fetchgithub
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2024-01-30 12:21:13 +0100
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2024-01-30 12:21:13 +0100
commita2fa54fa679ed498e9dfe1a152ce91a7c1e81911 (patch)
tree921986e6399e8feab33296a3a66834b54aa602f9 /pkgs/build-support/fetchgithub
parenteb39a068567c3264db3730576a6ade30602c1ded (diff)
fetchFromGitHub: fix compatibility issue with nix-prefetch
Diffstat (limited to 'pkgs/build-support/fetchgithub')
-rw-r--r--pkgs/build-support/fetchgithub/default.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix
index 37f7dcfa3006a..4ce3c6e84d768 100644
--- a/pkgs/build-support/fetchgithub/default.nix
+++ b/pkgs/build-support/fetchgithub/default.nix
@@ -28,7 +28,11 @@ let
   useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || (sparseCheckout != []);
   # We prefer fetchzip in cases we don't need submodules as the hash
   # is more stable in that case.
-  fetcher = if useFetchGit then fetchgit else fetchzip.override { withUnzip = false; };
+  fetcher =
+    if useFetchGit then fetchgit
+    # fetchzip may not be overridable when using external tools, for example nix-prefetch
+    else if fetchzip ? override then fetchzip.override { withUnzip = false; }
+    else fetchzip;
   privateAttrs = lib.optionalAttrs private {
     netrcPhase = ''
       if [ -z "''$${varBase}USERNAME" -o -z "''$${varBase}PASSWORD" ]; then