From 48519562e3e2107c4aa312939f7d4791f912c693 Mon Sep 17 00:00:00 2001 From: Andrew Childs Date: Tue, 27 Apr 2021 19:56:59 +0900 Subject: [PATCH] darwin-packages: avoid exporting attributes that don't exist --- pkgs/top-level/darwin-packages.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index a43cdc80a9d..a7f29d67261 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -48,13 +48,18 @@ lib.makeScopeWithSplicing splicePackages newScope otherSplices (_: {}) (spliced: # SDK. useAppleSDKLibs = stdenv.hostPlatform.isAarch64; - chooseLibs = { - inherit ( + selectAttrs = attrs: names: + lib.listToAttrs (lib.concatMap (n: if attrs ? "${n}" then [(lib.nameValuePair n attrs."${n}")] else []) names); + + chooseLibs = ( + # There are differences in which libraries are exported. Avoid evaluation + # errors when a package is not provided. + selectAttrs ( if useAppleSDKLibs then apple_sdk else appleSourcePackages - ) Libsystem LibsystemCross libcharset libunwind objc4 configd IOKit; - + ) ["Libsystem" "LibsystemCross" "libcharset" "libunwind" "objc4" "configd" "IOKit"] + ) // { inherit ( if useAppleSDKLibs then apple_sdk.frameworks