From c03bde0133be952436fded61ac99dea348246867 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 17 Feb 2025 17:17:37 +0100 Subject: [PATCH] Support libgit2 1.9.0 For when the overlay is used with nixos-unstable. 1.9.0 has our patches. (cherry picked from commit b0bbb1252a8ae8d925e2cb45d1c778b9c00587e2) --- packaging/dependencies.nix | 69 ++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index 535487089..7e90dbff2 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -102,7 +102,8 @@ let enableParallelBuilding = true; }; in -scope: { +scope: +{ inherit stdenv; aws-sdk-cpp = @@ -146,38 +147,6 @@ scope: { installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase; }); - libgit2 = pkgs.libgit2.overrideAttrs (attrs: { - src = inputs.libgit2; - version = inputs.libgit2.lastModifiedDate; - cmakeFlags = attrs.cmakeFlags or [ ] ++ [ "-DUSE_SSH=exec" ]; - 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 - ]; - }); - busybox-sandbox-shell = pkgs.busybox-sandbox-shell or (pkgs.busybox.override { useMusl = true; @@ -232,3 +201,37 @@ scope: { mesonLibraryLayer ]; } +# libgit2: Nixpkgs 24.11 has < 1.9.0 +// lib.optionalAttrs (!lib.versionAtLeast pkgs.libgit2.version "1.9.0") { + libgit2 = pkgs.libgit2.overrideAttrs (attrs: { + src = inputs.libgit2; + version = inputs.libgit2.lastModifiedDate; + cmakeFlags = attrs.cmakeFlags or [ ] ++ [ "-DUSE_SSH=exec" ]; + 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 + ]; + }); +}