
Hi all,
I’d like to share Darnix, a project exploring whether Nix can manage an entire Darwin system declaratively, starting from the kernel.
Apple has shipped the source for XNU and the Darwin OS layer since 1999. A project called PureDarwin (https://www.puredarwin.org/) tried to turn those sources into a standalone OS, but it stalled. Building XNU outside Apple’s environment is painful, and there was never a good story for managing the userland.
Nix solves that second problem. Darnix builds and boots XNU entirely from a flake. nix run builds the kernel, assembles a GRUB EFI image with an HFS+ ramdisk, and launches QEMU with a serial console. The build runs fully sandboxed. No root, no volume mounting, no device access, no network. Pure inputs, pure outputs.
nix run github:jonhermansen/darnix
It’s early. The kernel boots, mounts HFS+ as root, and runs a single static binary as pid 1. There’s no shell, no networking, and no kexts. But XNU is alive and responding to syscalls, and the whole path from source to boot is a Nix expression.
The plan is to get a shell running (toybox), start layering Nix-managed packages on top, and see how far we can take it toward a declarative Darwin system. Whether that’s practical is an open question, but the kernel boots and the foundation is reproducible.
Technical details and the full list of patches are in the README: https://github.com/jonhermansen/darnix
Would love to hear from anyone who’s thought about this space.
Darnix is an independent project and is not affiliated with, endorsed by, or sponsored by Apple Inc. This is not macOS. Apple, macOS, and related trademarks are the property of Apple Inc. Darwin is licensed under the Apple Public Source License (APSL). No warranties of any kind are provided. All other trademarks are the property of their respective owners.