Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darwin: set the minimum version to macOS 11.3; nixos/doc/rl-2505: announce macOS version support policy #352129

Draft
wants to merge 35 commits into
base: staging
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5ed37b6
nixos/doc/rl-2505: announce macOS version support policy
emilazy Oct 5, 2024
0a86d73
darwin: set the minimum version to macOS 11.3
emilazy Oct 5, 2024
d346167
libsForQt5.qtbase: remove code for macOS < 11
emilazy Oct 12, 2024
4e11936
gtk4: remove code for macOS < 11
emilazy Oct 26, 2024
b86c003
haskellPackages.network: remove code for macOS < 11
emilazy Oct 12, 2024
d7540c1
apple-sdk_{10_12,10_13,10_14,10_15}: drop
emilazy Oct 5, 2024
353387a
darwin.apple_sdk_10_12: drop
emilazy Oct 26, 2024
f8e4d5c
apple-sdk: remove code for old SDKs
emilazy Oct 5, 2024
968f861
stdenv/darwin: remove code for old SDKs
emilazy Oct 5, 2024
6f17051
llvmPackages.compiler-rt: remove code for macOS < 11
emilazy Oct 5, 2024
fcd8325
llvmPackages.lldb: remove code for macOS < 11
emilazy Oct 5, 2024
4a9cc2f
llvmPackages.libcxx: remove code for macOS < 11
emilazy Oct 5, 2024
37abb59
ld64: remove code for macOS < 11
emilazy Oct 5, 2024
5f95ebc
ld64: use the SDK source release packages
emilazy Oct 26, 2024
41eea33
cctools: remove code for macOS < 11
emilazy Oct 5, 2024
4aae795
gcc: remove code for macOS < 11
emilazy Oct 5, 2024
4a665a3
python3: remove code for macOS < 11
emilazy Oct 5, 2024
587a846
darwin.IOKitTools: remove code for macOS < 11
emilazy Oct 5, 2024
62080bd
darwin.adv_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
3ab059e
darwin.copyfile: remove code for macOS < 11
emilazy Oct 5, 2024
d3a4f2d
darwin.diskdev_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
0c1628c
darwin.file_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
9a0b35a
darwin.libpcap: remove code for macOS < 11
emilazy Oct 5, 2024
5358daf
darwin.libresolv: remove code for macOS < 11
emilazy Oct 5, 2024
916a048
darwin.mail_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
895ec03
darwin.network_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
51a18f3
darwin.patch_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
8a72b8e
darwin.removefile: remove code for macOS < 11
emilazy Oct 5, 2024
eb5f2ae
darwin.shell_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
8de7047
darwin.system_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
6cc2721
darwin.text_cmds: remove code for macOS < 11
emilazy Oct 5, 2024
3a09724
darwin.top: remove code for macOS < 11
emilazy Oct 5, 2024
0920de4
nixVersions.{nix_2_24,git}: remove code for macOS < 11
emilazy Oct 5, 2024
9c05c28
memstream{,Hook}: drop
emilazy Oct 5, 2024
5c5c7d4
memorymapping{,Hook}: drop
emilazy Oct 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 29 additions & 35 deletions doc/stdenv/platform-notes.chapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Some common issues when packaging software for Darwin:
}
```

- Multiple SDKs are available for use in nixpkgs. Each platform has a default SDK (10.12.2 for x86_64-darwin and 11.3 for aarch64-darwin), which is available as the `apple-sdk` package.
- Multiple SDKs are available for use in nixpkgs. The default `apple-sdk` package matches the minimum supported macOS version, and is included implicitly in the standard environment.

The SDK provides the necessary headers and text-based stubs to link common frameworks and libraries (such as libSystem, which is effectively Darwin’s libc). Projects will sometimes indicate which SDK to use by the Xcode version. As a rule of thumb, subtract one from the Xcode version to get the available SDK in nixpkgs.

Expand All @@ -84,29 +84,24 @@ Some common issues when packaging software for Darwin:
stdenv.mkDerivation {
name = "libfoo-1.2.3";
# ...
env.PACKAGE_SPECIFIC_SDK_VAR = apple-sdk_10_15.sdkroot;
env.PACKAGE_SPECIFIC_SDK_VAR = apple-sdk_12.sdkroot;
# or
buildInputs = [ apple-sdk_10_15 ];
buildInputs = [ apple-sdk_12 ];
postPatch = ''
export PACKAGE_SPECIFIC_SDK_VAR=$SDKROOT
'';
}
```

The following is a list of Xcode versions, the SDK version in nixpkgs, and the attribute to use to add it. Generally, only the last SDK release for a major version is packaged (each _x_ in 10._x_ until 10.15 is considered a major version).

