{darwin.*,overrideSDK}: convert compatibility stubs to throws (#429387)

This commit is contained in:
Emily 2025-08-16 04:04:02 +01:00 committed by GitHub
commit 12b7281040
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 17 additions and 614 deletions

View File

@ -236,8 +236,8 @@ If your package is a compiler or language, and youre not sure, ask @NixOS/dar
You may see references to `darwin.apple_sdk.frameworks`.
This is the legacy SDK pattern, and it is being phased out.
All packages in `darwin.apple_sdk`, `darwin.apple_sdk_11_0`, and `darwin.apple_sdk_12_3` are stubs that do nothing.
If your derivation references them, you can delete them. The default SDK should be enough to build your package.
All packages in `darwin.apple_sdk`, `darwin.apple_sdk_11_0`, and `darwin.apple_sdk_12_3` have been removed.
If your derivation references them, you should delete those references, as the default SDK should be enough to build your package.
Note: the new SDK pattern uses the name `apple-sdk` to better align with Nixpkgs naming conventions.
The legacy SDK pattern uses `apple_sdk`.
@ -254,15 +254,14 @@ Some of them (such as Zig or `bindgen` for Rust) depend on it.
#### Updating legacy SDK overrides {#sec-darwin-legacy-frameworks-overrides}
The legacy SDK provided two ways of overriding the default SDK.
These are both being phased out along with the legacy SDKs.
They have been updated to set up the new SDK for you, but you should replace them with doing that directly.
They have been removed along with the legacy SDKs.
- `pkgs.darwin.apple_sdk_11_0.callPackage` - this pattern was used to provide frameworks from the macOS 11 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.
It added the `apple-sdk_12` package for `12.3` and did nothing for `11.0`.
If `darwinMinVersion` is specified, it would add `darwinMinVersionHook` with the specified minimum version.
No other SDK versions were supported.
### Darwin Cross-Compilation {#sec-darwin-legacy-cross-compilation}

View File

@ -1,272 +0,0 @@
# Compatibility stubs for packages that used the old SDK frameworks.
{
lib,
callPackage,
pkgs,
}:
let
mkStub = callPackage ../apple-sdk/mk-stub.nix { } "darwin.apple_sdk_11_0" "11.0";
in
lib.genAttrs [
"CLTools_Executables"
"IOKit"
"Libsystem"
"LibsystemCross"
"MacOSX-SDK"
"configd"
"darwin-stubs"
"libcharset"
"libcompression"
"libnetwork"
"libpm"
"libunwind"
"objc4"
"sdkRoot"
] mkStub
// {
frameworks = lib.genAttrs [
"AGL"
"AVFCapture"
"AVFCore"
"AVFoundation"
"AVKit"
"Accelerate"
"Accessibility"
"Accounts"
"AdServices"
"AdSupport"
"AddressBook"
"AddressBookCore"
"AppKit"
"AppTrackingTransparency"
"Apple80211"
"AppleScriptKit"
"AppleScriptObjC"
"ApplicationServices"
"AudioToolbox"
"AudioToolboxCore"
"AudioUnit"
"AudioVideoBridging"
"AuthenticationServices"
"AutomaticAssessmentConfiguration"
"Automator"
"BackgroundTasks"
"BusinessChat"
"CFNetwork"
"CalendarStore"
"CallKit"
"Carbon"
"ClassKit"
"CloudKit"
"Cocoa"
"Collaboration"
"ColorSync"
"Combine"
"Contacts"
"ContactsPersistence"
"ContactsUI"
"CoreAudio"
"CoreAudioKit"
"CoreAudioTypes"
"CoreBluetooth"
"CoreData"
"CoreDisplay"
"CoreFoundation"
"CoreGraphics"
"CoreHaptics"
"CoreImage"
"CoreLocation"
"CoreMIDI"
"CoreMIDIServer"
"CoreML"
"CoreMedia"
"CoreMediaIO"
"CoreMotion"
"CoreServices"
"CoreSpotlight"
"CoreSymbolication"
"CoreTelephony"
"CoreText"
"CoreVideo"
"CoreWLAN"
"CryptoKit"
"CryptoTokenKit"
"DVDPlayback"
"DebugSymbols"
"DeveloperToolsSupport"
"DeviceCheck"
"DirectoryService"
"DiscRecording"
"DiscRecordingUI"
"DiskArbitration"
"DisplayServices"
"DriverKit"
"EventKit"
"ExceptionHandling"
"ExecutionPolicy"
"ExternalAccessory"
"FWAUserLib"
"FileProvider"
"FileProviderUI"
"FinderSync"
"ForceFeedback"
"Foundation"
"GLKit"
"GLUT"
"GSS"
"GameCenterFoundation"
"GameCenterUI"
"GameCenterUICore"
"GameController"
"GameKit"
"GameplayKit"
"HIDDriverKit"
"Hypervisor"
"ICADevices"
"IMServicePlugIn"
"IOBluetooth"
"IOBluetoothUI"
"IOKit"
"IOSurface"
"IOUSBHost"
"IdentityLookup"
"ImageCaptureCore"
"ImageIO"
"InputMethodKit"
"InstallerPlugins"
"InstantMessage"
"Intents"
"JavaNativeFoundation"
"JavaRuntimeSupport"
"JavaScriptCore"
"JavaVM"
"Kerberos"
"Kernel"
"KernelManagement"
"LDAP"
"LatentSemanticMapping"
"LinkPresentation"
"LocalAuthentication"
"MLCompute"
"MapKit"
"MediaAccessibility"
"MediaLibrary"
"MediaPlayer"
"MediaRemote"
"MediaToolbox"
"Message"
"Metal"
"MetalKit"
"MetalPerformanceShaders"
"MetalPerformanceShadersGraph"
"MetricKit"
"ModelIO"
"MultipeerConnectivity"
"MultitouchSupport"
"NaturalLanguage"
"NearbyInteraction"
"NetFS"
"Network"
"NetworkExtension"
"NetworkingDriverKit"
"NotificationCenter"
"OSAKit"
"OSLog"
"OpenAL"
"OpenCL"
"OpenDirectory"
"OpenGL"
"PCIDriverKit"
"PCSC"
"PDFKit"
"ParavirtualizedGraphics"
"PassKit"
"PassKitCore"
"PencilKit"
"Photos"
"PhotosUI"
"PreferencePanes"
"PushKit"
"Python"
"QTKit"
"Quartz"
"QuartzCore"
"QuickLook"
"QuickLookThumbnailing"
"QuickTime"
"RealityKit"
"ReplayKit"
"Ruby"
"SafariServices"
"SceneKit"
"ScreenSaver"
"ScreenTime"
"ScriptingBridge"
"Security"
"SecurityFoundation"
"SecurityInterface"
"SensorKit"
"ServiceManagement"
"SignpostMetrics"
"SkyLight"
"Social"
"SoundAnalysis"
"Speech"
"SpriteKit"
"StoreKit"
"SwiftUI"
"SyncServices"
"System"
"SystemConfiguration"
"SystemExtensions"
"TWAIN"
"Tcl"
"Tk"
"UIFoundation"
"URLFormatting"
"USBDriverKit"
"UniformTypeIdentifiers"
"UserNotifications"
"UserNotificationsUI"
"VideoDecodeAcceleration"
"VideoSubscriberAccount"
"VideoToolbox"
"Virtualization"
"Vision"
"WebKit"
"WidgetKit"
"iTunesLibrary"
"vmnet"
] mkStub;
libs = lib.genAttrs [
"Xplugin"
"utmp"
"libDER"
"xpc"
"sandbox"
"simd"
] mkStub;
version = "11.0";
}
//
lib.genAttrs
[
"callPackage"
"stdenv"
"llvmPackages_12"
"llvmPackages_13"
"llvmPackages_14"
"llvmPackages_15"
"llvmPackages_16"
"rustPlatform"
"xcodebuild"
]
(
name:
lib.warn
"darwin.apple_sdk_11_0.${name}: deprecated and will be removed in Nixpkgs 25.11; see <https://nixos.org/manual/nixpkgs/stable/#sec-darwin> for documentation and migration instructions"
pkgs.${name}
)

