Unverified Commit 12b72810 authored by Emily's avatar Emily Committed by GitHub
Browse files

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

parents 487c3a81 2e3fd465
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -236,8 +236,8 @@ If your package is a compiler or language, and you’re 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}

+0 −272
Original line number Diff line number Diff line
# 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}
    )
+0 −261
Original line number Diff line number Diff line
# 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";
}
+0 −18
Original line number Diff line number Diff line
{ 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;
    }
  )
+0 −3
Original line number Diff line number Diff line
@@ -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
Loading