Skip to content

Commit 33e638d

Browse files
authored
Merge pull request #12863 from Mic92/libgit2
libgit2: use upstream version if possible
2 parents ff328e1 + d91310b commit 33e638d

File tree

2 files changed

+34
-55
lines changed

2 files changed

+34
-55
lines changed

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
{
172172
otherSplices = final.generateSplicesForMkScope "nixDependencies";
173173
f = import ./packaging/dependencies.nix {
174-
inherit inputs stdenv;
174+
inherit stdenv;
175175
pkgs = final;
176176
};
177177
};

packaging/dependencies.nix

Lines changed: 33 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,14 @@
11
# These overrides are applied to the dependencies of the Nix components.
22

33
{
4-
# Flake inputs; used for sources
5-
inputs,
6-
74
# The raw Nixpkgs, not affected by this scope
85
pkgs,
96

107
stdenv,
118
}:
129

13-
let
14-
prevStdenv = stdenv;
15-
in
16-
1710
let
1811
inherit (pkgs) lib;
19-
20-
stdenv = if prevStdenv.isDarwin && prevStdenv.isx86_64 then darwinStdenv else prevStdenv;
21-
22-
# Fix the following error with the default x86_64-darwin SDK:
23-
#
24-
# error: aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on macOS 10.13 or newer
25-
#
26-
# Despite the use of the 10.13 deployment target here, the aligned
27-
# allocation function Clang uses with this setting actually works
28-
# all the way back to 10.6.
29-
darwinStdenv = pkgs.overrideSDK prevStdenv { darwinMinVersion = "10.13"; };
30-
3112
in
3213
scope: {
3314
inherit stdenv;
@@ -65,39 +46,37 @@ scope: {
6546
installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase;
6647
});
6748

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-
);
49+
libgit2 =
50+
if lib.versionAtLeast pkgs.libgit2.version "1.9.0" then
51+
pkgs.libgit2
52+
else
53+
pkgs.libgit2.overrideAttrs (attrs: {
54+
# libgit2: Nixpkgs 24.11 has < 1.9.0, which needs our patches
55+
nativeBuildInputs =
56+
attrs.nativeBuildInputs or [ ]
57+
# gitMinimal does not build on Windows. See packbuilder patch.
58+
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
59+
# Needed for `git apply`; see `prePatch`
60+
pkgs.buildPackages.gitMinimal
61+
];
62+
# Only `git apply` can handle git binary patches
63+
prePatch =
64+
attrs.prePatch or ""
65+
+ lib.optionalString (!stdenv.hostPlatform.isWindows) ''
66+
patch() {
67+
git apply
68+
}
69+
'';
70+
patches =
71+
attrs.patches or [ ]
72+
++ [
73+
./patches/libgit2-mempack-thin-packfile.patch
74+
]
75+
# gitMinimal does not build on Windows, but fortunately this patch only
76+
# impacts interruptibility
77+
++ lib.optionals (!stdenv.hostPlatform.isWindows) [
78+
# binary patch; see `prePatch`
79+
./patches/libgit2-packbuilder-callback-interruptible.patch
80+
];
81+
});
10382
}

0 commit comments

Comments
 (0)