|
1 | 1 | # These overrides are applied to the dependencies of the Nix components. |
2 | 2 |
|
3 | 3 | { |
4 | | - # Flake inputs; used for sources |
5 | | - inputs, |
6 | | - |
7 | 4 | # The raw Nixpkgs, not affected by this scope |
8 | 5 | pkgs, |
9 | 6 |
|
10 | 7 | stdenv, |
11 | 8 | }: |
12 | 9 |
|
13 | | -let |
14 | | - prevStdenv = stdenv; |
15 | | -in |
16 | | - |
17 | 10 | let |
18 | 11 | 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 | | - |
31 | 12 | in |
32 | 13 | scope: { |
33 | 14 | inherit stdenv; |
@@ -65,39 +46,37 @@ scope: { |
65 | 46 | installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase; |
66 | 47 | }); |
67 | 48 |
|
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 | + }); |
103 | 82 | } |
0 commit comments