core/pkgs/by-name/xc/xcbuild/sdks.nix

43 lines
993 B
Nix
Raw Normal View History

2024-06-30 08:12:46 +00:00
{
runCommand,
lib,
toolchainName,
sdkName,
writeText,
xcodePlatform,
sdkVer,
productBuildVer,
}:
2024-05-02 00:46:19 +00:00
let
inherit (lib.generators) toPlist toJSON;
SDKSettings = {
CanonicalName = sdkName;
DisplayName = sdkName;
Toolchains = [ toolchainName ];
Version = sdkVer;
MaximumDeploymentTarget = sdkVer;
isBaseSDK = "YES";
};
2024-06-30 08:12:46 +00:00
SystemVersion =
lib.optionalAttrs (productBuildVer != null) { ProductBuildVersion = productBuildVer; }
// {
ProductName = "Mac OS X";
ProductVersion = sdkVer;
};
2024-05-02 00:46:19 +00:00
in
2024-06-30 08:12:46 +00:00
runCommand "SDKs" { } ''
2024-05-02 00:46:19 +00:00
sdk=$out/${sdkName}.sdk
2024-06-30 08:12:46 +00:00
install -D ${writeText "SDKSettings.plist" (toPlist { } SDKSettings)} $sdk/SDKSettings.plist
install -D ${writeText "SDKSettings.json" (toJSON { } SDKSettings)} $sdk/SDKSettings.json
install -D ${
writeText "SystemVersion.plist" (toPlist { } SystemVersion)
} $sdk/System/Library/CoreServices/SystemVersion.plist
2024-05-02 00:46:19 +00:00
ln -s $sdk $sdk/usr
ln -s $sdk $out/${xcodePlatform}.sdk
''