Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darwin: change the SDK pattern, update the SDKs, and update source releases #346043

Merged
merged 157 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
22369ef
maintainers/team-list.nix: add reckenrode to darwin
reckenrode Aug 11, 2024
08ad882
darwin: add bootstrapStdenv
reckenrode Aug 21, 2024
40d415f
darwin: add darwinMinVersionHook
reckenrode Sep 23, 2024
5721c4f
darwin: add libSystem
reckenrode Sep 30, 2024
1211498
darwin: add xcodeProjectCheckHook
reckenrode Sep 2, 2024
8f8e240
darwin.apple-source-releases: add mkAppleDerivation
reckenrode Sep 2, 2024
6a54c7f
darwin.apple-source-releases: add update-source-releases.sh
reckenrode Sep 22, 2024
639108e
darwin.libsbuf: init at 14.1
reckenrode Sep 21, 2024
5567902
apple-sdk: init at 10.12.2 and 11.3
reckenrode Sep 21, 2024
3fb982d
apple-sdk_10_13: init at 10.13.2
reckenrode Sep 21, 2024
a447cba
apple-sdk_10_14: init at 10.14.6
reckenrode Sep 21, 2024
d10c85b
apple-sdk_10_15: init at 10.15.6
reckenrode Sep 21, 2024
689e898
apple-sdk_12: init at 12.3
reckenrode Sep 21, 2024
4283b8f
apple-sdk_13: init at 13.3
reckenrode Sep 21, 2024
8fae285
apple-sdk_14: init at 14.4
reckenrode Sep 21, 2024
d1c2539
darwin: add mkStub for deprecating frameworks
reckenrode Sep 29, 2024
17aeace
darwin: prepare for adding stub packages
reckenrode Sep 21, 2024
fcd9dc8
darwin.apple_sdk_11_0: convert frameworks and libs to stubs
reckenrode Sep 26, 2024
4802277
darwin.apple_sdk_12_3: convert frameworks and libs to stubs
reckenrode Sep 27, 2024
0a3c487
darwin.apple_sdk: convert frameworks and libs to stubs
reckenrode Sep 26, 2024
9ecb69c
darwin.apple_sdk: drop gen-frameworks.py (replaced by new SDK pattern)
reckenrode Oct 6, 2024
c218ce1
darwin: replace framework chooser with stubs
reckenrode Sep 21, 2024
97d75cb
{bintools,cc}-wrapper: set up Darwin SDK paths
reckenrode Sep 29, 2024
51755b0
{bintools,cc}-wrapper: use a fallback SDK when `DEVELOPER_DIR` is not…
reckenrode Sep 29, 2024
826edbf
{bintools,cc}-wrapper: fix static builds on Darwin
reckenrode Sep 29, 2024
a556a81
atf: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
54d591b
cmake: undo `/var/empty` workaround for Darwin SDK paths
reckenrode Aug 31, 2024
472d10b
cmake: do in fact use the Darwin SDK in the setup hook
reckenrode Aug 17, 2024
a79ed0d
gnutar: make sure libiconv is linked
reckenrode Aug 17, 2024
f1480a2
libpng: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
1ebcfd5
libuv: Use darwin.libutil on Darwin
reckenrode Sep 29, 2024
5a60ff8
libxml2: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
25c6fe1
llvmPackages.clang: backport __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__
reckenrode Sep 24, 2024
4dc3227
llvmPackages.clang: use the system libunwind on Darwin
reckenrode Sep 24, 2024
d3114e0
llvmPackages.compiler-rt: align Darwin bootstrap with other platforms
reckenrode Sep 24, 2024
654e19f
llvmPackages.compiler-rt: always build sanitizers on Darwin
reckenrode Sep 24, 2024
7647c68
llvmPackages.compiler-rt: avoid propagating the SDK in static builds
reckenrode Sep 24, 2024
2fd9a1a
llvmPackages.compiler-rt: drop use of xcbuild
reckenrode Sep 24, 2024
e6a4c83
llvmPackages.compiler-rt: fix compiler-rt bootstrap on Darwin
reckenrode Sep 24, 2024
3e5acda
llvmPackages.compiler-rt: fix cross-compilation on Darwin
reckenrode Sep 24, 2024
18211ad
llvmPackages.libcxx: use a bootstrap stdenv on Darwin
reckenrode Sep 24, 2024
34ce30c
llvmPackages.libllvm: disable tests when built in the Darwin bootstrap
reckenrode Sep 24, 2024
bf45402
ncurses: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
aef4614
xar: add xarMinimal
reckenrode Oct 2, 2024
45e65c1
xcbuild: move to pkgs/by-name
reckenrode Sep 22, 2024
f51c62a
xcbuild: format with nixfmt-rfc-style
reckenrode Oct 3, 2024
15ac657
xcbuild: refactor to support the new SDKs
reckenrode Sep 22, 2024
118a214
xcbuild: warn when someone tries to override `sdkVer`
reckenrode Oct 3, 2024
49834c3
xcbuild: suppress warning for now
reckenrode Oct 5, 2024
fee84be
xcbuild: suppress xcbuild passthru warning for now
reckenrode Oct 5, 2024
dd569d8
xcbuild: avoid `xcrun` invoking itself via `/usr/bin` stubs
reckenrode Sep 22, 2024
75bc428
xcbuild: 0.1.2-pre -> 0.1.1-unstable-2019-11-20
reckenrode Sep 22, 2024
1fd1796
zlib: build with the bootstrap stdenv on Darwin
reckenrode Sep 8, 2024
76a5ef6
darwin.stdenv: rework for the new SDK
reckenrode Sep 25, 2024
9c004ef
darwin.stdenv: use xarMinimal
reckenrode Oct 2, 2024
b7442b9
darwin.stdenv: provide an SDK when cross-compiling
reckenrode Aug 21, 2024
4624bd7
darwin.adv_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 21, 2024
78076b3
darwin.AvailabilityVersions: use mkAppleDerivation
reckenrode Sep 2, 2024
129a959
darwin.AvailabilityVersions: also generate _symbol_aliasing.h
reckenrode Sep 21, 2024
8e7056c
darwin.AvailabilityVersions: remove workaround
reckenrode Oct 5, 2024
94b1474
darwin.basic_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 21, 2024
c5c276b
darwin.bootstrap_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
b878c44
darwin.bsdmake: add to darwin-aliases.nix
reckenrode Sep 22, 2024
8574626
darwin.copyfile: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
b8dbc16
darwin.Csu: use mkAppleDerivation
reckenrode Sep 22, 2024
83807dc
darwin.developer_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
97454b4
darwin.diskdev_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
eed715a
darwin.file_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
0335ce0
darwin.ICU: convert to upstream build system and use mkAppleDerivation
reckenrode Sep 22, 2024
ca4dd24
darwin.libiconv: move back to darwin attrset and use mkAppleDerivation
reckenrode Sep 22, 2024
b0884d5
darwin.libiconv: use finalPackage when referencing doInstallCheck
reckenrode Oct 5, 2024
9af3511
darwin.libiconv: use `EOF` instead of `-header` for the herdoc
reckenrode Oct 5, 2024
375057b
darwin.libresolv: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
dac3f1f
macfuse-stubs: use top-level libtapi
reckenrode Sep 25, 2024
b8be4c4
darwin.libtapi: add to darwin-aliases.nix
reckenrode Sep 22, 2024
4b4270c
darwin.libutil: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
822a865
darwin.network_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
6fca3b4
darwin.PowerManagement: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
149eb5a
darwin.removefile: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
a19b0a7
darwin.shell_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
9ea9221
darwin.system_cmds: use mkAppleDerivation
reckenrode Sep 22, 2024
97da1bd
darwin.text_cmds: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
29a87d6
darwin.top: convert to Meson and use mkAppleDerivation
reckenrode Sep 22, 2024
9d376e2
cctools: drop darwin.objc4 from build inputs
reckenrode Aug 17, 2024
3904162
cctools: move libtool to its own output
reckenrode Aug 24, 2024
2bf9c22
ld64: ensure ld64 checks pass with the new SDK
reckenrode Sep 23, 2024
1c17748
ld64: drop libunwind as a dependency
reckenrode Sep 23, 2024
f90d4d5
ld64: adopt source release private headers pattern
reckenrode Sep 23, 2024
84f8fcf
libcCross: use darwin.libSystem unconditionally
reckenrode Sep 25, 2024
6986cab
libunwind: add a comment explaining the package situation
reckenrode Sep 25, 2024
8a0d884
libxo: init at 1.7.5
reckenrode Sep 23, 2024
66fcbb9
makeStaticDarwin: drop darwin-portable-libSystem-hook
reckenrode Sep 25, 2024
1c26a2f
makeStaticDarwin: handle when `env.NIX_CFLAGS_LINK` is set
reckenrode Sep 1, 2024
0e61488
overrideSDK: update for the new SDK
reckenrode Sep 25, 2024
b62e262
python27: drop configd
reckenrode Aug 29, 2024
3e5316c
python3: drop configd
reckenrode Sep 29, 2024
092b50a
python3: fix stdenv bootstrap on x86_64-darwin
reckenrode Oct 3, 2024
7a8e3bf
darwin.CF: remove and replace with stubs
reckenrode Sep 21, 2024
2ed29e2
darwin.CarbonHeaders: remove and replace with stubs
reckenrode Sep 2, 2024
4fbe414
darwin.CommonCrypto: remove and replace with stubs
reckenrode Sep 2, 2024
390e8e7
darwin.CoreSymbolication: remove and replace with stubs
reckenrode Oct 2, 2024
65650be
darwin.IOKit: remove and replace with stubs
reckenrode Sep 2, 2024
2e1f901
darwin.Libc: remove and replace with stubs
reckenrode Sep 2, 2024
0d76542
darwin.Libinfo: remove and replace with stubs
reckenrode Sep 2, 2024
67271ab
darwin.Libm: remove and replace with stubs
reckenrode Sep 2, 2024
b47afcc
darwin.Libnotify: remove and replace with stubs
reckenrode Sep 2, 2024
fe9623e
darwin.Librpcsvc: remove and replace with stubs
reckenrode Sep 2, 2024
db40aca
darwin.Libsystem: remove and replace with stubs
reckenrode Sep 2, 2024
07272a0
darwin.Security: remove and replace with stubs
reckenrode Sep 2, 2024
fd2ae22
darwin.architecture: remove and replace with stubs
reckenrode Sep 2, 2024
ac79109
darwin.configd: remove and replace with stubs (including configdHeaders)
reckenrode Sep 2, 2024
d78b641
darwin.darwin-stubs: remove and replace with stubs
reckenrode Sep 21, 2024
ae78385
darwin.dtrace: remove and replace with stubs
reckenrode Sep 2, 2024
8a59383
darwin.dyld: remove and replace with stubs
reckenrode Sep 2, 2024
cce88cf
darwin.eap8021x: remove and replace with stubs
reckenrode Sep 2, 2024
2ade0ae
darwin.hfs: remove and replace with stubs (including hfsHeaders)
reckenrode Sep 2, 2024
1c2dde0
darwin.launchd: remove and replace with stubs
reckenrode Sep 2, 2024
eb7c5f8
darwin.libclosure: remove and replace with stubs
reckenrode Sep 2, 2024
b9005e1
darwin.libdispatch: remove and replace with stubs
reckenrode Sep 2, 2024
1afb8b5
darwin.libmalloc: remove and replace with stubs
reckenrode Sep 2, 2024
29f65b3
darwin.libplatform: remove and replace with stubs
reckenrode Sep 2, 2024
7b23be1
darwin.libpthread: remove and replace with stubs
reckenrode Sep 2, 2024
ec40b04
darwin.libunwind: improve compatibility with libunwind
reckenrode Sep 2, 2024
259c350
darwin.libunwind: remove source release
reckenrode Sep 2, 2024
4c77578
darwin.mDNSResponder: remove and replace with stubs
reckenrode Sep 2, 2024
7be27dc
darwin.objc4: remove and replace with stubs
reckenrode Sep 2, 2024
03e585a
darwin.ppp: remove and replace with stubs
reckenrode Sep 2, 2024
6b6277e
darwin.xnu: remove and replace with stubs
reckenrode Sep 2, 2024
6c6b7b0
darwin.apple-source-releases: switch to new source release pattern
reckenrode Sep 2, 2024
bdf3046
darwin.adv_cmds: 163 -> 231
reckenrode Sep 21, 2024
4854f28
darwin.AvailabilityVersions: 140.1 -> 143.3
reckenrode Sep 21, 2024
ab006b0
darwin.basic_cmds: 55 -> 70
reckenrode Sep 22, 2024
4d328d0
darwin.bootstrap_cmds: 121 -> 136
reckenrode Sep 22, 2024
d5f4ae4
darwin.copyfile: 138 -> 213
reckenrode Sep 22, 2024
82a2469
darwin.developer_cmds: 62 -> 79
reckenrode Sep 22, 2024
e0cf96b
darwin.diskdev_cmds: 593 -> 735
reckenrode Sep 22, 2024
c640ed8
darwin.doc_cmds: init at 66
reckenrode Sep 22, 2024
32f5feb
darwin.file_cmds: 264.1.1 -> 448.0.3
reckenrode Sep 22, 2024
47df058
darwin.ICU: 66108 -> 74221
reckenrode Sep 22, 2024
d3ca461
darwin.IOKitTools: init at 125
reckenrode Sep 28, 2024
1d8c6e7
darwin.libiconv: 99 -> 107
reckenrode Sep 22, 2024
9c31a3e
darwin.libpcap: init at 135
reckenrode Sep 22, 2024
fc97344
darwin.libresolv: 64 -> 83
reckenrode Sep 22, 2024
edb2497
darwin.libutil: 47.30.1 -> 72
reckenrode Sep 22, 2024
44f1fa4
darwin.mail_cmds: init at 38.0.1
reckenrode Sep 22, 2024
42daeac
darwin.misc_cmds: init at 44
reckenrode Sep 22, 2024
d293dd1
darwin.network_cmds: 606.40.2 -> 696
reckenrode Sep 22, 2024
01d1005
darwin.patch_cmds: init at 62
reckenrode Sep 22, 2024
6d0bc8c
darwin.PowerManagement: 572.50.1 -> 1740.0.7
reckenrode Sep 22, 2024
f493fb8
darwin.remote_cmds: init at 303.0.2
reckenrode Sep 22, 2024
a32fcaa
darwin.removefile: 45 -> 75
reckenrode Sep 22, 2024
7b84d89
darwin.shell_cmds: 187 -> 319.0.1
reckenrode Sep 22, 2024
72f19ad
darwin.system_cmds: 970.0.4 -> 1012
reckenrode Sep 22, 2024
63bfe3c
darwin.text_cmds: 99 -> 190.0.1
reckenrode Sep 22, 2024
7e4956a
darwin.top: 108 -> 139
reckenrode Sep 22, 2024
bafc6ff
darwin.xattr: replace with xattr from file_cmds
reckenrode Sep 7, 2024
e3f2829
xar: 498 -> 501
reckenrode Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion maintainers/team-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ with lib.maintainers;
};

