Darwin system built with Nix
See the code██████╗ █████╗ ██████╗ ███╗ ██╗██╗██╗ ██╗
██╔══██╗██╔══██╗██╔══██╗████╗ ██║██║╚██╗██╔╝
██║ ██║███████║██████╔╝██╔██╗ ██║██║ ╚███╔╝
██║ ██║██╔══██║██╔══██╗██║╚██╗██║██║ ██╔██╗
██████╔╝██║ ██║██║ ██║██║ ╚████║██║██╔╝ ██╗
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝

Boot a fully open-source Darwin system using Nix. One command, no macOS install required (beyond the build host).
$ nix run github:jonhermansen/darnix
Boots XNU (macOS 26.4 / xnu-12377.101.15) in QEMU with an HFS+ root filesystem and serial console — all from a single Nix flake. The entire build runs under Nix's strict sandbox (sandbox = true) — no network access, no /dev access, no DMG mounting or hdiutil, no system side effects.
Darnix is a revival of the PureDarwin idea: run Apple's open-source XNU kernel with an entirely open userland managed by Nix. The long-term goal is a NixOS-style system on a Darwin kernel.
Current status: The kernel boots in QEMU (x86_64 emulated via TCG on aarch64-darwin), mounts an HFS+ ramdisk as root, and executes a statically linked init binary with serial console output. There is no networking, no kext loading, and no userland beyond init.
darwin-xnu-build)nix run builds the kernel, assembles a GRUB EFI image with embedded ramdisk, and launches QEMUxnu)QEMU platform support:
IOQEMUPlatform) — no IOKit kexts neededignore_msrs boot arg for unimplemented MSRs under TCGMSR_PLATFORM_INFO bus ratio reads as 0Bare boot (no kexts):
PE_i_can_has_debugger on DEVELOPMENT buildsHFS+ as root filesystem:
VFC_VFSCANMOUNTROOT flag so vfs_mountroot() tries HFSbsd_init console open: FREAD|FWRITE → O_RDWR, authfd=0 → AUTH_OPEN_NOAUTHFDhfs)Apple's HFS+ ships as a kext depending on IOKit and corecrypto. We ported it to compile directly into the kernel:
hfs_init_zones() from hfs_init() (previously only called from the kext's IOKit entry point)hfs_getvoluuid() to use a fixed UUID (MD5 requires corecrypto which isn't available)newfs_hfs to format regular files, not just block devices (runs inside Nix sandbox)grub)xnu_kernel64 page fault loading 64-bit Mach-O kernelsnewfs_hfs + xpwn's hfsplus tool/sbin/launchd and /dev mountpointaarch64-darwin host
└─ nix run
└─ qemu-system-x86_64 (TCG, software emulation)
└─ GRUB EFI (grub-mkstandalone)
├─ xnu_kernel64 /boot/kernel
├─ xnu_ramdisk /boot/rootfs-hfs.dmg
└─ boot
└─ XNU boots
├─ HFS+ root on md0 (ramdisk)
├─ devfs on /dev
├─ serial console (fd 0/1/2)
└─ exec /sbin/launchd
GRUB presents two menu entries:
| Entry | Root filesystem | Description |
|---|---|---|
| Darnix (HFS+) | 8 MB HFS+ ramdisk | Real filesystem with directory hierarchy |
| Darnix (mockfs) | Raw Mach-O binary | Minimal fake FS for debugging (the ramdisk is the binary) |
# Build everything (kernel + ESP + ramdisk)
nix build .#esp
# Build and boot in QEMU
nix run
# Build just the kernel
nix build .#xnu-x86_64
| Repo | Branch | Description |
|---|---|---|
| darnix | nix | Nix flake, build scripts, init binary, QEMU runner |
| xnu | nix | Patched XNU kernel |
| hfs | nix | HFS+ ported to in-kernel build |
| grub | nix | GRUB with Mach-O fix + Nix flake |
Darnix is an independent project and is not affiliated with, endorsed by, or sponsored by Apple Inc. Apple, macOS, and related trademarks are the property of Apple Inc., registered in the U.S. and other countries. Darwin is licensed under the Apple Public Source License (APSL). All other trademarks are the property of their respective owners.
Shell
42.7%
Nix
37.0%
C
9.0%
Python
7.0%
Assembly
2.1%
HCL
1.3%
Darwin system built with Nix
See the code██████╗ █████╗ ██████╗ ███╗ ██╗██╗██╗ ██╗
██╔══██╗██╔══██╗██╔══██╗████╗ ██║██║╚██╗██╔╝
██║ ██║███████║██████╔╝██╔██╗ ██║██║ ╚███╔╝
██║ ██║██╔══██║██╔══██╗██║╚██╗██║██║ ██╔██╗
██████╔╝██║ ██║██║ ██║██║ ╚████║██║██╔╝ ██╗
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝

