2 sdkVersions = builtins.fromJSON (builtins.readFile ./metadata/versions.json);
11 # Specifies the major version used for the SDK. Uses `hostPlatform.darwinSdkVersion` by default.
12 darwinSdkMajorVersion ? lib.versions.major stdenv.hostPlatform.darwinSdkVersion,
14 # Enabling bootstrap disables propagation. Defaults to `false` (meaning to propagate certain packages and `xcrun`)
15 # except in stage0 of the Darwin stdenv bootstrap.
16 enableBootstrap ? stdenv.name == "bootstrap-stage0-stdenv-darwin",
18 # Required by various phases
25 sdkVersions.${darwinSdkMajorVersion}
26 or (lib.throw "Unsupported SDK major version: ${darwinSdkMajorVersion}");
27 sdkVersion = sdkInfo.version;
29 fetchSDK = callPackage ./common/fetch-sdk.nix { };
31 phases = lib.composeManyExtensions (
33 (callPackage ./common/add-core-symbolication.nix { })
34 (callPackage ./common/derivation-options.nix { })
35 (callPackage ./common/passthru-private-frameworks.nix { inherit sdkVersion; })
36 (callPackage ./common/passthru-source-release-files.nix { inherit sdkVersion; })
37 (callPackage ./common/remove-disallowed-packages.nix { })
39 # Only process stubs and convert them to tbd-v4 if jq is available. This can be made unconditional once
40 # the bootstrap tools have jq and libtapi.
41 ++ lib.optional (jq != null) (callPackage ./common/process-stubs.nix { })
42 # Avoid infinite recursions by not propagating certain packages, so they can themselves build with the SDK.
43 ++ lib.optionals (!enableBootstrap) [
44 (callPackage ./common/propagate-inputs.nix { })
45 (callPackage ./common/propagate-xcrun.nix { })
47 # This has to happen last.
49 (callPackage ./common/run-build-phase-hooks.nix { })
53 stdenvNoCC.mkDerivation (
54 lib.extends phases (finalAttrs: {
56 inherit (sdkInfo) version;
58 src = fetchSDK sdkInfo;
65 # `role.bash` is copied from `../build-support/setup-hooks/role.bash` due to the requirements not to reference
66 # paths outside the package when it is in `by-name`. It needs to be kept in sync, but it fortunately does not
67 # change often. Once `build-support` is available as a package (or some other mechanism), it should be changed
68 # to whatever that replacement is.
69 ./setup-hooks/role.bash
71 src = ./setup-hooks/sdk-hook.sh;
75 (lib.escapeShellArgs (lib.splitVersion sdkVersion))
82 sdkName = "MacOSX${lib.versions.majorMinor sdkVersion}.sdk";
83 sdkMajor = lib.versions.major sdkVersion;
90 cp -rd . "$sdkpath/${sdkName}"
91 ln -s "${sdkName}" "$sdkpath/MacOSX${sdkMajor}.sdk"
92 ln -s "${sdkName}" "$sdkpath/MacOSX.sdk"
98 sdkroot = finalAttrs.finalPackage + "/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk";
101 __structuredAttrs = true;
104 description = "Frameworks and libraries required for building packages on Darwin";
105 homepage = "https://developer.apple.com";
106 maintainers = lib.teams.darwin.members;
107 platforms = lib.platforms.darwin;
108 badPlatforms = [ lib.systems.inspect.patterns.is32bit ];