Nix 🖤 macOS Monthly

July 2023

The stdenv LLVM bump is progressing. Shout-outs to @reckenrode and everyone chipping in!

I’ve continued splitting the SDK bump into smaller branches. One snag has been bumping the SDK itself, which dtrace depends on (in later versions we might be able to drop that dependency again), leading to a bit of a circular dependency situation because the SDK requires the stdenv and part of the stdenv requires the SDK.


September 2023

The stdenv LLVM bump is still in need of more reviews. @reckenrode is also working on fixing cross-compilation from aarch64-darwin to x86_64-darwin.

All the dependencies of the bootstrap-tools are split into branches. The other source releases should be buildable against the new bootstrap-tools and avoid a needless rebuild later. I have a patch for issue #150655, however, it makes the binutils build fail and that’s pretty low down in the dependency chain and I’ve been focusing on the prerequisite PRs for the LLVM bump instead. I’m also trying to add the Compression framework to the SDKs, which is needed for newer system_cmds, but running into needing newer darwin-stubs. Either those need a new release or we can switch to fetching the repo instead.


A bit of extra context for the system_cmds update: what I’m trying to do is see just how new we can go since the _cmds packages aren’t actually shipped with a particular SDK release. I’ve got most of system_cmds 970.0.4 building, which is the release corresponding to macOS 14 (but using the default SDKs in nixpkgs). After that, I want to look at the other releases.

I’m also replacing the build systems with Meson. Some of the packages try to use Apple’s Xcode projects while others have a custom build phase. Apple keeps changing the structure of things, and xcbuild is no longer maintained anyway, so I gave up on trying to make it work.


October 2023

The stdenv LLVM bump was merged. It introduced some issues but they’re being addressed. The cross-compilation PR is still open, but, currently fixes required due to the bump are prioritized.

The patch for issue #150655 broke the binutils build because of unused argument warnings, which cause its configure script to misdetect the presence of standard library headers. I’m still looking into the linker-side of things, the current patch only addresses the compiler-side. I will also continue with the Compression framework, to unblock newer system_cmds and then the stdenv work.


I would also like to mention two things: #265103 and overrideSDK.

The first PR will make CoreFoundation the default over the open-source CF on x86_64-darwin. It is planned for the next staging cycle. The change is being made due to compatibility issues on macOS 14 (possibly due to CorrFoundation hardening).

overrideSDK is a replacement for the apple_sdk_11_0.callPackage pattern. It takes a stdenv and an SDK version string, and it provides an adapted stdenv that uses frameworks from the requested SDK including propagated ones. It also ensures that a compatible xcbuild is used. overrideSDK can also be used to change the deployment target (in addition to the SDK version or just that).

overrideSDK is currently in staging-next and gaining features as needed. Once additional SDKs are introduced and the SDK hierarchy is standardized, it will be updated to support using SDK-specific libraries (such as simd).


The CoreFoundation PR was merged today as part of the merge of stage into staging-next (and the restart of builds). Most of the existing CF-centric stuff (hooks, etc) was left in place (in case the PR needs to be reverted but also to keep the change small), but I expect it will be cleaned up and removed for 24.05.


November 2023

Progress on the cc-wrapper fixes is slow, the large rebuilds make it hard to iterate. The Compression framework bump is currently stuck on a problem with the OpenDirectory framework.

I’ve opened an overview issue for the first source release bumps. The intent is to introduce the new source releases alongside the old ones to enable review in small units and then switch over when everything’s merged. I’ve left the PRs in draft for now in case we can come up with a better way than the nested attribute set in the source releases expression.


Have you considered using ccache?

Is it possible to open a draft PR to start getting feedback and enable others to be able to help build and test?

Also, FYI, there’s also another attempt at fixing it at: cc-wrapper: Enter C++ mode when -lc++ is passed by judofyr · Pull Request #269694 · NixOS/nixpkgs · GitHub.

Once the checks pass, I’ll be merging #296231 into staging. This PR updates system_cmds to 970.0.4 on both aarch64-darwin and x86_64-darwin. This version corresponds to the system_cmds in macOS 14, but they are built with the default SDKs and should work on older systems. Five binaries were lost in the update:

  • makekey - removed upstream
  • login - requires entitlements and non-public headers
  • sadc - removed upstream
  • sar - removed upstream
  • zprint - requires IOKitUser framework that isn’t packaged

Several more were added:

  • arch (aarch64-darwin only)
  • chpass
  • cpuctl
  • dynamic_pager
  • iosim
  • kpgo
  • ltop
  • memory_pressure
  • mslutil (aarch64-darwin only)
  • pagesize
  • passwd
  • proc_uuid_policy
  • purge
  • stackshot (aarch64-darwin only)
  • taskpolicy (aarch64-darwin only)
  • vm_purgeable_stat (aarch64-darwin only)
  • wait4path
  • wordexp-helper
  • zlog (aarch64-darwin only)

The aarch64-darwin only ones are due to the default SDK. If you override the SDK, they should build and work on x86_64-darwin. The following will also be available with the 12.0 SDK (once available):

  • lskq
  • lsmp
  • reboot - if/when IOKitUser framework is added
  • shutdown - if/when IOKitUser framework is added

Assuming no further issues are found, this should provide a template for other updates (particularly, using Meson with a vendored instead of xcbuild).

Edit: It’s been merged into staging.