Skip to content

Commit 7597cc7

Browse files
authored
Fix darwin builds for nixpkgs 24.11 (#2323)
Fixes error: use of undeclared identifier 'IP_RECVTOS' for whatever reason nixpkgs 24.11 defines x86_64-darwin to be sdk-10.12.2, and aarch64-darwin to be sdk-11. nixpkgs 25.05 will drop sdk-10.12, and unify aarch64 and x86 at last.
1 parent 8bed466 commit 7597cc7

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

ci.nix

+5-4
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,17 @@
5858
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
5959
# Update supported-ghc-versions.md to reflect any changes made here.
6060
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2411") {
61-
# TODO perhaps these
62-
# ghc96 = false;
63-
# ghc98 = false;
61+
ghc96 = false;
62+
ghc98 = false;
63+
ghc910 = false;
64+
ghc912 = true;
6465
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
6566
ghc96 = true;
6667
ghc98 = true;
6768
ghc98llvm = false;
6869
ghc910 = true;
6970
ghc910llvm = true;
70-
ghc9121 = true;
71+
ghc912 = true;
7172
ghc912X = true;
7273
ghc913 = true;
7374
})));

modules/configuration-nix.nix

+22-13
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# package sets out of this repo. Ideally, this file is only used for
44
# fixing things that are broken due to the Nix infrastructure.
55

6-
{ pkgs, config, ... }:
6+
{ pkgs, lib, config, ... }:
77
let
88
fromUntil = from: until: patch: { version }:
99
if builtins.compareVersions version from >= 0
@@ -35,9 +35,9 @@ in addPackageKeys {
3535
# These packages have `license: LGPL` in their .cabal file, but
3636
# do not specify the version. Setting the version here on
3737
# examination of the license files included in the packages.
38-
packages.hscolour.package.license = pkgs.lib.mkForce "LGPL-2.1-only";
39-
packages.cpphs.package.license = pkgs.lib.mkForce "LGPL-2.1-only";
40-
packages.polyparse.package.license = pkgs.lib.mkForce "LGPL-2.1-only";
38+
packages.hscolour.package.license = lib.mkForce "LGPL-2.1-only";
39+
packages.cpphs.package.license = lib.mkForce "LGPL-2.1-only";
40+
packages.polyparse.package.license = lib.mkForce "LGPL-2.1-only";
4141

4242
# These two patches are needed by GHCJS
4343
packages.Cabal.patches = [
@@ -63,14 +63,14 @@ in addPackageKeys {
6363
#
6464
# We now expose genprimopcode and deriveConstants from ghc directly (this is not in line with
6565
# with upstream ghc) to be able to re-build lib:ghc.
66-
packages.ghc.components.library.build-tools = pkgs.lib.mkForce (
67-
pkgs.lib.optionals (__compareVersions config.hsPkgs.ghc.identifier.version "9.4.1" > 0) [
66+
packages.ghc.components.library.build-tools = lib.mkForce (
67+
lib.optionals (__compareVersions config.hsPkgs.ghc.identifier.version "9.4.1" > 0) [
6868
(config.hsPkgs.buildPackages.alex.components.exes.alex or pkgs.buildPackages.alex)
6969
(config.hsPkgs.buildPackages.happy.components.exes.happy or pkgs.buildPackages.happy)
7070
]);
7171

7272
# Remove dependency on hsc2hs (hsc2hs should be in ghc derivation)
73-
packages.mintty.components.library.build-tools = pkgs.lib.mkForce [];
73+
packages.mintty.components.library.build-tools = lib.mkForce [];
7474

7575
packages.ghc-lib-parser.patches = [
7676
(fromUntil "8.10.0.0" "9.2" ../overlays/patches/ghc-lib-parser-8.10-global-unique-counters-in-rts.patch)
@@ -86,7 +86,7 @@ in addPackageKeys {
8686

8787
# See https://github.com/input-output-hk/haskell.nix/issues/1455
8888
# This is a work around to make `ghcide` and `haskell-language-server` build with the unboxed tuple patch.
89-
packages.ghcide = pkgs.lib.mkIf (__elem config.compiler.nix-name [
89+
packages.ghcide = lib.mkIf (__elem config.compiler.nix-name [
9090
# Work out if we have applied the unboxed tupple patch in overlays/bootstrap.nix
9191
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc8107" "ghc810420210212"
9292
]) {
@@ -97,7 +97,7 @@ in addPackageKeys {
9797
(fromUntil "2.2.0.0" "2.3.0.0" ../patches/ghcide-2.2-unboxed-tuple-fix-issue-1455.patch)
9898
]
9999
# This is needed for a patch only applied to ghc810420210212
100-
++ pkgs.lib.optional (__elem config.compiler.nix-name [
100+
++ lib.optional (__elem config.compiler.nix-name [
101101
"ghc810420210212"
102102
]) (from "1.7.0.0" ../patches/ghcide-1.7-plutus-ghc.patch);
103103
flags = {
@@ -119,9 +119,9 @@ in addPackageKeys {
119119
(fromUntil "0.9.1" "0.9.2" ../patches/languge-c-int128.patch)
120120
];
121121

122-
packages.discount.components.library.libs = pkgs.lib.mkForce [ pkgs.discount ];
122+
packages.discount.components.library.libs = lib.mkForce [ pkgs.discount ];
123123

124-
packages.llvm-hs.components.library.build-tools = pkgs.lib.mkForce [
124+
packages.llvm-hs.components.library.build-tools = lib.mkForce [
125125
(fromUntil "5.0.0" "6" pkgs.llvmPackages_5.llvm)
126126
(fromUntil "6.0.0" "7" pkgs.llvmPackages_6.llvm)
127127
(fromUntil "7.0.0" "8" pkgs.llvmPackages_7.llvm)
@@ -185,13 +185,22 @@ in addPackageKeys {
185185
# https://gitlab.haskell.org/ghc/ghc/-/issues/23392
186186
# Using -j1 works around the issue.
187187
packages.gi-gtk.components.library.ghcOptions =
188-
pkgs.lib.optional (
188+
lib.optional (
189189
builtins.compareVersions config.compiler.version "9.6.1" >= 0
190190
&& builtins.compareVersions config.compiler.version "9.9" < 0) "-j1";
191191

192192
# With recent versions of nixpkgs fortify causes musl version of the
193193
# text package to fail with:
194194
# error: inlining failed in call to ‘always_inline’ ‘void* memcpy(void*, const void*, size_t)’: target specific option mismatch
195195
packages.text.components.library.hardeningDisable =
196-
pkgs.lib.optionals pkgs.stdenv.hostPlatform.isMusl ["fortify"];
196+
lib.optionals pkgs.stdenv.hostPlatform.isMusl ["fortify"];
197+
198+
# error: use of undeclared identifier 'IP_RECVTOS'
199+
# for whatever reason nixpkgs 24.11 defines x86_64-darwin
200+
# to be sdk-10.12.2, and aarch64-darwin to be sdk-11.
201+
# nixpkgs 25.05 will drop sdk-10.12, and unify aarch64 and x86 at last.
202+
packages.network.components.library.libs = lib.mkIf (pkgs.stdenv.hostPlatform.isDarwin && lib.versionOlder pkgs.apple-sdk.version "11") [
203+
pkgs.apple-sdk_11
204+
(pkgs.darwinMinVersionHook "11.0")
205+
];
197206
}

0 commit comments

Comments
 (0)