View File

@ -1,261 +0,0 @@
# Compatibility stubs for packages that used the old SDK frameworks.
{
lib,
callPackage,
pkgs,
}:
let
mkStub = callPackage ../apple-sdk/mk-stub.nix { } "darwin.apple_sdk_12_3" "12.3";
in
lib.genAttrs [
"CLTools_Executables"
"Libsystem"
"LibsystemCross"
"darwin-stubs"
"libnetwork"
"libpm"
"libunwind"
"objc4"
"sdkRoot"
] mkStub
// {
frameworks = lib.genAttrs [
"AGL"
"AVFAudio"
"AVFCapture"
"AVFCore"
"AVFoundation"
"AVKit"
"Accelerate"
"Accessibility"
"Accounts"
"AdServices"
"AdSupport"
"AddressBook"
"AddressBookCore"
"AppKit"
"AppTrackingTransparency"
"AppleScriptKit"
"AppleScriptObjC"
"ApplicationServices"
"AudioToolbox"
"AudioToolboxCore"
"AudioUnit"
"AudioVideoBridging"
"AuthenticationServices"
"AutomaticAssessmentConfiguration"
"Automator"
"BackgroundTasks"
"BusinessChat"
"CFNetwork"
"CHIP"
"CalendarStore"
"CallKit"
"Carbon"
"ClassKit"
"CloudKit"
"Cocoa"
"Collaboration"
"ColorSync"
"Combine"
"Contacts"
"ContactsPersistence"
"ContactsUI"
"CoreAudio"
"CoreAudioKit"
"CoreAudioTypes"
"CoreBluetooth"
"CoreData"
"CoreDisplay"
"CoreFoundation"
"CoreGraphics"
"CoreHaptics"
"CoreImage"
"CoreLocation"
"CoreMIDI"
"CoreMIDIServer"
"CoreML"
"CoreMedia"
"CoreMediaIO"
"CoreMotion"
"CoreServices"
"CoreSpotlight"
"CoreSymbolication"
"CoreTelephony"
"CoreText"
"CoreVideo"
"CoreWLAN"
"CreateML"
"CryptoKit"
"CryptoTokenKit"
"DVDPlayback"
"DataDetection"
"DebugSymbols"
"DeveloperToolsSupport"
"DeviceActivity"
"DeviceCheck"
"DirectoryService"
"DiscRecording"
"DiscRecordingUI"
"DiskArbitration"
"DisplayServices"
"DriverKit"
"EventKit"
"ExceptionHandling"
"ExecutionPolicy"
"ExposureNotification"
"ExternalAccessory"
"FWAUserLib"
"FileProvider"
"FileProviderUI"
"FinderSync"
"ForceFeedback"
"Foundation"
"GLKit"
"GLUT"
"GSS"
"GameCenterFoundation"
"GameCenterUI"
"GameCenterUICore"
"GameController"
"GameKit"
"GameplayKit"
"GroupActivities"
"Hypervisor"
"ICADevices"
"IMServicePlugIn"
"IOBluetooth"
"IOBluetoothUI"
"IOKit"
"IOSurface"
"IOUSBHost"
"IdentityLookup"
"ImageCaptureCore"
"ImageIO"
"InputMethodKit"
"InstallerPlugins"
"InstantMessage"
"Intents"
"IntentsUI"
"JavaNativeFoundation"
"JavaRuntimeSupport"
"JavaScriptCore"
"JavaVM"
"Kerberos"
"Kernel"
"KernelManagement"
"LDAP"
"LatentSemanticMapping"
"LinkPresentation"
"LocalAuthentication"
"LocalAuthenticationEmbeddedUI"
"MLCompute"
"MailKit"
"ManagedSettings"
"MapKit"
"MediaAccessibility"
"MediaLibrary"
"MediaPlayer"
"MediaToolbox"
"Message"
"Metal"
"MetalKit"
"MetalPerformanceShaders"
"MetalPerformanceShadersGraph"
"MetricKit"
"ModelIO"
"MultipeerConnectivity"
"MultitouchSupport"
"MusicKit"
"NaturalLanguage"
"NearbyInteraction"
"NetFS"
"Network"
"NetworkExtension"
"NotificationCenter"
"OSAKit"
"OSLog"
"OpenAL"
"OpenCL"
"OpenDirectory"
"OpenGL"
"PCSC"
"PDFKit"
"PHASE"
"ParavirtualizedGraphics"
"PassKit"
"PassKitCore"
"PencilKit"
"Photos"
"PhotosUI"
"PreferencePanes"
"PushKit"
"QTKit"
"Quartz"
"QuartzCore"
"QuickLook"
"QuickLookThumbnailing"
"QuickLookUI"
"QuickTime"
"RealityFoundation"
"RealityKit"
"ReplayKit"
"Ruby"
"SafariServices"
"SceneKit"
"ScreenCaptureKit"
"ScreenSaver"
"ScreenTime"
"ScriptingBridge"
"Security"
"SecurityFoundation"
"SecurityInterface"
"SensorKit"
"ServiceManagement"
"ShazamKit"
"SignpostMetrics"
"SkyLight"
"Social"
"SoundAnalysis"
"Speech"
"SpriteKit"
"StoreKit"
"SwiftUI"
"SyncServices"
"System"
"SystemConfiguration"
"SystemExtensions"
"TWAIN"
"TabularData"
"Tcl"
"Tk"
"UIFoundation"
"URLFormatting"
"UniformTypeIdentifiers"
"UserNotifications"
"UserNotificationsUI"
"VideoDecodeAcceleration"
"VideoSubscriberAccount"
"VideoToolbox"
"Virtualization"
"Vision"
"WebKit"
"WidgetKit"
"iTunesLibrary"
"vmnet"
] mkStub;
libs = lib.genAttrs [
"Xplugin"
"utmp"
"libDER"
"xpc"
"sandbox"
"simd"
"utmp"
"xpc"
] mkStub;
version = "12.3";
}

