From f1cb0e6ddbb8c52b8b80657ff5e84ca44d1cf6d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 1 Apr 2025 19:04:45 +0200 Subject: [PATCH] libgit2: use upstream version if possible we don't seem to use libgit2 for fetching via ssh, hence it shouldn't matter if it's using libssh or the ssh binary. (cherry picked from commit 0b61b758fb6c26f0cd3052ccbd442247c0bbb86d) --- packaging/dependencies.nix | 68 ++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index 535b3ff37..0af670bfb 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -65,39 +65,37 @@ scope: { installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase; }); - libgit2 = pkgs.libgit2.overrideAttrs ( - attrs: - { - cmakeFlags = attrs.cmakeFlags or [ ] ++ [ "-DUSE_SSH=exec" ]; - } - # libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches - // lib.optionalAttrs (!lib.versionAtLeast pkgs.libgit2.version "1.9.0") { - nativeBuildInputs = - attrs.nativeBuildInputs or [ ] - # gitMinimal does not build on Windows. See packbuilder patch. - ++ lib.optionals (!stdenv.hostPlatform.isWindows) [ - # Needed for `git apply`; see `prePatch` - pkgs.buildPackages.gitMinimal - ]; - # Only `git apply` can handle git binary patches - prePatch = - attrs.prePatch or "" - + lib.optionalString (!stdenv.hostPlatform.isWindows) '' - patch() { - git apply - } - ''; - patches = - attrs.patches or [ ] - ++ [ - ./patches/libgit2-mempack-thin-packfile.patch - ] - # gitMinimal does not build on Windows, but fortunately this patch only - # impacts interruptibility - ++ lib.optionals (!stdenv.hostPlatform.isWindows) [ - # binary patch; see `prePatch` - ./patches/libgit2-packbuilder-callback-interruptible.patch - ]; - } - ); + libgit2 = + if lib.versionAtLeast pkgs.libgit2.version "1.9.0" then + pkgs.libgit2 + else + pkgs.libgit2.overrideAttrs (attrs: { + # libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches + nativeBuildInputs = + attrs.nativeBuildInputs or [ ] + # gitMinimal does not build on Windows. See packbuilder patch. + ++ lib.optionals (!stdenv.hostPlatform.isWindows) [ + # Needed for `git apply`; see `prePatch` + pkgs.buildPackages.gitMinimal + ]; + # Only `git apply` can handle git binary patches + prePatch = + attrs.prePatch or "" + + lib.optionalString (!stdenv.hostPlatform.isWindows) '' + patch() { + git apply + } + ''; + patches = + attrs.patches or [ ] + ++ [ + ./patches/libgit2-mempack-thin-packfile.patch + ] + # gitMinimal does not build on Windows, but fortunately this patch only + # impacts interruptibility + ++ lib.optionals (!stdenv.hostPlatform.isWindows) [ + # binary patch; see `prePatch` + ./patches/libgit2-packbuilder-callback-interruptible.patch + ]; + }); }