about summary refs log tree commit diff
path: root/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/darwin/apple-sdk-11.0/default.nix')
-rw-r--r--pkgs/os-specific/darwin/apple-sdk-11.0/default.nix74
1 files changed, 45 insertions, 29 deletions
diff --git a/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix b/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix
index 145c98496b49a..8c9e16a6ca9a9 100644
--- a/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix
+++ b/pkgs/os-specific/darwin/apple-sdk-11.0/default.nix
@@ -56,28 +56,51 @@ let
     '';
   };
 
+  mkStdenv = stdenv:
+    let
+      cc = stdenv.cc.override {
+        bintools = stdenv.cc.bintools.override { libc = packages.Libsystem; };
+        libc = packages.Libsystem;
+      };
+    in
+    if stdenv.isAarch64 then stdenv
+    else
+      (overrideCC stdenv cc).override {
+        targetPlatform = stdenv.targetPlatform // {
+          darwinMinVersion = "10.12";
+          darwinSdkVersion = "11.0";
+        };
+      };
+
+  stdenvs = {
+    stdenv = mkStdenv stdenv;
+  } // builtins.listToAttrs (map
+    (v: { name = "clang${v}Stdenv"; value = mkStdenv pkgs."llvmPackages_${v}".stdenv; })
+    [ "12" "13" "14" "15" ]
+  );
+
   callPackage = newScope (packages // pkgs.darwin // { inherit MacOSX-SDK; });
 
-  packages = {
-    inherit (callPackage ./apple_sdk.nix {}) frameworks libs;
+  packages = stdenvs // {
+    inherit (callPackage ./apple_sdk.nix { }) frameworks libs;
 
     # TODO: this is nice to be private. is it worth the callPackage above?
     # Probably, I don't think that callPackage costs much at all.
     inherit MacOSX-SDK CLTools_Executables;
 
-    Libsystem = callPackage ./libSystem.nix {};
+    Libsystem = callPackage ./libSystem.nix { };
     LibsystemCross = pkgs.darwin.Libsystem;
-    libcharset = callPackage ./libcharset.nix {};
-    libunwind = callPackage ./libunwind.nix {};
-    libnetwork = callPackage ./libnetwork.nix {};
-    libpm = callPackage ./libpm.nix {};
+    libcharset = callPackage ./libcharset.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 = if stdenv ? objc4 then stdenv.objc4 else callPackage ./libobjc.nix {};
+    objc4 = stdenv.objc4 or (callPackage ./libobjc.nix { });
 
     # questionable aliases
     configd = pkgs.darwin.apple_sdk.frameworks.SystemConfiguration;
-    IOKit = pkgs.darwin.apple_sdk.frameworks.IOKit;
+    inherit (pkgs.darwin.apple_sdk.frameworks) IOKit;
 
     xcodebuild = pkgs.xcbuild.override {
       inherit (pkgs.darwin.apple_sdk_11_0) stdenv;
@@ -89,30 +112,23 @@ let
       inherit (pkgs) rustc cargo;
     };
 
-    callPackage = newScope (lib.optionalAttrs stdenv.isDarwin rec {
-      inherit (pkgs.darwin.apple_sdk_11_0) stdenv xcodebuild rustPlatform;
+    callPackage = newScope (lib.optionalAttrs stdenv.isDarwin (stdenvs // rec {
+      inherit (pkgs.darwin.apple_sdk_11_0) xcodebuild rustPlatform;
       darwin = pkgs.darwin.overrideScope (_: prev: {
-        inherit (prev.darwin.apple_sdk_11_0) Libsystem LibsystemCross libcharset libunwind objc4 configd IOKit Security;
+        inherit (prev.darwin.apple_sdk_11_0)
+          IOKit
+          Libsystem
+          LibsystemCross
+          Security
+          configd
+          libcharset
+          libunwind
+          objc4
+          ;
         apple_sdk = prev.darwin.apple_sdk_11_0;
         CF = prev.darwin.apple_sdk_11_0.CoreFoundation;
       });
       xcbuild = xcodebuild;
-    });
-
-    stdenv =
-      let
-        clang = stdenv.cc.override {
-          bintools = stdenv.cc.bintools.override { libc = packages.Libsystem; };
-          libc = packages.Libsystem;
-        };
-      in
-      if stdenv.isAarch64 then stdenv
-      else
-        (overrideCC stdenv clang).override {
-          targetPlatform = stdenv.targetPlatform // {
-            darwinMinVersion = "10.12";
-            darwinSdkVersion = "11.0";
-          };
-        };
+    }));
   };
 in packages