darwin = {
members = [ toonn ];
members = [
reckenrode
toonn
];
githubTeams = [ "darwin-maintainers" ];
scope = "Maintain Darwin compatibility of packages and Darwin-only packages.";
shortName = "Darwin";
Expand Down
15 changes: 12 additions & 3 deletions pkgs/os-specific/darwin/apple-source-releases/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,31 @@ in
self:

let
macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage'; };
developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage'; };
macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage' callPackage; };
developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage' callPackage; };

applePackage' = namePath: version: sdkName: sha256:
let
pname = builtins.head (lib.splitString "/" namePath);
appleDerivation' = stdenv: appleDerivation'' stdenv pname version sdkName sha256;
appleDerivation = appleDerivation' stdenv;
callPackage = self.newScope { inherit appleDerivation' appleDerivation; python3 = pkgs.buildPackages.python3Minimal; };
callPackage = self.newScope {
inherit appleDerivation' appleDerivation mkAppleDerivation;
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
python3 = pkgs.buildPackages.python3Minimal;
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
};
in callPackage (./. + "/${namePath}");

applePackage = namePath: sdkName: sha256: let
pname = builtins.head (lib.splitString "/" namePath);
version = versions.${sdkName}.${pname};
in applePackage' namePath version sdkName sha256;

callPackage = self.newScope { inherit mkAppleDerivation; };

mkAppleDerivation = pkgs.callPackage ./mkAppleDerivation.nix {
inherit (pkgs.darwin) bootstrapStdenv xcodeProjectCheckHook;
};

# Only used for bootstrapping. It’s convenient because it was the last version to come with a real makefile.
adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "sha256-/OJLNpATyS31W5nWfJgSVO5itp8j55TRwG57/QLT5Fg=" {};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated using: ./generate-sdk-packages.sh developer-tools 11.3.1

{ applePackage' }:
{ applePackage', callPackage }:

{
bootstrap_cmds = applePackage' "bootstrap_cmds" "116" "developer-tools-11.3.1" "06nw99ajkd264vdi6n2zv252ppxp3wx3120hqf3jqdh6c1wavy0b" {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated using: ./generate-sdk-packages.sh macos 11.0.1

{ applePackage' }:
{ applePackage', callPackage }:

{
CommonCrypto = applePackage' "CommonCrypto" "60178.40.2" "macos-11.0.1" "129gsxhhcxqycg0zjrdrz2ay4dv2ih1ckafqh33qrc499z8dam2p" {};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
let
versions = builtins.fromJSON (builtins.readFile ./versions.json);
in

{
lib,
bootstrapStdenv,
fetchFromGitHub,
meson,
ninja,
stdenv,
stdenvNoCC,
xcodeProjectCheckHook,
}:

let
hasBasenamePrefix = prefix: file: lib.hasPrefix prefix (baseNameOf file);
in
lib.makeOverridable (
attrs:
let
attrs' = if lib.isFunction attrs then attrs else _: attrs;
attrsFixed = lib.fix attrs';
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
stdenv' =
if attrsFixed.noCC or false then
stdenvNoCC
else if attrsFixed.noBootstrap or false then
stdenv
else
bootstrapStdenv;
in
stdenv'.mkDerivation (
lib.extends (
self: super:
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
assert super ? releaseName;
let
inherit (super) releaseName;
info = versions.${releaseName};
files = lib.filesystem.listFilesRecursive (lib.path.append ./. releaseName);
mesonFiles = lib.filter (hasBasenamePrefix "meson") files;
emilazy marked this conversation as resolved.
Show resolved Hide resolved
in
# You have to have at least `meson.build.in` when using xcodeHash to trigger the Meson
# build support in `mkAppleDerivation`.
assert super ? xcodeHash -> lib.length mesonFiles > 0;
{
pname = super.pname or releaseName;
inherit (info) version;

src = super.src or fetchFromGitHub {
owner = "apple-oss-distributions";
repo = releaseName;
rev = info.rev or "${releaseName}-${info.version}";
inherit (info) hash;
};

strictDeps = true;
__structuredAttrs = true;

meta = {
homepage = "https://opensource.apple.com/releases/";
license = lib.licenses.apple-psl20;
maintainers = lib.teams.darwin.members;
platforms = lib.platforms.darwin;
} // super.meta or { };
}
// lib.optionalAttrs (super ? xcodeHash) {
postUnpack =
super.postUnpack or ""
+ lib.concatMapStrings (
file:
if baseNameOf file == "meson.build.in" then
"substitute ${lib.escapeShellArg "${file}"} \"$sourceRoot/meson.build\" --subst-var version\n"
else
"cp ${lib.escapeShellArg "${file}"} \"$sourceRoot/\"${lib.escapeShellArg (baseNameOf file)}\n"
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
) mesonFiles;

xcodeProject = super.xcodeProject or "${releaseName}.xcodeproj";

nativeBuildInputs = super.nativeBuildInputs or [ ] ++ [
meson
ninja
xcodeProjectCheckHook
];

mesonBuildType = "release";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't seem to disable asserts. need to add -Db_ndebug=if-release to the meson flags as well,

}
) attrs'
)
)
2 changes: 2 additions & 0 deletions pkgs/os-specific/darwin/apple-source-releases/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
26 changes: 26 additions & 0 deletions pkgs/os-specific/darwin/darwin-min-version-hook/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
local role_post
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
getHostRole

# Compare the requested deployment target to the existing one. The deployment target has to be a version number,
# and this hook tries to do the right thing with deployment targets set outside of it, so it has to parse
# the version numbers for the comparison manually.

local darwinMinVersion=@deploymentTarget@
local darwinMinVersionVar=@darwinMinVersionVariable@${role_post}

local currentDeploymentTargetArr
IFS=. read -a currentDeploymentTargetArr <<< "${!darwinMinVersionVar-0.0.0}"

local darwinMinVersionArr
IFS=. read -a darwinMinVersionArr <<< "$darwinMinVersion"

local currentDeploymentTarget
currentDeploymentTarget=$(printf "%02d%02d%02d" "${currentDeploymentTargetArr[0]-0}" "${currentDeploymentTargetArr[1]-0}" "${currentDeploymentTargetArr[2]-0}")

darwinMinVersion=$(printf "%02d%02d%02d" "${darwinMinVersionArr[0]-0}" "${darwinMinVersionArr[1]-0}" "${darwinMinVersionArr[2]-0}")

if [ "$darwinMinVersion" -gt "$currentDeploymentTarget" ]; then
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
export "$darwinMinVersionVar"=@deploymentTarget@
fi

unset -v role_post currentDeploymentTarget currentDeploymentTargetArr darwinMinVersion darwinMinVersionArr darwinMinVersionVar
13 changes: 13 additions & 0 deletions pkgs/os-specific/darwin/libSystem/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ stdenvNoCC }:

# Darwin dynamically determines the `libSystem` to use based on the SDK found at `DEVELOPER_DIR`.
# By default, this will be `apple-sdk` or one of the versioned variants.
stdenvNoCC.mkDerivation {
pname = "libSystem";
version = "B";

# Silence linker warnings due a missing `lib` (which is added by cc-wrapper).
buildCommand = ''
mkdir -p "$out/include" "$out/lib"
'';
}
55 changes: 55 additions & 0 deletions pkgs/os-specific/darwin/xcode-project-check-hook/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Verify that the Xcode project has not changed unexpectedly. This is only useful for source releases that are
# being built with other build systems (e.g., Meson) instead of xcbuild.

verifyXcodeProjectHash() {
printHashInstructions() {
echo '1. Set xcodeHash to an empty string: `xcodeHash = "";`'
echo '2. Build the derivation and wait for it to fail with a hash mismatch'
echo '3. Copy the "got: sha256-..." value back into the xcodeHash field'
echo ' You should have: xcodeHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";'
}

if [ -z "${xcodeHash-}" ]; then
echo "error: xcodeHash missing"
echo
echo "To fix the issue:"
printHashInstructions
exit 1
fi

if [ -z "${xcodeProject-}" ]; then
echo "error: xcodeProject missing"
echo
echo "To fix the issue: Set xcodeProject to the name of the project"
exit 1
fi

local xcodeHashArr
readarray -t -d - xcodeHashArr < <(printf "$xcodeHash")

local hashType=${xcodeHashArr[0]}
local expectedHash=${xcodeHashArr[1]}

if [ -z "$hashType" ] || [ -z "$expectedHash" ]; then
echo "error: xcodeHash is in invalid format"
echo
echo "To fix the issue:"
printHashInstructions
exit 1
fi

local hash
hash=$(openssl "$hashType" -binary "$sourceRoot/$xcodeProject/project.pbxproj" | base64)

if [ "$hash" != "$expectedHash" ]; then
echo "error: hash mismatch in $xcodeProject/project.pbxproj"
echo " specified: $xcodeHash"
echo " got: $hashType-$hash"
echo
echo 'Upstream Xcode project has changed. Update `meson.build` with any changes, then update `xcodeHash`.'
printHashInstructions
exit 1
fi
}

postUnpackHooks+=(verifyXcodeProjectHash)
12 changes: 12 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23740,6 +23740,18 @@ with pkgs;

plumed = callPackage ../development/libraries/science/chemistry/plumed { };

### DEVELOPMENT / LIBRARIES / DARWIN SDKS

darwinMinVersionHook =
deploymentTarget:
makeSetupHook {
name = "darwin-deployment-target-hook-${deploymentTarget}";
substitutions = {
darwinMinVersionVariable = lib.escapeShellArg stdenv.hostPlatform.darwinMinVersionVariable;
deploymentTarget = lib.escapeShellArg deploymentTarget;
};
} ../os-specific/darwin/darwin-min-version-hook/setup-hook.sh;

### DEVELOPMENT / LIBRARIES / AGDA

agdaPackages = callPackage ./agda-packages.nix {
Expand Down
22 changes: 22 additions & 0 deletions pkgs/top-level/darwin-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ let
};

aliases = self: super: lib.optionalAttrs config.allowAliases (import ../top-level/darwin-aliases.nix lib self super pkgs);

mkBootstrapStdenv =
stdenv:
stdenv.override (old: {
extraBuildInputs = map (
pkg:
if lib.isDerivation pkg && lib.getName pkg == "apple-sdk" then
pkg.override { enableBootstrap = true; }
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
else
pkg
) (old.extraBuildInputs or [ ]);
});
in

makeScopeWithSplicing' {
Expand Down Expand Up @@ -133,6 +145,11 @@ impure-cmds // appleSourcePackages // chooseLibs // {
bintools = self.binutils-unwrapped;
};

# Removes propagated packages from the stdenv, so those packages can be built without depending upon themselves.
bootstrapStdenv = mkBootstrapStdenv pkgs.stdenv;
toonn marked this conversation as resolved.
Show resolved Hide resolved

libSystem = callPackage ../os-specific/darwin/libSystem { };
reckenrode marked this conversation as resolved.
Show resolved Hide resolved

# TODO(@connorbaker): See https://github.com/NixOS/nixpkgs/issues/229389.
cf-private = self.apple_sdk.frameworks.CoreFoundation;

Expand Down Expand Up @@ -225,6 +242,11 @@ impure-cmds // appleSourcePackages // chooseLibs // {
setupHook = null;
});

xcodeProjectCheckHook = pkgs.makeSetupHook {
name = "xcode-project-check-hook";
propagatedBuildInputs = [ pkgs.pkgsBuildHost.openssl ];
reckenrode marked this conversation as resolved.
Show resolved Hide resolved
} ../os-specific/darwin/xcode-project-check-hook/setup-hook.sh;

# Formerly the CF attribute. Use this is you need the open source release.
swift-corelibs-foundation = callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { };

Expand Down