From 4af479b298c2b4bbaa924fc39469ebab512548a3 Mon Sep 17 00:00:00 2001 From: toonn Date: Fri, 8 Jul 2022 13:07:11 +0200 Subject: [PATCH] go_1_18: Use apple_sdk_11_0.callPackage Go 1.18 requires a newer SDK than the one we build from sources. As a workaround we're making use of the SDK we're using for aarch64-darwin. This means Go 1.18 will not work on any Darwin systems that don't have forwards-compatible SDK versions with the particular package in question. We might need to mark Go packages broken based on the macOS version rather than just the platform and architecture. Until we find a better solution, Go packages will need to make sure to get all their (Darwin) system dependencies from the `apple_sdk_11_0`, this includes dependencies of build tools like `xcbuild`. For convenience `darwin.apple_sdk_11_0` has a `callPackage` attribute which provides the correct `stdenv` and `xcbuild` attributes as arguments. This function can be expanded to substitute other necessary arguments when they come up. (cherry picked from commit 00336e25bd4dc552208bda65da776b72b4b10fd0) --- pkgs/top-level/all-packages.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e14ad9b107656..871d739c08418 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13200,8 +13200,9 @@ with pkgs; buildPackages = buildPackages // { stdenv = buildPackages.gcc8Stdenv; }; }); - go_1_18 = callPackage ../development/compilers/go/1.18.nix { - inherit (darwin.apple_sdk.frameworks) Security Foundation; + # go 1.18 requires a newer Apple SDK to be build. See commit message for more details. + go_1_18 = darwin.apple_sdk_11_0.callPackage ../development/compilers/go/1.18.nix { + inherit (darwin.apple_sdk_11_0.frameworks) Security Foundation; }; go = go_1_17; @@ -21484,7 +21485,9 @@ with pkgs; buildGo117Package = callPackage ../development/go-packages/generic { go = buildPackages.go_1_17; }; - buildGo118Package = callPackage ../development/go-packages/generic { + + # go 1.18 requires a newer Apple SDK to be build. See commit message for more details. + buildGo118Package = darwin.apple_sdk_11_0.callPackage ../development/go-packages/generic { go = buildPackages.go_1_18; }; @@ -21493,7 +21496,9 @@ with pkgs; buildGo117Module = callPackage ../development/go-modules/generic { go = buildPackages.go_1_17; }; - buildGo118Module = callPackage ../development/go-modules/generic { + + # go 1.18 requires a newer Apple SDK to be build. See commit message for more details. + buildGo118Module = darwin.apple_sdk_11_0.callPackage ../development/go-modules/generic { go = buildPackages.go_1_18; };