Skip to content

Commit 0b61b75

Browse files
committed
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.
1 parent c57e248 commit 0b61b75

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

packaging/dependencies.nix

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -65,39 +65,37 @@ scope: {
6565
installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase;
6666
});
6767

68-
libgit2 = pkgs.libgit2.overrideAttrs (
69-
attrs:
70-
{
71-
cmakeFlags = attrs.cmakeFlags or [ ] ++ [ "-DUSE_SSH=exec" ];
72-
}
73-
# libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches
74-
// lib.optionalAttrs (!lib.versionAtLeast pkgs.libgit2.version "1.9.0") {
75-
nativeBuildInputs =
76-
attrs.nativeBuildInputs or [ ]
77-
# gitMinimal does not build on Windows. See packbuilder patch.
78-
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
79-
# Needed for `git apply`; see `prePatch`
80-
pkgs.buildPackages.gitMinimal
81-
];
82-
# Only `git apply` can handle git binary patches
83-
prePatch =
84-
attrs.prePatch or ""
85-
+ lib.optionalString (!stdenv.hostPlatform.isWindows) ''
86-
patch() {
87-
git apply
88-
}
89-
'';
90-
patches =
91-
attrs.patches or [ ]
92-
++ [
93-
./patches/libgit2-mempack-thin-packfile.patch
94-
]
95-
# gitMinimal does not build on Windows, but fortunately this patch only
96-
# impacts interruptibility
97-
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
98-
# binary patch; see `prePatch`
99-
./patches/libgit2-packbuilder-callback-interruptible.patch
100-
];
101-
}
102-
);
68+
libgit2 =
69+
if lib.versionAtLeast pkgs.libgit2.version "1.9.0" then
70+
pkgs.libgit2
71+
else
72+
pkgs.libgit2.overrideAttrs (attrs: {
73+
# libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches
74+
nativeBuildInputs =
75+
attrs.nativeBuildInputs or [ ]
76+
# gitMinimal does not build on Windows. See packbuilder patch.
77+
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
78+
# Needed for `git apply`; see `prePatch`
79+
pkgs.buildPackages.gitMinimal
80+
];
81+
# Only `git apply` can handle git binary patches
82+
prePatch =
83+
attrs.prePatch or ""
84+
+ lib.optionalString (!stdenv.hostPlatform.isWindows) ''
85+
patch() {
86+
git apply
87+
}
88+
'';
89+
patches =
90+
attrs.patches or [ ]
91+
++ [
92+
./patches/libgit2-mempack-thin-packfile.patch
93+
]
94+
# gitMinimal does not build on Windows, but fortunately this patch only
95+
# impacts interruptibility
96+
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
97+
# binary patch; see `prePatch`
98+
./patches/libgit2-packbuilder-callback-interruptible.patch
99+
];
100+
});
103101
}

0 commit comments

Comments
 (0)