Skip to content

Commit db04c2c

Browse files
committed
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.
1 parent 794d2e7 commit db04c2c

File tree

2 files changed

+242
-1
lines changed

2 files changed

+242
-1
lines changed

lib/system-nixpkgs-map.nix

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,244 @@ in
151151
# -- mingw32
152152
// { mingwex = null;
153153
}
154+
# -- os x
155+
# TODO remove once planner code is updated not to output frameworks
156+
# (we can only do that once we no longer support old nixpkgs where
157+
# framework derivations are needed)
158+
//
159+
(
160+
let
161+
# If this file exists then the frameworks are all probably stubbed out
162+
# and we can avoid warnings by ignoring them.
163+
hasMkStubs = builtins.pathExists (pkgs.path + "/pkgs/os-specific/darwin/apple-sdk/mk-stub.nix");
164+
frameworkNames =
165+
[
166+
"AGL"
167+
"AVFCapture"
168+
"AVFCore"
169+
"AVFoundation"
170+
"AVKit"
171+
"Accelerate"
172+
"Accessibility"
173+
"Accounts"
174+
"AdServices"
175+
"AdSupport"
176+
"AddressBook"
177+
"AddressBookCore"
178+
"AppKit"
179+
"AppTrackingTransparency"
180+
"Apple80211"
181+
"AppleScriptKit"
182+
"AppleScriptObjC"
183+
"ApplicationServices"
184+
"AudioToolbox"
185+
"AudioToolboxCore"
186+
"AudioUnit"
187+
"AudioVideoBridging"
188+
"AuthenticationServices"
189+
"AutomaticAssessmentConfiguration"
190+
"Automator"
191+
"BackgroundTasks"
192+
"BusinessChat"
193+
"CFNetwork"
194+
"CalendarStore"
195+
"CallKit"
196+
"Carbon"
197+
"ClassKit"
198+
"CloudKit"
199+
"Cocoa"
200+
"Collaboration"
201+
"ColorSync"
202+
"Combine"
203+
"Contacts"
204+
"ContactsPersistence"
205+
"ContactsUI"
206+
"CoreAudio"
207+
"CoreAudioKit"
208+
"CoreAudioTypes"
209+
"CoreBluetooth"
210+
"CoreData"
211+
"CoreDisplay"
212+
"CoreFoundation"
213+
"CoreGraphics"
214+
"CoreHaptics"
215+
"CoreImage"
216+
"CoreLocation"
217+
"CoreMIDI"
218+
"CoreMIDIServer"
219+
"CoreML"
220+
"CoreMedia"
221+
"CoreMediaIO"
222+
"CoreMotion"
223+
"CoreServices"
224+
"CoreSpotlight"
225+
"CoreSymbolication"
226+
"CoreTelephony"
227+
"CoreText"
228+
"CoreVideo"
229+
"CoreWLAN"
230+
"CryptoKit"
231+
"CryptoTokenKit"
232+
"DVDPlayback"
233+
"DebugSymbols"
234+
"DeveloperToolsSupport"
235+
"DeviceCheck"
236+
"DirectoryService"
237+
"DiscRecording"
238+
"DiscRecordingUI"
239+
"DiskArbitration"
240+
"DisplayServices"
241+
"DriverKit"
242+
"EventKit"
243+
"ExceptionHandling"
244+
"ExecutionPolicy"
245+
"ExternalAccessory"
246+
"FWAUserLib"
247+
"FileProvider"
248+
"FileProviderUI"
249+
"FinderSync"
250+
"ForceFeedback"
251+
"Foundation"
252+
"GLKit"
253+
"GLUT"
254+
"GSS"
255+
"GameCenterFoundation"
256+
"GameCenterUI"
257+
"GameCenterUICore"
258+
"GameController"
259+
"GameKit"
260+
"GameplayKit"
261+
"HIDDriverKit"
262+
"Hypervisor"
263+
"ICADevices"
264+
"IMServicePlugIn"
265+
"IOBluetooth"
266+
"IOBluetoothUI"
267+
"IOKit"
268+
"IOSurface"
269+
"IOUSBHost"
270+
"IdentityLookup"
271+
"ImageCaptureCore"
272+
"ImageIO"
273+
"InputMethodKit"
274+
"InstallerPlugins"
275+
"InstantMessage"
276+
"Intents"
277+
"JavaNativeFoundation"
278+
"JavaRuntimeSupport"
279+
"JavaScriptCore"
280+
"JavaVM"
281+
"Kerberos"
282+
"Kernel"
283+
"KernelManagement"
284+
"LDAP"
285+
"LatentSemanticMapping"
286+
"LinkPresentation"
287+
"LocalAuthentication"
288+
"MLCompute"
289+
"MapKit"
290+
"MediaAccessibility"
291+
"MediaLibrary"
292+
"MediaPlayer"
293+
"MediaRemote"
294+
"MediaToolbox"
295+
"Message"
296+
"Metal"
297+
"MetalKit"
298+
"MetalPerformanceShaders"
299+
"MetalPerformanceShadersGraph"
300+
"MetricKit"
301+
"ModelIO"
302+
"MultipeerConnectivity"
303+
"MultitouchSupport"
304+
"NaturalLanguage"
305+
"NearbyInteraction"
306+
"NetFS"
307+
"Network"
308+
"NetworkExtension"
309+
"NetworkingDriverKit"
310+
"NotificationCenter"
311+
"OSAKit"
312+
"OSLog"
313+
"OpenAL"
314+
"OpenCL"
315+
"OpenDirectory"
316+
"OpenGL"
317+
"PCIDriverKit"
318+
"PCSC"
319+
"PDFKit"
320+
"ParavirtualizedGraphics"
321+
"PassKit"
322+
"PassKitCore"
323+
"PencilKit"
324+
"Photos"
325+
"PhotosUI"
326+
"PreferencePanes"
327+
"PushKit"
328+
"Python"
329+
"QTKit"
330+
"Quartz"
331+
"QuartzCore"
332+
"QuickLook"
333+
"QuickLookThumbnailing"
334+
"QuickTime"
335+
"RealityKit"
336+
"ReplayKit"
337+
"Ruby"
338+
"SafariServices"
339+
"SceneKit"
340+
"ScreenSaver"
341+
"ScreenTime"
342+
"ScriptingBridge"
343+
"Security"
344+
"SecurityFoundation"
345+
"SecurityInterface"
346+
"SensorKit"
347+
"ServiceManagement"
348+
"SignpostMetrics"
349+
"SkyLight"
350+
"Social"
351+
"SoundAnalysis"
352+
"Speech"
353+
"SpriteKit"
354+
"StoreKit"
355+
"SwiftUI"
356+
"SyncServices"
357+
"System"
358+
"SystemConfiguration"
359+
"SystemExtensions"
360+
"TWAIN"
361+
"Tcl"
362+
"Tk"
363+
"UIFoundation"
364+
"URLFormatting"
365+
"USBDriverKit"
366+
"UniformTypeIdentifiers"
367+
"UserNotifications"
368+
"UserNotificationsUI"
369+
"VideoDecodeAcceleration"
370+
"VideoSubscriberAccount"
371+
"VideoToolbox"
372+
"Virtualization"
373+
"Vision"
374+
"WebKit"
375+
"WidgetKit"
376+
"iTunesLibrary"
377+
"vmnet"
378+
];
379+
380+
in
381+
lib.optionalAttrs stdenv.hostPlatform.isDarwin
382+
(lib.genAttrs frameworkNames
383+
(n:
384+
# Check to see if this is an old nixpkgs where we need framework derivations
385+
if !hasMkStubs
386+
# In future versions of `nixpkgs` these will be removed
387+
# so make sure they are there.
388+
&& darwin ? apple_sdk
389+
&& darwin.apple_sdk ? frameworks
390+
&& darwin.apple_sdk.frameworks ? ${n}
391+
&& !(darwin.apple_sdk.frameworks.${n}.passthru.isDarwinCompatStub or false)
392+
then darwin.apple_sdk.frameworks.${n}
393+
else null))
394+
)

modules/component.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ in
4949
};
5050

5151
frameworks = lib.mkOption {
52-
type = listOfFilteringNulls types.package;
52+
type = listOfFilteringNulls (types.nullOr types.package);
5353
default = [ ];
5454
};
5555

0 commit comments

Comments
 (0)