| Xcode version | SDK version | nixpkgs attribute |
|--------------------|---------------------------------------------------|-------------------|
| Varies by platform | 10.12.2 (x86_64-darwin)<br/>11.3 (aarch64-darwin) | `apple-sdk` |
Copy link
Contributor

@viraptor viraptor Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the entry for the bare apple-sdk be in this table, just to be clear what does it do after the change?
(I know it's described above that it matches the lowest supported, but it may be worth repeating it in the relevant row)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve added the apple-sdk reference to the same table entry as apple-sdk_11 now that it’s not platform-specific; let me know what you think!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect ❤️

| 8.0–8.3.3 | 10.12.2 | `apple-sdk_10_12` |
| 9.0–9.4.1 | 10.13.2 | `apple-sdk_10_13` |
| 10.0–10.3 | 10.14.6 | `apple-sdk_10_14` |
| 11.0–11.7 | 10.15.6 | `apple-sdk_10_15` |
| 12.0–12.5.1 | 11.3 | `apple-sdk_11` |
| 13.0–13.4.1 | 12.3 | `apple-sdk_12` |
| 14.0–14.3.1 | 13.3 | `apple-sdk_13` |
| 15.0–15.4 | 14.4 | `apple-sdk_14` |
| 16.0 | 15.0 | `apple-sdk_15` |
The following is a list of Xcode versions, the SDK version in nixpkgs, and the attribute to use to add it. Generally, only the last SDK release for a major version is packaged.

| Xcode version | SDK version | nixpkgs attribute |
|--------------------|-------------|------------------------------|
| 12.0–12.5.1 | 11.3 | `apple-sdk_11` / `apple-sdk` |
| 13.0–13.4.1 | 12.3 | `apple-sdk_12` |
| 14.0–14.3.1 | 13.3 | `apple-sdk_13` |
| 15.0–15.4 | 14.4 | `apple-sdk_14` |
| 16.0 | 15.0 | `apple-sdk_15` |

To use a non-default SDK, add it to your build inputs.

Expand All @@ -122,14 +117,14 @@ Some common issues when packaging software for Darwin:

```nix
stdenv.mkDerivation {
name = "libfoo-1.2.3"; # Upstream specifies that it needs Xcode 12 to build, so use the 11.3 SDK.
name = "libfoo-1.2.3"; # Upstream specifies that it needs Xcode 14 to build, so use the 12.3 SDK.
# ...
buildInputs = [ apple-sdk_11 ];
nativeBuildInputs = [ swift ]; # Propagates the 13.3 SDK, so the 13.3 SDK package will be used instead of the 11.3 SDK.
buildInputs = [ apple-sdk_12 ];
nativeBuildInputs = [ swift ]; # Propagates the 13.3 SDK, so the 13.3 SDK package will be used instead of the 12.3 SDK.
}
```

- When a package indicates a minimum supported version, also called the deployment target, you can set it in your derivation using `darwinMinVersionHook`. If you need to set a minimum version higher than the default SDK, you should also add the corresponding SDK to your `buildInputs`.
- When a package indicates a minimum supported version, also called the deployment target, you can set it in your derivation using `darwinMinVersionHook`, which sets the relevant `MACOSX_DEPLOYMENT_TARGET` variable. If you need to set a minimum version higher than the default SDK, you should also add the corresponding SDK to your `buildInputs`.

The deployment target controls how Darwin handles availability and access to some APIs. In most cases, if a deployment target is newer than the first availability of an API, that API will be linked directly. Otherwise, the API will be weakly linked and checked at runtime.

Expand All @@ -144,16 +139,16 @@ Some common issues when packaging software for Darwin:

```nix
stdenv.mkDerivation {
name = "libfoo-1.2.3"; # Upstream specifies the minimum supported version as 10.15.
buildInputs = [ qt6.qtbase (darwinMinVersionHook "10.15") ];
name = "libfoo-1.2.3"; # Upstream specifies the minimum supported version as 11.7.
buildInputs = [ qt6.qtbase (darwinMinVersionHook "11.7") ];
}
# Qt 6 specifies a minimum version of 12.0, so the minimum version resolves to 12.0.
```


- You should rely on the default SDK when possible. If a package specifies a required SDK version, use that version (e.g., libuv requires 11.0, so it should use `apple-sdk_11`). When a package supports multiple SDKs, determine which SDK package to use based on the following rules of thumb:
- You should rely on the default SDK when possible. If a package specifies a required SDK version, use that version (e.g., Qt requires the macOS 14 or 15 SDK, so it should use `apple-sdk_15`). When a package supports multiple SDKs, determine which SDK package to use based on the following rules of thumb:

- If a package supports multiple SDK versions, use the lowest supported SDK version by the package (but no lower than the default SDK). That ensures maximal platform compatibility for the package.
- If a package supports multiple SDK versions, consider using the lowest supported SDK version by the package (but no lower than the default SDK). That ensures maximal platform compatibility for the package.

- If a package specifies a range of supported SDK versions _and_ a minimum supported version, assume the package is using availability checks to support the indicated minimum version. Add the highest supported SDK and a `darwinMinVersionHook` set to the minimum version supported by the upstream package.

Expand All @@ -163,7 +158,7 @@ Some common issues when packaging software for Darwin:
stdenv.mkDerivation {
name = "foo-1.2.3";
# ...
buildInputs = [ apple-sdk_15 (darwinMinVersionHook "10.15") ]; # Upstream builds with the 15.0 SDK but supports 10.15.
buildInputs = [ apple-sdk_15 (darwinMinVersionHook "12.0") ]; # Upstream builds with the 15.0 SDK but supports 12.0.
}
```

Expand All @@ -173,20 +168,20 @@ Some common issues when packaging software for Darwin:
stdenv.mkDerivation {
name = "libfoo-1.2.3";
# ...
buildInputs = [ apple-sdk_15 ]; # Upstream builds with the 15.0 SDK but supports 10.15.
propagatedBuildInputs = [ apple-sdk_10_15 (darwinMinVersionHook "10.15") ];
buildInputs = [ apple-sdk_15 ]; # Upstream builds with the 15.0 SDK but supports 12.0.
propagatedBuildInputs = [ apple-sdk_12 (darwinMinVersionHook "12.0") ];
}
# ...
stdenv.mkDerivation {
name = "bar-1.2.3";
# ...
buildInputs = [ libfoo ]; # Builds with the 10.15 SDK
buildInputs = [ libfoo ]; # Builds with the 12.3 SDK
}
# ...
stdenv.mkDerivation {
name = "baz-1.2.3";
# ...
buildInputs = [ apple-sdk_12 libfoo ]; # Builds with the 12.3 SDK
buildInputs = [ apple-sdk_13 libfoo ]; # Builds with the 13.3 SDK
}
```

Expand All @@ -211,8 +206,8 @@ Some common issues when packaging software for Darwin:

- There are two legacy patterns that are being phased out. These patterns were used in the past to change the SDK version. They have been reimplemented to use the `apple-sdk` packages.

- `pkgs.darwin.apple_sdk_11_0.callPackage` - this pattern was used to provide frameworks from the 11.0 SDK. It now adds the `apple-sdk_11` package to your derivation’s build inputs.
- `overrideSDK` - this stdenv adapter would try to replace the frameworks used by your derivation and its transitive dependencies. It now adds the `apple-sdk_11` package for `11.0` or the `apple-sdk_12` package for `12.3`. If `darwinMinVersion` is specified, it will add `darwinMinVersionHook` with the specified minimum version. No other SDK versions are supported.
- `darwin.apple_sdk_11_0.callPackage` - this pattern was used to provide frameworks from the 11.0 SDK. It is now the same as `callPackage`.
- `overrideSDK` - this stdenv adapter would try to replace the frameworks used by your derivation and its transitive dependencies. It now adds the `apple-sdk_12` package for `12.3` and does nothing for `11.0`. If `darwinMinVersion` is specified, it will add `darwinMinVersionHook` with the specified minimum version. No other SDK versions are supported.

- Darwin supports cross-compilation between Darwin platforms. Cross-compilation from Linux is not currently supported but may be supported in the future. To cross-compile to Darwin, you can set `crossSystem` or use one of the Darwin systems in `pkgsCross`. The `darwinMinVersionHook` and the SDKs support cross-compilation. If you need to specify a different SDK version for a `depsBuildBuild` compiler, add it to your `nativeBuildInputs`.

Expand All @@ -237,7 +232,6 @@ Some common issues when packaging software for Darwin:

In static compilation situations, it is possible for the build and host platform to be the same platform but have different SDKs with the same version (one dynamic and one static). cc-wrapper takes care of handling this distinction.

- The current default versions of the deployment target (minimum version) and SDK are indicated by Darwin-specific attributes on the platform. Because of the ways that minimum version and SDK can be changed that are not visible to Nix, they should be treated as lower bounds. If you need to parameterize over a specific version, create a function that takes the version as a parameter instead of relying on these attributes.
- The current default version of the SDK and deployment target (minimum version) are indicated by the Darwin-specific platform attributes `darwinSdkVersion` and `darwinMinVersion`. Because of the ways that minimum version and SDK can be changed that are not visible to Nix, they should be treated as lower bounds. If you need to parameterize over a specific version, create a function that takes the version as a parameter instead of relying on these attributes.

- `darwinMinVersion` defaults to 10.12 on x86_64-darwin and 11.0 on aarch64-darwin. It sets the default `MACOSX_DEPLOYMENT_TARGET`.
- `darwinSdkVersion` defaults to 10.12 on x86-64-darwin and 11.0 on aarch64-darwin. Only the major version determines the SDK version, resulting in the 10.12.2 and 11.3 SDKs being used on these platforms respectively.
On macOS, the `darwinMinVersion` and `darwinSdkVersion` are always the same, and are currently set to 11.3.
2 changes: 1 addition & 1 deletion lib/systems/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ let
else null;
# The canonical name for this attribute is darwinSdkVersion, but some
# platforms define the old name "sdkVer".
darwinSdkVersion = final.sdkVer or (if final.isAarch64 then "11.0" else "10.12");
darwinSdkVersion = final.sdkVer or "11.3";
darwinMinVersion = final.darwinSdkVersion;
darwinMinVersionVariable =
if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET"
Expand Down
25 changes: 25 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Release 25.05 (“????????”, 2025.05/??) {#sec-release-25.05}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

## Highlights {#sec-release-25.05-highlights}

- **This release of Nixpkgs requires macOS Big Sur 11.3 or newer, as announced in the 24.11 release notes.**
We cannot guarantee that packages will continue to work on older versions of macOS.
Future Nixpkgs releases will only support [macOS versions supported by Apple](https://endoflife.date/macos); this means that **Nixpkgs 25.11 will require macOS Sonoma 14 or newer**.
Users on old macOS versions should consider upgrading to a supported version (potentially using [OpenCore Legacy Patcher](https://dortania.github.io/OpenCore-Legacy-Patcher/) for old hardware) or installing NixOS.
If neither of those options are viable and you require new versions of software, [MacPorts](https://www.macports.org/) supports versions back to Mac OS X Snow Leopard 10.6.

## New Services {#sec-release-25.05-new-services}

- Create the first release note entry in this section!

## Backward Incompatibilities {#sec-release-25.05-incompatibilities}

- Create the first release note entry in this section!

## Other Notable Changes {#sec-release-25.05-notable-changes}

- Create the first release note entry in this section!

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
3 changes: 0 additions & 3 deletions pkgs/applications/science/physics/crystfel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
, gtk3
, gdk-pixbuf
, argp-standalone
, memorymappingHook
, withGui ? true
, withBitshuffle ? true
}:
Expand Down Expand Up @@ -211,8 +210,6 @@ stdenv.mkDerivation rec {
] ++ lib.optionals withGui [ gtk3 gdk-pixbuf ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
argp-standalone
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isAarch64) [
memorymappingHook
]
++ lib.optionals withBitshuffle [ hdf5-external-filter-plugins ];

Expand Down
4 changes: 0 additions & 4 deletions pkgs/by-name/ap/apple-sdk/common/fetch-sdk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ fetchurl {
mv "$downloadedFile" "$renamed"
pbzx "$renamed" | cpio -idm

# SDKs are inconsistent about whether MacOSX.sdk or MacOSX<version>.sdk is a symlink.
src=Library/Developer/CommandLineTools/SDKs/MacOSX${lib.versions.majorMinor version}.sdk
if [ ! -d $src ]; then
src=Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
fi

# Remove unwanted binaries, man pages, and folders from the SDK.
rm -rf $src/usr/bin $src/usr/share $src/System/Library/Perl
Expand Down
1 change: 0 additions & 1 deletion pkgs/by-name/ap/apple-sdk/common/process-stubs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ self: super: {
+ ''
echo "Removing the following dylibs from the libSystem reexported libraries list: ${lib.escapeShellArg (lib.concatStringsSep ", " removedDylibs)}"
for libSystem in libSystem.B.tbd libSystem.B_asan.tbd; do
test ! -e usr/lib/$libSystem && continue # TODO: remove once the minimum SDK is 10.14 or newer.
tapi stubify --filetype=tbd-v5 usr/lib/$libSystem -o usr/lib/$libSystem # tbd-v5 is a JSON-based format.
jq --argjson libs ${lib.escapeShellArg (builtins.toJSON removedDylibs)} '
if .libraries then
Expand Down
18 changes: 0 additions & 18 deletions pkgs/by-name/ap/apple-sdk/common/rewrite-sdk-paths.nix

This file was deleted.

Loading