Nix for Plan 9, tested on 9front. Build packages natively with nix-build,
evaluate expressions with nix-instantiate, or cross-compile on Linux.
Package environments and machine configurations support retained generations
and rollback. Describe a machine with mkSystem, or use mkInstallation to
connect machines through NDB, file exports, session mounts and remote CPU services.
Use nix9-rebuild for local builds, switching and rollback. Use nix9 for
machine identity, prebuilt systems, inspection and installation deployment.
The port is experimental. Native builds have no full sandbox, and the modern
nix CLI and flakes are unavailable in the guest.
Use x86_64 Linux with Nix flakes enabled. Your user and Nix builders need access
to /dev/kvm. Run host commands from the checkout.
The flake includes nix9.cachix.org as an optional binary cache to save build time.
A trusted cache can supply modified outputs, so only use it if you trust me.
On the host, prepare the VM and serve the bootstrap:
nix build .#vm-image -o result-vm
nix build .#native-bootstrap -o result-native-bootstrap
nix run .#setup-vm
nix develop -c python -m http.server 8000 --bind 127.0.0.1Leave the server running. In another terminal, run nix run .#run-vm.
Press Enter at the boot arguments and user prompts, then wait for term%.
A missing-display message from rio is expected. In the guest:
ip/ipconfig ether /net/ether0
cd / && hget http://10.0.2.2:8000/result-native-bootstrap | tar x
. /usr/local/pkg/nix9/activate
nix-build $nix9/packages -A fortune
result=`{cat /usr/local/nix/state/gcroots/result}
$result/bin/fortuneRun fshalt before stopping QEMU with Ctrl-C. Keep result-vm to retain the
disk's backing image. See VM details for later boots, other disks
and a C development example.
To connect auth, file and CPU servers, follow the
development installation walkthrough.
To try that installation in a persistent four-machine VM lab, run
nix run .#lab; see the lab guide.
| Guide | Contents |
|---|---|
| VM details | Native development, persistent disks and package archives. |
| Native Nix | Builds, environments, updates, releases and store maintenance. |
| Package development | Toolchains, recipes, development shells and native Go. |
| System configuration | Machine settings, switching, rollback and boot hooks. |
| Set up an installation | Provision the four-machine development example, boot it and start using it. |
| Installation inventory | Machines, shared discovery, provider references and system closures. |
| Users and groups | Native file-server identities, shared homes, group membership and authentication prerequisites. |
| Deployment | Inspect an installation, prepare systems and shared roots, select machines and check status. |
| Services | Ethernet, clocks, logging, webfs, remote CPU access and scheduled jobs. |
| Service discovery | NDB records, service locations and native cs/DNS. |
| DHCP | NDB reservations, dynamic pools and persistent leases. |
| Session namespaces | Ordered bindings and union directories across local files and shared providers. |
| Network server | Use a lab network from terminal and CPU sessions through authenticated 9P. |
| Storage and recovery | Dedicated CWFS storage, shared workspaces and recovery from dump history. |
| Backups | Scheduled archives on a separate server and recovery onto replacement storage. |
| Remote builders | Schedule Nix builds on CPU servers and return results to the terminal. |
| Rio, Acme and plumbing | Native startup configuration, shared projects and remote builds. |
| Network-root CPUs | Boot CPUs from shared OS files with separate writable Nix state. |
| PXE network boot | Fetch CPU kernels and settings over TFTP; select and roll back their next boot. |
| Shared root versions | Publish OS userland, upgrade individual CPUs and return to an earlier root. |
| Downloads and caches | HTTPS trust, source fetches, closure transfers and signed caches. |
| Tests | Test commands, coverage and benchmarks. |
| Limitations | Port constraints and missing features. |
| Upstream patches | Patch ownership and removal criteria. |