The Nix flake
flake.nix is the entry point for everything. It is large, and it is generated by hand
rather than by a framework, so this page is a map rather than a reference.
Inputs
| Input | What it provides |
|---|---|
nixpkgs (nixos-26.05) | The host side: build tools, unmodified upstream sources that ports reuse |
iig-tools | iig, Apple’s IOKit interface generator, needed to build modern kexts |
kc-tools | kc-builder and prelink-builder, which link kernel collections |
xnu-loader | The UEFI bootloader that loads the kernel collection |
The last three are PureDarwin repositories. When you are changing one of them alongside
the main tree, use --override-input, and remember that a build may need the override
on more than one input at once.
How the outputs are put together
mkSystem is evaluated per system and composes four package sets:
packages = commonPackages // arm64Packages // probePackages
// (linuxPackages, only when the host is Linux)
linuxPackages is where images, kernel collections and runner apps live, which is why a
macOS host builds components, the kernel and libSystem included, but no bootable output.
The supporting files:
| File | Role |
|---|---|
build.nix | The single generic derivation that builds the in-tree CMake sources |
image.nix | Assembles a partitioned, bootable disk image |
nix/sources.nix | Pins the component source trees |
nix/image-contents.nix | Decides what goes into each image flavour; defines the runners |
nix/arm64.nix | The arm64 and armv6 kernels, kexts and userland |
nix/lib/kc-kexts.nix | The shared x86_64 kernel collection kext list |
nix/lib/target-info.nix | Maps a target triple to meson and clang settings |
nix/pkgs/** | Every ported third-party package |
Package naming
- A bare name is the x86_64 build:
kernel,kexts,userland,zsh,mesa. -arm64is the arm64 build of the same thing:kernel-arm64,zsh-arm64.-arm32or-armv6is the 32-bit ARM build:kernel-arm32-bcm2835.- A board suffix pins a machine:
-virt,-t8010,-bcm2837,-bcm2835. -debugis the DEVELOPMENT kernel configuration, or a debug image built on it.
So kc-arm64-t8010-debug is the debug kernel collection for the iPad 6 target, and
image-minimal-debug is the small x86_64 image built against the debug kernel.
nix flake show prints the full list. It is long; there are several hundred outputs.
Apps
Apps are the QEMU runners. nix run .#vm, .#kvm, .#arm64-virt, .#arm64-uefi,
.#arm64-uboot. They are documented in Running in QEMU.
The dev shell
nix develop gives you the toolchain, the cached native ld, migcom and unifdef,
and sets CMAKE_TOOLCHAIN_FILE to cmake/nix-toolchain.cmake. devShells.kernel and
devShells.default are the same shell.
The shell is for iterating on a component while you work on it. It is not a supported way to produce a system; see The CMake tree.