From 7e557e7ad14c72ba241705a52bd9507180b9a7ab Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Fri, 22 May 2026 00:33:15 -0400 Subject: [PATCH] fetchFromGitHub: only override fetchzip once Funny bug - we were running a .override on fetchzip on every single call to fetchFromGitHub. --- pkgs/build-support/fetchgithub/default.nix | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index 288a10b95a4b..e12052e3d15d 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -3,7 +3,7 @@ repoRevToNameMaybe, fetchgit, fetchzip, -}: +}@args: let # Here defines fetchFromGitHub arguments that determines useFetchGit, # The attribute value is their default values. @@ -37,6 +37,10 @@ let adjustFunctionArgs = f: lib.setFunctionArgs f (faUseFetchGit // lib.functionArgs f); decorate = f: lib.makeOverridable (adjustFunctionArgs f); + + # fetchzip may not be overridable when using external tools, for example nix-prefetch + fetchzip = + if args.fetchzip ? override then args.fetchzip.override { withUnzip = false; } else args.fetchzip; in decorate ( { @@ -105,14 +109,7 @@ decorate ( varBase = "NIX${lib.optionalString (varPrefix != null) "_${varPrefix}"}_GITHUB_PRIVATE_"; # We prefer fetchzip in cases we don't need submodules as the hash # is more stable in that case. - 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; + fetcher = if useFetchGit then fetchgit else fetchzip; privateAttrs = lib.optionalAttrs private { netrcPhase = # When using private repos: