about summary refs log tree commit diff
path: root/pkgs/development/tools/xcbuild/sdks.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/xcbuild/sdks.nix')
-rw-r--r--pkgs/development/tools/xcbuild/sdks.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/development/tools/xcbuild/sdks.nix b/pkgs/development/tools/xcbuild/sdks.nix
new file mode 100644
index 000000000000..b0af26e87c12
--- /dev/null
+++ b/pkgs/development/tools/xcbuild/sdks.nix
@@ -0,0 +1,28 @@
+{ runCommand, lib, toolchainName, sdkName, writeText, version, xcodePlatform }:
+
+let
+  inherit (lib.generators) toPlist;
+
+  SDKSettings = {
+    CanonicalName = sdkName;
+    DisplayName = sdkName;
+    Toolchains = [ toolchainName ];
+    Version = version;
+    MaximumDeploymentTarget = version;
+    isBaseSDK = "YES";
+  };
+
+  SystemVersion = {
+    ProductName = "Mac OS X";
+    ProductVersion = version;
+  };
+in
+
+runCommand "SDKs" {
+  inherit version;
+} ''
+  sdk=$out/${sdkName}.sdk
+  install -D ${writeText "SDKSettings.plist" (toPlist {} SDKSettings)} $sdk/SDKSettings.plist
+  install -D ${writeText "SystemVersion.plist" (toPlist {} SystemVersion)} $sdk/System/Library/CoreServices/SystemVersion.plist
+  ln -s $sdk $out/${xcodePlatform}.sdk
+''