View File

@ -1,18 +0,0 @@
{ lib, stdenvNoCC }:
prefix: version: pname:
lib.warnOnInstantiate
"${prefix}.${pname}: these stubs do nothing and will be removed in Nixpkgs 25.11; see <https://nixos.org/manual/nixpkgs/stable/#sec-darwin> for documentation and migration instructions."
(
stdenvNoCC.mkDerivation {
inherit pname version;
buildCommand = ''
mkdir -p "$out"
echo "Individual frameworks have been deprecated. See the stdenv documentation for how to use `apple-sdk`" \
> "$out/README"
'';
passthru.isDarwinCompatStub = true;
}
)

View File

@ -424,9 +424,6 @@ rec {
});
});
# `overrideSDK` is deprecated. Add the versioned variants of `apple-sdk` to `buildInputs` change the SDK.
overrideSDK = pkgs.callPackage ./darwin/override-sdk.nix { inherit lib extendMkDerivationArgs; };
withDefaultHardeningFlags =
defaultHardeningFlags: stdenv:
let

View File

@ -1,34 +0,0 @@
# This is a compatibility shim with `overrideSDK`.
# Note: `overrideSDK` is deprecated. It will be removed in 25.11.
{
lib,
stdenvNoCC,
extendMkDerivationArgs,
pkgsHostTarget,
}:
stdenv: sdkVersion:
let
darwinSdkVersion =
if lib.isAttrs sdkVersion then sdkVersion.darwinSdkVersion or "11.0" else sdkVersion;
in
assert lib.assertMsg (darwinSdkVersion == "11.0" || darwinSdkVersion == "12.3") ''
`overrideSDK` and `darwin.apple_sdk_11_0.callPackage` are deprecated.
Only the 11.0 and 12.3 SDKs are supported using them. Please use
the versioned `apple-sdk` variants to use other SDK versions.
See the stdenv documentation for how to use `apple-sdk`.
'';
assert lib.warn
"overrideSDK: this mechanism is deprecated and will be removed in 25.11, use `apple-sdk_*` or `darwinMinVersionHook` in build inputs instead; see <https://nixos.org/manual/nixpkgs/stable/#sec-darwin> for documentation"
true;
stdenv.override (old: {
mkDerivationFromStdenv = extendMkDerivationArgs old (args: {
buildInputs =
args.buildInputs or [ ]
++ lib.optional (darwinSdkVersion == "12.3") pkgsHostTarget.apple-sdk_12
++ lib.optional (sdkVersion ? darwinMinVersion) (
pkgsHostTarget.darwinMinVersionHook sdkVersion.darwinMinVersion
);
});
})

