From db04c2c9012f0ee1fe0edf927b803d4f66207b65 Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Sat, 24 May 2025 16:14:44 +1200 Subject: [PATCH] Fix macOS frameworks without bringing back unwanted warnings To support old and new versions of nixpkgs we still need to include framework derivations for now. --- lib/system-nixpkgs-map.nix | 241 +++++++++++++++++++++++++++++++++++++ modules/component.nix | 2 +- 2 files changed, 242 insertions(+), 1 deletion(-) diff --git a/lib/system-nixpkgs-map.nix b/lib/system-nixpkgs-map.nix index f979bfd0c1..044db4ce5c 100644 --- a/lib/system-nixpkgs-map.nix +++ b/lib/system-nixpkgs-map.nix @@ -151,3 +151,244 @@ in # -- mingw32 // { mingwex = null; } +# -- os x +# TODO remove once planner code is updated not to output frameworks +# (we can only do that once we no longer support old nixpkgs where +# framework derivations are needed) +// +( +let + # If this file exists then the frameworks are all probably stubbed out + # and we can avoid warnings by ignoring them. + hasMkStubs = builtins.pathExists (pkgs.path + "/pkgs/os-specific/darwin/apple-sdk/mk-stub.nix"); + frameworkNames = + [ + "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" + ]; + +in + lib.optionalAttrs stdenv.hostPlatform.isDarwin + (lib.genAttrs frameworkNames + (n: + # Check to see if this is an old nixpkgs where we need framework derivations + if !hasMkStubs + # In future versions of `nixpkgs` these will be removed + # so make sure they are there. + && darwin ? apple_sdk + && darwin.apple_sdk ? frameworks + && darwin.apple_sdk.frameworks ? ${n} + && !(darwin.apple_sdk.frameworks.${n}.passthru.isDarwinCompatStub or false) + then darwin.apple_sdk.frameworks.${n} + else null)) +) diff --git a/modules/component.nix b/modules/component.nix index 8a7607f08a..be32d30bd2 100644 --- a/modules/component.nix +++ b/modules/component.nix @@ -49,7 +49,7 @@ in }; frameworks = lib.mkOption { - type = listOfFilteringNulls types.package; + type = listOfFilteringNulls (types.nullOr types.package); default = [ ]; };