1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

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.
This commit is contained in:
Jörg Thalheim 2025-04-01 19:04:45 +02:00
parent c57e2486df
commit 0b61b758fb

View file

@ -65,39 +65,37 @@ scope: {
installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase; installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase;
}); });
libgit2 = pkgs.libgit2.overrideAttrs ( libgit2 =
attrs: if lib.versionAtLeast pkgs.libgit2.version "1.9.0" then
{ pkgs.libgit2
cmakeFlags = attrs.cmakeFlags or [ ] ++ [ "-DUSE_SSH=exec" ]; else
} pkgs.libgit2.overrideAttrs (attrs: {
# libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches # libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches
// lib.optionalAttrs (!lib.versionAtLeast pkgs.libgit2.version "1.9.0") { nativeBuildInputs =
nativeBuildInputs = attrs.nativeBuildInputs or [ ]
attrs.nativeBuildInputs or [ ] # gitMinimal does not build on Windows. See packbuilder patch.
# gitMinimal does not build on Windows. See packbuilder patch. ++ lib.optionals (!stdenv.hostPlatform.isWindows) [
++ lib.optionals (!stdenv.hostPlatform.isWindows) [ # Needed for `git apply`; see `prePatch`
# Needed for `git apply`; see `prePatch` pkgs.buildPackages.gitMinimal
pkgs.buildPackages.gitMinimal ];
]; # Only `git apply` can handle git binary patches
# Only `git apply` can handle git binary patches prePatch =
prePatch = attrs.prePatch or ""
attrs.prePatch or "" + lib.optionalString (!stdenv.hostPlatform.isWindows) ''
+ lib.optionalString (!stdenv.hostPlatform.isWindows) '' patch() {
patch() { git apply
git apply }
} '';
''; patches =
patches = attrs.patches or [ ]
attrs.patches or [ ] ++ [
++ [ ./patches/libgit2-mempack-thin-packfile.patch
./patches/libgit2-mempack-thin-packfile.patch ]
] # gitMinimal does not build on Windows, but fortunately this patch only
# gitMinimal does not build on Windows, but fortunately this patch only # impacts interruptibility
# impacts interruptibility ++ lib.optionals (!stdenv.hostPlatform.isWindows) [
++ lib.optionals (!stdenv.hostPlatform.isWindows) [ # binary patch; see `prePatch`
# binary patch; see `prePatch` ./patches/libgit2-packbuilder-callback-interruptible.patch
./patches/libgit2-packbuilder-callback-interruptible.patch ];
]; });
}
);
} }