View File

@ -1544,6 +1544,7 @@ mapAliases {
oraclejdk11 = throw "All Oracle JDKs and JREs were dropped due to being unmaintained and heavily insecure. OpenJDK provides compatible replacements for JDKs and JREs."; # Added 2024-11-01
OSCAR = oscar; # Added 2024-06-12
osxfuse = throw "'osxfuse' has been renamed to/replaced by 'macfuse-stubs'"; # Converted to throw 2024-10-17
overrideSDK = "overrideSDK has been removed as it was a legacy compatibility stub; see <https://nixos.org/manual/nixpkgs/stable/#sec-darwin-legacy-frameworks-overrides> for migration instructions"; # Added 2025-08-04
ovn-lts = throw "ovn-lts has been removed. Please use the latest version available under ovn"; # Added 2024-08-24
oxygen-icons5 = throw ''
The top-level oxygen-icons5 alias has been removed.

View File

@ -45,13 +45,15 @@ let
n: alias: removeDistribute (removeRecurseForDerivations (checkInPkgs n alias))
);
# Old Darwin pattern stubs; remove these by 25.11.
# Old Darwin pattern stubs; converted to throws in 25.11.
mkStub = pkgs.callPackage ../os-specific/darwin/apple-sdk/mk-stub.nix { };
mkThrow =
name:
throw "darwin.${name} has been removed as it was a legacy compatibility stub; see <https://nixos.org/manual/nixpkgs/stable/#sec-darwin-legacy-frameworks> for migration instructions";
apple_sdk_11_0 = pkgs.callPackage ../os-specific/darwin/apple-sdk-11.0 { };
apple_sdk_11_0 = mkThrow "apple_sdk_11_0";
apple_sdk_12_3 = pkgs.callPackage ../os-specific/darwin/apple-sdk-12.3 { };
apple_sdk_12_3 = mkThrow "apple_sdk_12_3";
apple_sdk = apple_sdk_11_0;
@ -92,7 +94,7 @@ let
"objc4"
"ppp"
"xnu"
] (mkStub "darwin" "11.0");
] mkThrow;
in
stubs
@ -126,13 +128,9 @@ stubs
### L ###
libauto = throw "'darwin.libauto' has been removed, as it was broken and unmaintained"; # added 2024-05-10
libresolvHeaders = lib.warnOnInstantiate "darwin.libresolvHeaders: use `lib.getInclude darwin.libresolv`; this will be removed in 25.11" (
lib.getDev self.libresolv
); # added 2025-04-20
libresolvHeaders = throw "darwin.libresolvHeaders has been removed; use `lib.getInclude darwin.libresolv`"; # converted to throw 2025-07-29
libtapi = pkgs.libtapi; # 2024-08-16
libutilHeaders = lib.warnOnInstantiate "darwin.libutilHeaders: use `lib.getInclude darwin.libutil`; this will be removed in 25.11" (
lib.getDev self.libutil
); # added 2025-04-20
libutilHeaders = throw "darwin.libutilHeaders has been removed; use `lib.getInclude darwin.libutil`"; # converted to throw 2025-07-29
### M ###
@ -152,14 +150,7 @@ stubs
### S ###
stdenvNoCF =
lib.warnOnInstantiate
"darwin.stdenvNoCF: use `stdenv` or `stdenvNoCC`; this will be removed in 25.11"
(
pkgs.stdenv.override {
extraBuildInputs = [ ];
}
); # added 2025-04-20
stdenvNoCF = throw "darwin.stdenvNoCF has been removed; use `stdenv` or `stdenvNoCC`"; # converted to throw 2025-07-29
stubs = throw "'darwin.stubs.*' have been removed as they were unused"; # added 2025-04-20
swift-corelibs-foundation = throw "'darwin.swift-corelibs-foundation' has been removed, as it was broken and is no longer used"; # added 2025-04-20
})