diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_Executables.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_Executables.nix new file mode 100644 index 0000000000000..f3ff413d0cae3 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_Executables.nix @@ -0,0 +1,27 @@ +{ + stdenvNoCC, + fetchurl, + cpio, + pbzx, + version, +}: + +let + releases = builtins.fromJSON (builtins.readFile ./apple-sdk-releases.json); +in +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "CLTools_Executables"; + inherit version; + + src = fetchurl releases.${version}.${finalAttrs.pname}; + + nativeBuildInputs = [ + cpio + pbzx + ]; + + buildCommand = '' + pbzx $src | cpio -idm + mv Library/Developer/CommandLineTools $out + ''; +}) diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix new file mode 100644 index 0000000000000..7af2c48cc0819 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/CLTools_macOSNMOS_SDK.nix @@ -0,0 +1,28 @@ +{ + lib, + stdenvNoCC, + fetchurl, + cpio, + pbzx, + version, +}: + +let + releases = builtins.fromJSON (builtins.readFile ./apple-sdk-releases.json); +in +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "CLTools_macOSNMOS_SDK"; + inherit version; + + src = fetchurl releases.${version}.${finalAttrs.pname}; + + nativeBuildInputs = [ + cpio + pbzx + ]; + + buildCommand = '' + pbzx $src | cpio -idm + mv Library/Developer/CommandLineTools/SDKs/MacOSX${lib.versions.majorMinor version}.sdk $out + ''; +}) diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/apple-sdk-releases.json b/pkgs/os-specific/darwin/apple-sdk-12.3/apple-sdk-releases.json new file mode 100644 index 0000000000000..87e01f0039ce2 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/apple-sdk-releases.json @@ -0,0 +1,20 @@ +{ + "12.3": { + "CLTools_Executables": { + "hash": "sha256-XlxHwCq+rtBF3Yyfdob3UEHN7YKzb7JF84lRmZbB/50=", + "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_Executables.pkg" + }, + "CLTools_macOSLMOS_SDK": { + "hash": "sha256-mY9YTlyTujV6R89WaNmkJrfOQatXnoSW8gKxnawQz5Q=", + "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOSLMOS_SDK.pkg" + }, + "CLTools_macOSNMOS_SDK": { + "hash": "sha256-Tr9VCeCP5udmh09U/zPQG2c4ky1LXscBwPfgpRy8uds=", + "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOSNMOS_SDK.pkg" + }, + "CLTools_macOS_SDK": { + "hash": "sha256-2xwYLfiYuEdck7/8NY3iqiPKvoG9HAjXt8Ewyp9c0Es=", + "url": "https://swcdn.apple.com/content/downloads/24/42/002-83793-A_74JRE8GVAT/rlnkct919wgc5c0pjq986z5bb9h62uvni2/CLTools_macOS_SDK.pkg" + } + } +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/default.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/default.nix new file mode 100644 index 0000000000000..85444ec95e614 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/default.nix @@ -0,0 +1,49 @@ +{ + lib, + newScope, + overrideCC, + pkgs, + stdenv, + stdenvNoCC, +}: + +let + version = "12.3"; + + MacOSX-SDK = callPackage ./CLTools_macOSNMOS_SDK.nix { inherit version; }; + callPackage = newScope (pkgs.darwin // packages); + + packages = { + # Make sure we pass our special `callPackage` instead of using packages.callPackage which + # does not have necessary attributes in scope. + frameworks = callPackage ./frameworks { inherit callPackage; }; + libs = callPackage ./libs { inherit callPackage; }; + + CLTools_Executables = callPackage ./CLTools_Executables.nix { inherit version; }; + Libsystem = callPackage ./libSystem.nix { }; + LibsystemCross = callPackage ./libSystem.nix { }; + libunwind = callPackage ./libunwind.nix { }; + libnetwork = callPackage ./libnetwork.nix { }; + libpm = callPackage ./libpm.nix { }; + # Avoid introducing a new objc4 if stdenv already has one, to prevent + # conflicting LLVM modules. + objc4 = stdenv.objc4 or (callPackage ./libobjc.nix { }); + + darwin-stubs = stdenvNoCC.mkDerivation { + pname = "darwin-stubs"; + inherit (MacOSX-SDK) version; + + preferLocalBuild = true; + allowSubstitutes = false; + + buildCommand = '' + mkdir -p "$out" + ln -s ${MacOSX-SDK}/System "$out/System" + ln -s ${MacOSX-SDK}/usr "$out/usr" + ''; + }; + + sdkRoot = pkgs.callPackage ../apple-sdk/sdkRoot.nix { sdkVersion = version; }; + }; +in +packages diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/default.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/default.nix new file mode 100644 index 0000000000000..113633c556313 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/default.nix @@ -0,0 +1,146 @@ +{ + lib, + stdenvNoCC, + buildPackages, + # macOS things + callPackage, + darwin-stubs, +}: + +let + inherit (darwin-stubs) version; + fixup-frameworks = callPackage ./fixups.nix { }; + private-frameworks = callPackage ./private.nix { }; + public-frameworks = callPackage ./public.nix { }; + + mkDepsRewrites = + deps: + let + mergeRewrites = x: y: { + prefix = lib.mergeAttrs (x.prefix or { }) (y.prefix or { }); + const = lib.mergeAttrs (x.const or { }) (y.const or { }); + }; + + rewriteArgs = + { + prefix ? { }, + const ? { }, + }: + lib.concatLists ( + (lib.mapAttrsToList (from: to: [ + "-p" + "${from}:${to}" + ]) prefix) + ++ (lib.mapAttrsToList (from: to: [ + "-c" + "${from}:${to}" + ]) const) + ); + + rewrites = + depList: + lib.fold mergeRewrites { } ( + map (dep: dep.tbdRewrites) (lib.filter (dep: dep ? tbdRewrites) depList) + ); + in + lib.escapeShellArgs (rewriteArgs (rewrites (lib.attrValues deps))); + + mkFramework = + { + name, + deps, + private ? false, + }: + let + standardFrameworkPath = + name: private: + "/System/Library/${lib.optionalString private "Private"}Frameworks/${name}.framework"; + + self = stdenvNoCC.mkDerivation { + pname = "apple-${lib.optionalString private "private-"}framework-${name}"; + inherit (darwin-stubs) version; + + # because we copy files from the system + preferLocalBuild = true; + + dontUnpack = true; + dontBuild = true; + + disallowedRequisites = [ darwin-stubs ]; + + nativeBuildInputs = [ buildPackages.darwin.rewrite-tbd ]; + + installPhase = '' + mkdir -p $out/Library/Frameworks + + cp -r ${darwin-stubs}${standardFrameworkPath name private} $out/Library/Frameworks + + if [[ -d ${darwin-stubs}/usr/lib/swift/${name}.swiftmodule ]]; then + mkdir -p $out/lib/swift + cp -r -t $out/lib/swift \ + ${darwin-stubs}/usr/lib/swift/${name}.swiftmodule \ + ${darwin-stubs}/usr/lib/swift/libswift${name}.tbd + fi + + # Fix and check tbd re-export references + chmod u+w -R $out + find $out -name '*.tbd' -type f | while IFS=$'\n' read tbd; do + echo "Fixing re-exports in $tbd" + rewrite-tbd \ + -p ${standardFrameworkPath name private}/:$out/Library/Frameworks/${name}.framework/ \ + -p /usr/lib/swift/:$out/lib/swift/ \ + ${mkDepsRewrites deps} \ + -r ${builtins.storeDir} \ + "$tbd" + done + ''; + + propagatedBuildInputs = lib.attrValues deps; + + passthru.tbdRewrites.prefix."${standardFrameworkPath name private}/" = "${self}/Library/Frameworks/${name}.framework/"; + + meta = with lib; { + description = "Apple SDK framework ${name}"; + maintainers = with maintainers; [ ]; + platforms = platforms.darwin; + }; + }; + in + self; + + # Helper functions for creating framework derivations. + framework = + name: deps: + mkFramework { + inherit name deps; + private = false; + }; + + # Helper functions for creating private framework derivations. + privateFramework = + name: deps: + mkFramework { + inherit name deps; + private = true; + }; + + # Merge addToFrameworks into public-frameworks and remove elements of removeFromFrameworks. + deps = + let + inherit (fixup-frameworks) addToFrameworks removeFromFrameworks; + fixupDeps = + name: deps: + lib.pipe deps [ + # Add dependencies from addToFrameworks. + (deps: lib.recursiveUpdate deps (addToFrameworks.${name} or { })) + # Keep dependencies not in removeFromFrameworks. + (lib.filterAttrs (depName: _: !(removeFromFrameworks.${name}.${depName} or false))) + ]; + in + lib.mapAttrs fixupDeps public-frameworks; + + # Create derivations and add private frameworks. + bareFrameworks = + (lib.mapAttrs framework deps) // (lib.mapAttrs privateFramework private-frameworks); +in +bareFrameworks // fixup-frameworks.overrideFrameworks bareFrameworks diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/fixups.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/fixups.nix new file mode 100644 index 0000000000000..f8b08c1e7222d --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/fixups.nix @@ -0,0 +1,160 @@ +{ + lib, + # macOS things + frameworks, + libnetwork, + libs, + darwin-stubs, + objc4, +}: + +{ + # Used to add dependencies which are not picked up by gen-frameworks.py. + # Some of these are simply private frameworks the generator does not see. + # Trial and error, building things and adding dependencies when they fail. + addToFrameworks = + let + inherit (libs) libDER; + libobjc = objc4; + in + with frameworks; + { + # Below this comment are entries migrated from before the generator was + # added. If, for a given framework, you are able to reverify the extra + # deps are really necessary on top of the generator deps, move it above + # this comment (and maybe document your findings). + AVFoundation = { + inherit ApplicationServices AVFCapture AVFCore; + }; + Accelerate = { + inherit CoreWLAN IOBluetooth; + }; + AddressBook = { + inherit AddressBookCore ContactsPersistence libobjc; + }; + AppKit = { + inherit AudioToolbox AudioUnit UIFoundation; + }; + AudioToolbox = { + inherit AudioToolboxCore; + }; + AudioUnit = { + inherit Carbon CoreAudio; + }; + Carbon = { + inherit IOKit QuartzCore libobjc; + }; + CoreAudio = { + inherit IOKit; + }; + CoreFoundation = { + inherit libobjc; + }; + CoreGraphics = { + inherit SystemConfiguration; + }; + CoreMIDIServer = { + inherit CoreMIDI; + }; + CoreMedia = { + inherit ApplicationServices AudioToolbox AudioUnit; + }; + CoreServices = { + inherit CoreAudio NetFS ServiceManagement; + }; + CoreWLAN = { + inherit SecurityFoundation; + }; + DiscRecording = { + inherit IOKit libobjc; + }; + Foundation = { + inherit SystemConfiguration libobjc; + }; + GameKit = { + inherit + GameCenterFoundation + GameCenterUI + GameCenterUICore + ReplayKit + ; + }; + ICADevices = { + inherit Carbon libobjc; + }; + IOBluetooth = { + inherit CoreBluetooth; + }; + JavaScriptCore = { + inherit libobjc; + }; + Kernel = { + inherit IOKit; + }; + LinkPresentation = { + inherit URLFormatting; + }; + MediaToolbox = { + inherit AudioUnit; + }; + MetricKit = { + inherit SignpostMetrics; + }; + Network = { + inherit libnetwork; + }; + PCSC = { + inherit CoreData; + }; + PassKit = { + inherit PassKitCore; + }; + QTKit = { + inherit + CoreMedia + CoreMediaIO + MediaToolbox + VideoToolbox + ; + }; + Quartz = { + inherit QTKit; + }; + QuartzCore = { + inherit + ApplicationServices + CoreImage + CoreVideo + Metal + OpenCL + libobjc + ; + }; + Security = { + inherit IOKit libDER; + }; + TWAIN = { + inherit Carbon; + }; + VideoDecodeAcceleration = { + inherit CoreVideo; + }; + WebKit = { + inherit ApplicationServices Carbon libobjc; + }; + }; + + # Used to remove dependencies which are picked up by gen-frameworks.py -- used mainly to break + # cyclic dependencies. + removeFromFrameworks = { }; + + # Overrides for framework derivations. + overrideFrameworks = super: { + # This framework doesn't exist in newer SDKs (somewhere around 10.13), but + # there are references to it in nixpkgs. + QuickTime = throw "QuickTime framework not available"; + + # Seems to be appropriate given https://developer.apple.com/forums/thread/666686 + JavaVM = super.JavaNativeFoundation; + }; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/private.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/private.nix new file mode 100644 index 0000000000000..d58b28fa02715 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/private.nix @@ -0,0 +1,35 @@ +{ objc4, frameworks }: + +# generated by hand to avoid exposing all private frameworks +# frameworks here are only the necessary ones used by public frameworks. +{ + AVFCapture = { }; + AVFCore = { }; + AddressBookCore = { + inherit (frameworks) ContactsPersistence; + }; + AudioToolboxCore = { }; + ContactsPersistence = { }; + UIFoundation = { }; + GameCenterFoundation = { }; + GameCenterUI = { }; + GameCenterUICore = { }; + URLFormatting = { }; + SignpostMetrics = { }; + PassKitCore = { }; + SkyLight = { }; + + # Also expose CoreSymbolication; used by `root` package. + CoreSymbolication = { }; + + # Also expose DebugSymbols; used by `llvmPackages_8.lldb` package. + DebugSymbols = { }; + + # Also expose DisplayServices; used by `sketchybar` package. + DisplayServices = { + libobjc = objc4; + }; + + # Also expose MultitouchSupport; used by `chuck` package. + MultitouchSupport = { }; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/public.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/public.nix new file mode 100644 index 0000000000000..4488c84bf1245 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/frameworks/public.nix @@ -0,0 +1,209 @@ +# This file is generated by gen-frameworks.nix. +# Do not edit, put overrides in apple_sdk.nix instead. +{ libs, frameworks }: with libs; with frameworks; +{ + AGL = { inherit Carbon OpenGL; }; + AVFAudio = { inherit AudioToolbox CoreAudioTypes CoreMIDI CoreMedia Foundation; }; + AVFoundation = { inherit AVFAudio CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia CoreVideo Foundation IOKit ImageIO MediaToolbox Metal QuartzCore UniformTypeIdentifiers simd; }; + AVKit = { inherit AVFoundation AppKit Cocoa Foundation; }; + Accelerate = { inherit CoreFoundation CoreGraphics CoreVideo Foundation IOKit Metal; }; + Accessibility = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + Accounts = { inherit Foundation; }; + AdServices = { inherit Foundation; }; + AdSupport = { inherit Foundation; }; + AddressBook = { inherit Carbon Cocoa CoreFoundation Foundation; }; + AppKit = { inherit Accessibility ApplicationServices CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal OpenGL QuartzCore; }; + AppTrackingTransparency = { inherit Foundation; }; + AppleScriptKit = {}; + AppleScriptObjC = { inherit Foundation; }; + ApplicationServices = { inherit ColorSync CoreFoundation CoreGraphics CoreServices CoreText ImageIO; }; + AudioToolbox = { inherit Carbon CoreAudio CoreAudioTypes CoreFoundation CoreMIDI Foundation; }; + AudioUnit = { inherit AudioToolbox; }; + AudioVideoBridging = { inherit Foundation IOKit; }; + AuthenticationServices = { inherit AppKit Foundation; }; + AutomaticAssessmentConfiguration = { inherit Foundation; }; + Automator = { inherit AppKit Cocoa Foundation OSAKit; }; + BackgroundTasks = { inherit Foundation; }; + BusinessChat = { inherit Cocoa Foundation; }; + CFNetwork = { inherit CoreFoundation; }; + CHIP = { inherit Foundation Security; }; + CalendarStore = {}; + CallKit = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + Carbon = { inherit ApplicationServices CoreServices Foundation Security; }; + ClassKit = { inherit CoreGraphics Foundation; }; + CloudKit = { inherit CoreFoundation CoreGraphics CoreLocation Foundation IOKit; }; + Cocoa = { inherit AppKit CoreData Foundation; }; + Collaboration = { inherit AppKit CoreServices Foundation; }; + ColorSync = { inherit CoreFoundation; }; + Combine = {}; + Contacts = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + ContactsUI = { inherit AppKit; }; + CoreAudio = { inherit CoreAudioTypes CoreFoundation; }; + CoreAudioKit = { inherit AppKit AudioUnit Cocoa Foundation; }; + CoreAudioTypes = { inherit CoreFoundation; }; + CoreBluetooth = { inherit Foundation; }; + CoreData = { inherit Combine CoreFoundation CoreGraphics Foundation IOKit; }; + CoreDisplay = {}; + CoreFoundation = {}; + CoreGraphics = { inherit CoreFoundation IOKit; }; + CoreHaptics = { inherit Foundation; }; + CoreImage = { inherit ApplicationServices CoreFoundation CoreGraphics CoreVideo Foundation IOKit IOSurface ImageIO Metal OpenGL; }; + CoreLocation = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + CoreMIDI = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + CoreMIDIServer = {}; + CoreML = { inherit CoreFoundation CoreGraphics CoreVideo Foundation IOKit ImageIO Metal; }; + CoreMedia = { inherit CoreAudio CoreAudioTypes CoreFoundation CoreGraphics CoreVideo Foundation IOKit Metal; }; + CoreMediaIO = { inherit CoreAudio CoreFoundation CoreGraphics CoreMedia Foundation IOKit Metal; }; + CoreMotion = { inherit Foundation; }; + CoreServices = { inherit CFNetwork CoreFoundation DiskArbitration Security; }; + CoreSpotlight = { inherit Foundation UniformTypeIdentifiers; }; + CoreTelephony = {}; + CoreText = { inherit CoreFoundation CoreGraphics; }; + CoreVideo = { inherit ApplicationServices CoreFoundation CoreGraphics IOSurface Metal OpenGL; }; + CoreWLAN = { inherit Foundation IOKit; }; + CreateML = { inherit AVFoundation Combine CoreAudio CoreFoundation CoreGraphics CoreImage CoreML CoreMedia CoreServices CoreVideo Foundation IOKit ImageIO Metal MetalPerformanceShaders NaturalLanguage TabularData VideoToolbox Vision simd; }; + CryptoKit = { inherit CoreFoundation CoreGraphics Foundation IOKit LocalAuthentication Security; }; + CryptoTokenKit = { inherit CoreFoundation CoreGraphics Foundation IOKit Security; }; + DVDPlayback = { inherit ApplicationServices CoreFoundation Security; }; + DataDetection = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + DeveloperToolsSupport = {}; + DeviceActivity = { inherit Foundation ManagedSettings; }; + DeviceCheck = { inherit Foundation; }; + DirectoryService = { inherit CoreFoundation; }; + DiscRecording = { inherit CoreServices Foundation; }; + DiscRecordingUI = { inherit Carbon Cocoa DiscRecording; }; + DiskArbitration = { inherit CoreFoundation IOKit; }; + DriverKit = {}; + EventKit = { inherit CoreGraphics CoreLocation Foundation; }; + ExceptionHandling = { inherit Foundation; }; + ExecutionPolicy = { inherit Foundation; }; + ExposureNotification = { inherit Foundation; }; + ExternalAccessory = { inherit Foundation; }; + FWAUserLib = { inherit IOKit; }; + FileProvider = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + FileProviderUI = { inherit AppKit FileProvider Foundation; }; + FinderSync = { inherit AppKit Foundation; }; + ForceFeedback = { inherit CoreFoundation IOKit; }; + Foundation = { inherit Combine CoreFoundation CoreGraphics CoreServices IOKit Security; }; + GLKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal ModelIO OpenGL QuartzCore simd; }; + GLUT = { inherit OpenGL; }; + GSS = { inherit CoreFoundation; }; + GameController = { inherit AppKit Foundation IOKit; }; + GameKit = { inherit AppKit Cocoa Contacts CoreGraphics Foundation GameController GameplayKit Metal MetalKit ModelIO SceneKit SpriteKit simd; }; + GameplayKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation GLKit IOKit Metal ModelIO QuartzCore SceneKit SpriteKit simd; }; + GroupActivities = { inherit AVFoundation Combine CoreGraphics CryptoKit Foundation Network UniformTypeIdentifiers; }; + Hypervisor = {}; + ICADevices = { inherit CoreFoundation CoreGraphics CoreServices IOBluetooth; }; + IMServicePlugIn = { inherit Foundation; }; + IOBluetooth = { inherit CoreAudio CoreFoundation CoreServices Foundation IOKit; }; + IOBluetoothUI = { inherit Cocoa IOBluetooth; }; + IOKit = { inherit CoreFoundation; }; + IOSurface = { inherit CoreFoundation Foundation IOKit; }; + IOUSBHost = { inherit Foundation IOKit; }; + IdentityLookup = { inherit Foundation; }; + ImageCaptureCore = { inherit Cocoa CoreGraphics Foundation; }; + ImageIO = { inherit CoreFoundation CoreGraphics; }; + InputMethodKit = { inherit Carbon Cocoa Foundation; }; + InstallerPlugins = {}; + InstantMessage = {}; + Intents = { inherit CoreFoundation CoreGraphics CoreLocation Foundation IOKit UserNotifications; }; + IntentsUI = { inherit AppKit; }; + JavaNativeFoundation = { inherit Foundation; }; + JavaRuntimeSupport = { inherit ApplicationServices Cocoa Foundation QuartzCore; }; + JavaScriptCore = { inherit CoreFoundation CoreGraphics Foundation; }; + Kerberos = {}; + Kernel = {}; + KernelManagement = { inherit Foundation; }; + LDAP = {}; + LatentSemanticMapping = { inherit Carbon CoreFoundation; }; + LinkPresentation = { inherit AppKit Foundation; }; + LocalAuthentication = { inherit Foundation; }; + LocalAuthenticationEmbeddedUI = { inherit AppKit Foundation LocalAuthentication; }; + MLCompute = { inherit CoreFoundation CoreGraphics Foundation IOKit Metal; }; + MailKit = { inherit AppKit Foundation; }; + ManagedSettings = { inherit Combine Foundation; }; + MapKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage CoreLocation Foundation IOKit Metal QuartzCore; }; + MediaAccessibility = { inherit CoreFoundation CoreGraphics CoreText; }; + MediaLibrary = { inherit Foundation; }; + MediaPlayer = { inherit AVFoundation CoreGraphics Foundation; }; + MediaToolbox = { inherit AudioToolbox CoreFoundation CoreMedia; }; + Message = {}; + Metal = { inherit CoreFoundation CoreGraphics Foundation IOKit IOSurface; }; + MetalKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal ModelIO QuartzCore simd; }; + MetalPerformanceShaders = { inherit CoreGraphics Foundation Metal simd; }; + MetalPerformanceShadersGraph = { inherit Foundation MetalPerformanceShaders; }; + MetricKit = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + ModelIO = { inherit CoreFoundation CoreGraphics Foundation IOKit simd; }; + MultipeerConnectivity = { inherit Cocoa Foundation; }; + MusicKit = { inherit Combine CoreGraphics Foundation; }; + NaturalLanguage = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + NearbyInteraction = { inherit CoreFoundation CoreGraphics Foundation IOKit simd; }; + NetFS = { inherit CoreFoundation; }; + Network = { inherit CoreFoundation Foundation Security; }; + NetworkExtension = { inherit Foundation Network Security; }; + NotificationCenter = { inherit AppKit Foundation; }; + OSAKit = { inherit Carbon Cocoa; }; + OSLog = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + OpenAL = {}; + OpenCL = { inherit OpenGL; }; + OpenDirectory = { inherit CoreFoundation Foundation; }; + OpenGL = {}; + PCSC = {}; + PDFKit = { inherit AppKit Cocoa; }; + PHASE = { inherit AVFAudio AVFoundation CoreAudioTypes Foundation ModelIO simd; }; + ParavirtualizedGraphics = { inherit AppKit CoreVideo Foundation IOSurface Metal; }; + PassKit = { inherit AppKit Contacts CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; + PencilKit = { inherit AppKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; + Photos = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreLocation CoreMIDI CoreMedia Foundation IOKit ImageIO Metal QuartzCore UniformTypeIdentifiers simd; }; + PhotosUI = { inherit AppKit Foundation MapKit Photos; }; + PreferencePanes = { inherit Cocoa; }; + PushKit = { inherit Foundation; }; + QTKit = {}; + Quartz = { inherit AppKit ApplicationServices Cocoa Foundation ImageCaptureCore OpenGL PDFKit QuartzCore QuickLookUI; }; + QuartzCore = { inherit CoreFoundation CoreGraphics CoreImage CoreVideo Foundation IOKit Metal OpenGL; }; + QuickLook = { inherit ApplicationServices CoreFoundation; }; + QuickLookThumbnailing = { inherit CoreGraphics Foundation UniformTypeIdentifiers; }; + QuickLookUI = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal PDFKit QuartzCore QuickLook UniformTypeIdentifiers; }; + RealityFoundation = { inherit AVFAudio AVFoundation AppKit AudioToolbox Combine CoreAudio CoreFoundation CoreGraphics CoreMIDI CoreMedia CoreMotion CoreText CoreVideo Foundation IOKit Metal QuartzCore simd; }; + RealityKit = { inherit AppKit Combine CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal MultipeerConnectivity QuartzCore RealityFoundation simd; }; + ReplayKit = { inherit AVFoundation AppKit Foundation; }; + Ruby = {}; + SafariServices = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; + SceneKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation GLKit IOKit Metal ModelIO QuartzCore simd; }; + ScreenCaptureKit = { inherit AppKit CoreGraphics CoreMedia Foundation; }; + ScreenSaver = { inherit AppKit Foundation; }; + ScreenTime = { inherit AppKit Foundation; }; + ScriptingBridge = { inherit ApplicationServices CoreServices Foundation; }; + Security = { inherit CoreFoundation; }; + SecurityFoundation = { inherit Foundation Security; }; + SecurityInterface = { inherit AppKit Cocoa Security SecurityFoundation; }; + SensorKit = { inherit CoreFoundation CoreLocation Foundation; }; + ServiceManagement = { inherit CoreFoundation Security; }; + ShazamKit = { inherit AVFAudio CoreAudio CoreFoundation CoreGraphics CoreMIDI CoreMedia Foundation IOKit Metal MusicKit; }; + Social = { inherit AppKit Foundation; }; + SoundAnalysis = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreML CoreMedia Foundation IOKit Metal QuartzCore UniformTypeIdentifiers simd; }; + Speech = { inherit AVFoundation CoreAudio CoreFoundation CoreGraphics CoreImage CoreMIDI CoreMedia Foundation IOKit Metal QuartzCore UniformTypeIdentifiers simd; }; + SpriteKit = { inherit AppKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage Foundation GLKit IOKit Metal ModelIO QuartzCore simd; }; + StoreKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage CryptoKit Foundation IOKit Metal QuartzCore Security; }; + SwiftUI = { inherit Accessibility AppKit Combine CoreData CoreFoundation CoreGraphics CoreImage DeveloperToolsSupport Foundation IOKit Metal QuartzCore UniformTypeIdentifiers; }; + SyncServices = {}; + System = {}; + SystemConfiguration = { inherit CoreFoundation Security; }; + SystemExtensions = { inherit Foundation; }; + TWAIN = {}; + TabularData = { inherit Combine Foundation; }; + Tcl = {}; + Tk = {}; + UniformTypeIdentifiers = { inherit CoreFoundation CoreGraphics Foundation IOKit; }; + UserNotifications = { inherit Foundation; }; + UserNotificationsUI = { inherit AppKit; }; + VideoDecodeAcceleration = {}; + VideoSubscriberAccount = { inherit Foundation; }; + VideoToolbox = { inherit CoreFoundation CoreGraphics CoreMedia CoreVideo; }; + Virtualization = { inherit AppKit Cocoa CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit Metal QuartzCore; }; + Vision = { inherit CoreAudio CoreFoundation CoreGraphics CoreML CoreMedia CoreVideo Foundation IOKit ImageIO Metal simd; }; + WebKit = { inherit AppKit CoreData CoreFoundation CoreGraphics CoreImage Foundation IOKit JavaScriptCore Metal QuartzCore; }; + WidgetKit = { inherit Combine CoreFoundation CoreGraphics Foundation IOKit Intents SwiftUI UniformTypeIdentifiers; }; + iTunesLibrary = { inherit Foundation; }; + vmnet = {}; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libSystem.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libSystem.nix new file mode 100644 index 0000000000000..5d57038a46573 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libSystem.nix @@ -0,0 +1,96 @@ +{ + stdenvNoCC, + buildPackages, + darwin-stubs, +}: + +stdenvNoCC.mkDerivation { + pname = "libSystem"; + inherit (darwin-stubs) version; + + nativeBuildInputs = [ buildPackages.darwin.rewrite-tbd ]; + + csu = [ + "bundle1.o" + "crt0.o" + "crt1.10.5.o" + "crt1.10.6.o" + "crt1.o" + "dylib1.10.5.o" + "dylib1.o" + "gcrt1.o" + "lazydylib1.o" + ]; + + buildCommand = + '' + mkdir -p $out/{include,lib/swift} + '' + # Copy each directory in ${darwin-stubs}/usr/include into $out/include + + '' + for dir in $(ls -d ${darwin-stubs}/usr/include/*/); do + cp -dr $dir $out/include + done + '' + # Copy each header and modulemap file in ${darwin-stubs}/usr/include into $out/include + + '' + cp -d \ + ${darwin-stubs}/usr/include/*.h \ + ${darwin-stubs}/usr/include/*.modulemap \ + $out/include + '' + # Remove curses.h, ncurses.h, ncurses_dll.h, and unctrl.h which conflict with ncurses. + # Then, remove the module map for ncurses. + # NOTE: The sed expression expects the module map to use consistent indentation across + # releases. If this changes, the sed expression will need to be updated. + # + # For example, right now we assume that there is one leading space before the + # "explicit" keyword and that the closing brace is on its own line (also with one + # leading space). + + '' + rm $out/include/{curses,ncurses,ncurses_dll,unctrl}.h + sed -i -e '/^ explicit module ncurses {/,/^ }$/d' $out/include/module.modulemap + '' + + '' + rm $out/include/tk*.h $out/include/tcl*.h + + cp -dr \ + ${darwin-stubs}/usr/lib/libSystem.* \ + ${darwin-stubs}/usr/lib/system \ + $out/lib + + # Extra libraries + for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.1 resolv; do + cp -d \ + ${darwin-stubs}/usr/lib/lib$name.tbd \ + ${darwin-stubs}/usr/lib/lib$name.*.tbd \ + $out/lib + done + + for name in os Dispatch; do + cp -dr \ + ${darwin-stubs}/usr/lib/swift/$name.swiftmodule \ + ${darwin-stubs}/usr/lib/swift/libswift$name.tbd \ + $out/lib/swift + done + + for f in $csu; do + from=${darwin-stubs}/usr/lib/$f + if [ -e "$from" ]; then + cp -d $from $out/lib + else + echo "Csu file '$from' doesn't exist: skipping" + fi + done + + chmod u+w -R $out/lib + find $out -name '*.tbd' -type f | while read tbd; do + rewrite-tbd \ + -c /usr/lib/libsystem.dylib:$out/lib/libsystem.dylib \ + -p /usr/lib/system/:$out/lib/system/ \ + -p /usr/lib/swift/:$out/lib/swift/ \ + -r ${builtins.storeDir} \ + "$tbd" + done + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libnetwork.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libnetwork.nix new file mode 100644 index 0000000000000..e7bae2fc77a08 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libnetwork.nix @@ -0,0 +1,16 @@ +{ stdenvNoCC, darwin-stubs }: + +let + self = stdenvNoCC.mkDerivation { + pname = "libnetwork"; + inherit (darwin-stubs) version; + + buildCommand = '' + mkdir -p $out/lib + cp ${darwin-stubs}/usr/lib/libnetwork* $out/lib + ''; + + passthru.tbdRewrites.const."/usr/lib/libnetwork.dylib" = "${self}/lib/libnetwork.dylib"; + }; +in +self diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libobjc.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libobjc.nix new file mode 100644 index 0000000000000..14d7e92c8a540 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libobjc.nix @@ -0,0 +1,22 @@ +{ stdenvNoCC, darwin-stubs }: + +let + self = stdenvNoCC.mkDerivation { + pname = "libobjc"; + inherit (darwin-stubs) version; + + buildCommand = '' + mkdir -p $out/{include,lib/swift} + cp -r ${darwin-stubs}/usr/include/objc $out/include + cp ${darwin-stubs}/usr/lib/libobjc* $out/lib + cp -r ${darwin-stubs}/usr/lib/swift/ObjectiveC.swiftmodule $out/lib/swift + cp ${darwin-stubs}/usr/lib/swift/libswiftObjectiveC.tbd $out/lib/swift + ''; + + passthru.tbdRewrites = { + const."/usr/lib/libobjc.A.dylib" = "${self}/lib/libobjc.A.dylib"; + const."/usr/lib/swift/libswiftObjectiveC.dylib" = "${self}/lib/swift/libswiftObjectiveC.dylib"; + }; + }; +in +self diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libpm.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libpm.nix new file mode 100644 index 0000000000000..110b9a1ab4789 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libpm.nix @@ -0,0 +1,25 @@ +{ + stdenvNoCC, + buildPackages, + darwin-stubs, +}: + +stdenvNoCC.mkDerivation { + pname = "libpm"; + inherit (darwin-stubs) version; + + dontUnpack = true; + dontBuild = true; + + nativeBuildInputs = [ buildPackages.darwin.checkReexportsHook ]; + + installPhase = '' + mkdir -p $out/lib + cp ${darwin-stubs}/usr/lib/libpm* $out/lib + ''; + + passthru.tbdRewrites = { + const."/usr/lib/libpmenergy.dylib" = "${placeholder "out"}/lib/libpmenergy.dylib"; + const."/usr/lib/libpmsample.dylib" = "${placeholder "out"}/lib/libpmsample.dylib"; + }; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/Xplugin.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/Xplugin.nix new file mode 100644 index 0000000000000..6e125c001183c --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/Xplugin.nix @@ -0,0 +1,30 @@ +{ + frameworks, + darwin-stubs, + stdenvNoCC, +}: + +stdenvNoCC.mkDerivation { + pname = "apple-lib-Xplugin"; + inherit (darwin-stubs) version; + + dontUnpack = true; + dontBuild = true; + + propagatedBuildInputs = with frameworks; [ + OpenGL + ApplicationServices + Carbon + IOKit + CoreGraphics + CoreServices + CoreText + ]; + + installPhase = '' + mkdir -p $out/include $out/lib + cp "${darwin-stubs}/include/Xplugin.h" $out/include/Xplugin.h + cp ${darwin-stubs}/usr/lib/libXplugin.1.tbd $out/lib + ln -s libXplugin.1.tbd $out/lib/libXplugin.tbd + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/default.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/default.nix new file mode 100644 index 0000000000000..87a36ba32b62e --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/default.nix @@ -0,0 +1,10 @@ +{ callPackage }: + +{ + libDER = callPackage ./libDER.nix { }; + sandbox = callPackage ./sandbox.nix { }; + simd = callPackage ./simd.nix { }; + utmp = callPackage ./utmp.nix { }; + xpc = callPackage ./xpc.nix { }; + Xplugin = callPackage ./Xplugin.nix { }; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/libDER.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/libDER.nix new file mode 100644 index 0000000000000..4aa8e2bd95509 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/libDER.nix @@ -0,0 +1,11 @@ +{ darwin-stubs, stdenvNoCC }: + +stdenvNoCC.mkDerivation { + pname = "apple-lib-libDER"; + inherit (darwin-stubs) version; + + buildCommand = '' + mkdir -p $out/include + cp -r ${darwin-stubs}/usr/include/libDER $out/include + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/sandbox.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/sandbox.nix new file mode 100644 index 0000000000000..f4e9955a0b9b5 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/sandbox.nix @@ -0,0 +1,13 @@ +{ darwin-stubs, stdenvNoCC }: + +stdenvNoCC.mkDerivation { + pname = "apple-lib-sandbox"; + inherit (darwin-stubs) version; + + buildCommand = '' + mkdir -p $out/include $out/lib + cp "${darwin-stubs}/usr/include/sandbox.h" $out/include/sandbox.h + cp "${darwin-stubs}/usr/lib/libsandbox.1.tbd" $out/lib + ln -s libsandbox.1.tbd $out/lib/libsandbox.tbd + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/simd.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/simd.nix new file mode 100644 index 0000000000000..45226a5bec59b --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/simd.nix @@ -0,0 +1,11 @@ +{ darwin-stubs, stdenvNoCC }: + +stdenvNoCC.mkDerivation { + pname = "apple-lib-simd"; + inherit (darwin-stubs) version; + + buildCommand = '' + mkdir -p $out/include + cp -r ${darwin-stubs}/usr/include/simd $out/include + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/utmp.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/utmp.nix new file mode 100644 index 0000000000000..bc85b9be35b50 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/utmp.nix @@ -0,0 +1,12 @@ +{ darwin-stubs, stdenvNoCC }: + +stdenvNoCC.mkDerivation { + pname = "apple-lib-utmp"; + inherit (darwin-stubs) version; + + buildCommand = '' + mkdir -p $out/include + cp "${darwin-stubs}/include/utmp.h" $out/include + cp "${darwin-stubs}/include/utmpx.h" $out/include + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libs/xpc.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/xpc.nix new file mode 100644 index 0000000000000..8c9848daf9caf --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libs/xpc.nix @@ -0,0 +1,12 @@ +{ darwin-stubs, stdenvNoCC }: + +stdenvNoCC.mkDerivation { + pname = "apple-lib-xpc"; + inherit (darwin-stubs) version; + + buildCommand = '' + mkdir -p $out/include + cp -r "${darwin-stubs}/usr/include/xpc" $out/include/xpc + cp "${darwin-stubs}/usr/include/launch.h" $out/include/launch.h + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk-12.3/libunwind.nix b/pkgs/os-specific/darwin/apple-sdk-12.3/libunwind.nix new file mode 100644 index 0000000000000..c1846a9bf92f5 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-sdk-12.3/libunwind.nix @@ -0,0 +1,28 @@ +{ + stdenvNoCC, + buildPackages, + darwin-stubs, +}: + +stdenvNoCC.mkDerivation { + pname = "libunwind"; + inherit (darwin-stubs) version; + + dontUnpack = true; + dontBuild = true; + + nativeBuildInputs = [ buildPackages.darwin.checkReexportsHook ]; + + installPhase = '' + mkdir -p $out/include/mach-o + + cp \ + ${darwin-stubs}/usr/include/libunwind.h \ + ${darwin-stubs}/usr/include/unwind.h \ + $out/include + + cp \ + ${darwin-stubs}/usr/include/mach-o/compact_unwind_encoding.h \ + $out/include/mach-o + ''; +} diff --git a/pkgs/os-specific/darwin/apple-sdk/default.nix b/pkgs/os-specific/darwin/apple-sdk/default.nix index a3d1df0867a9a..7298eba6c50aa 100644 --- a/pkgs/os-specific/darwin/apple-sdk/default.nix +++ b/pkgs/os-specific/darwin/apple-sdk/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, cpio, pbzx, pkgs, lib, darwin-stubs, print-reexports }: +{ stdenv, stdenvNoCC, fetchurl, cpio, pbzx, pkgs, lib, darwin-stubs, print-reexports }: let # sadly needs to be exported because security_tool needs it @@ -263,6 +263,15 @@ in rec { ln -s libsandbox.1.tbd $out/lib/libsandbox.tbd ''; }; + + simd = stdenvNoCC.mkDerivation { + name = "apple-lib-simd"; + + preferLocalBuild = true; + allowSubstitutes = false; + + buildCommand = "echo 'simd library not available in the 10.12 SDK'; exit 1"; + }; }; overrides = super: { diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 2fb7539f41982..486d3964fdd53 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -47,6 +47,9 @@ makeScopeWithSplicing' { fetchurl = fetchurlBoot; }; + # macOS 12.3 SDK + apple_sdk_12_3 = pkgs.callPackage ../os-specific/darwin/apple-sdk-12.3 { }; + # Pick an SDK apple_sdk = { "10.12" = apple_sdk_10_12; @@ -80,7 +83,7 @@ in impure-cmds // appleSourcePackages // chooseLibs // { - inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0; + inherit apple_sdk apple_sdk_10_12 apple_sdk_11_0 apple_sdk_12_3; stdenvNoCF = stdenv.override { extraBuildInputs = []; @@ -183,9 +186,13 @@ impure-cmds // appleSourcePackages // chooseLibs // { lsusb = callPackage ../os-specific/darwin/lsusb { }; - moltenvk = pkgs.darwin.apple_sdk_11_0.callPackage ../os-specific/darwin/moltenvk { - inherit (apple_sdk_11_0.frameworks) AppKit Foundation Metal QuartzCore; - inherit (apple_sdk_11_0.libs) simd; + moltenvk = callPackage ../os-specific/darwin/moltenvk { + stdenv = pkgs.overrideSDK stdenv { + darwinMinVersion = "10.15"; + darwinSdkVersion = "12.3"; + }; + inherit (apple_sdk.frameworks) AppKit Foundation Metal QuartzCore; + inherit (apple_sdk.libs) simd; }; openwith = callPackage ../os-specific/darwin/openwith { };