Boot a fully open-source Darwin system using Nix. One command, no macOS install required (beyond the build host).
$ nix run github:jonhermansen/darnix
Boots XNU (macOS 26.4 / xnu-12377.101.15) in QEMU with an HFS+ root filesystem and serial console — all from a single Nix flake. The entire build runs under Nix's strict sandbox (sandbox = true) — no network access, no /dev access, no DMG mounting or hdiutil, no system side effects.
Darnix is a revival of the PureDarwin idea: run Apple's open-source XNU kernel with an entirely open userland managed by Nix. The long-term goal is a NixOS-style system on a Darwin kernel.
Current status: The kernel boots in QEMU (x86_64 emulated via TCG on aarch64-darwin), mounts an HFS+ ramdisk as root, and executes a statically linked init binary with serial console output. There is no networking, no kext loading, and no userland beyond init.
darwin-xnu-build)nix run builds the kernel, assembles a GRUB EFI image with embedded ramdisk, and launches QEMUxnu)QEMU platform support:
IOQEMUPlatform) — no IOKit kexts neededignore_msrs boot arg for unimplemented MSRs under TCGMSR_PLATFORM_INFO bus ratio reads as 0Bare boot (no kexts):
PE_i_can_has_debugger on DEVELOPMENT buildsHFS+ as root filesystem:
VFC_VFSCANMOUNTROOT flag so vfs_mountroot() tries HFSbsd_init console open: FREAD|FWRITE → O_RDWR, authfd=0 → AUTH_OPEN_NOAUTHFDhfs)Apple's HFS+ ships as a kext depending on IOKit and corecrypto. We ported it to compile directly into the kernel:
hfs_init_zones() from hfs_init() (previously only called from the kext's IOKit entry point)hfs_getvoluuid() to use a fixed UUID (MD5 requires corecrypto which isn't available)newfs_hfs to format regular files, not just block devices (runs inside Nix sandbox)grub)xnu_kernel64 page fault loading 64-bit Mach-O kernelsnewfs_hfs + xpwn's hfsplus tool/sbin/launchd and /dev mountpointaarch64-darwin host
└─ nix run
└─ qemu-system-x86_64 (TCG, software emulation)
└─ GRUB EFI (grub-mkstandalone)
├─ xnu_kernel64 /boot/kernel
├─ xnu_ramdisk /boot/rootfs-hfs.dmg
└─ boot
└─ XNU boots
├─ HFS+ root on md0 (ramdisk)
├─ devfs on /dev
├─ serial console (fd 0/1/2)
└─ exec /sbin/launchd
GRUB presents two menu entries:
| Entry | Root filesystem | Description |
|---|---|---|
| Darnix (HFS+) | 8 MB HFS+ ramdisk | Real filesystem with directory hierarchy |
| Darnix (mockfs) | Raw Mach-O binary | Minimal fake FS for debugging (the ramdisk is the binary) |
# Build everything (kernel + ESP + ramdisk)
nix build .#esp
# Build and boot in QEMU
nix run
# Build just the kernel
nix build .#xnu-x86_64
| Repo | Branch | Description |
|---|---|---|
| darnix | nix | Nix flake, build scripts, init binary, QEMU runner |
| xnu | nix | Patched XNU kernel |
| hfs | nix | HFS+ ported to in-kernel build |
| grub | nix | GRUB with Mach-O fix + Nix flake |
Darnix is an independent project and is not affiliated with, endorsed by, or sponsored by Apple Inc. Apple, macOS, and related trademarks are the property of Apple Inc., registered in the U.S. and other countries. Darwin is licensed under the Apple Public Source License (APSL). All other trademarks are the property of their respective owners.
Shell
42.7%
Nix
37.0%
C
9.0%
Python
7.0%
Assembly
2.1%
HCL
1.3%