NixOS MicroVMs
See the code
Handbook:
HTML
Markdown
•
Matrix chat
•
Changelog
•
A Nix Flake to build NixOS and run it on one of several Type-2
Hypervisors on NixOS/Linux or macOS. The project is intended to provide a more
isolated alternative to nixos-container. You can either build and
run MicroVMs like Nix packages, or alternatively install them as
systemd services declaratively in your host's Nix Flake or
imperatively with the provided microvm command.
microvm-balloon/nix/store or by mounting the host's along with an optional
writable overlay. This filesystem can be built as either squashfs
(smaller) or erofs (faster).nixosConfigurations
section, reusing the nixosModules that are exported by this Flake.qemu, kvmtool, and vfkit also support user
networking which requires no additional setup on the host.qemu, enable tap.vhost = true
to use vhost-net kernel acceleration (~10 Gbps vs ~1.5 Gbps without).| Hypervisor | Language | Restrictions |
|---|---|---|
| qemu | C | |
| cloud-hypervisor | Rust | no 9p shares |
| firecracker | Rust | no 9p/virtiofs shares |
| crosvm | Rust | 9p shares broken |
| kvmtool | C | no virtiofs shares, no control socket |
| stratovirt | Rust | no 9p shares, no control socket |
| alioth | Rust | no 9p shares, no control socket |
| vfkit | Go | macOS only, no 9p shares, no tap/bridge networking |
We aim to support the currently supported Nixpkgs/NixOS releases - nixos-unstable and the current stable release. Currently there are no releases being tagged, but we run Gradient CI to ensure compatibility and we recommend to consume the repo from the default branch via flakes.
nix registry add microvm github:microvm-nix/microvm.nix
(If you do not want to inflict this change on your system, just
replace microvm with github:microvm-nix/microvm.nix in the following
examples.)
nix flake init -t microvm
$EDITOR flake.nix
nix run .#my-microvm
nix run microvm#qemu-example
nix run microvm#firecracker-example
nix run microvm#cloud-hypervisor-example
nix run microvm#crosvm-example
nix run microvm#kvmtool-example
nix run microvm#stratovirt-example
# On macOS only:
nix run microvm#vfkit-example
nix run microvm#vm
Check networkctl status virbr0 for the DHCP leases of the nested
MicroVMs. They listen for ssh with an empty root password.
On Linux with cloud-hypervisor and Wayland forwarding:
nix run microvm#graphics neverball
On macOS with vfkit, enable graphics with microvm.graphics.enable = true.
Accelerate your operations and secure your infrastructure with support from a team of virtualization experts. Contact Cyberus Technology: https://www.cyberus-technology.de/contact
Looking for help or customization?
Get in touch with Numtide to get a quote. We make it easy for companies to work with Open Source projects: https://numtide.com/contact
(top 24 of 245)
2,589 followers · starred Aug 2025
349 followers · starred Oct 2024
619 followers · starred Jul 2025
556 followers · starred Mar 2023
NixOS MicroVMs
See the code
Handbook:
HTML
Markdown
•
Matrix chat
•
Changelog
•
A Nix Flake to build NixOS and run it on one of several Type-2
Hypervisors on NixOS/Linux or macOS. The project is intended to provide a more
isolated alternative to nixos-container. You can either build and
run MicroVMs like Nix packages, or alternatively install them as
systemd services declaratively in your host's Nix Flake or
imperatively with the provided microvm command.
microvm-balloon/nix/store or by mounting the host's along with an optional
writable overlay. This filesystem can be built as either squashfs
(smaller) or erofs (faster).nixosConfigurations
section, reusing the nixosModules that are exported by this Flake.qemu, kvmtool, and vfkit also support user
networking which requires no additional setup on the host.qemu, enable tap.vhost = true
to use vhost-net kernel acceleration (~10 Gbps vs ~1.5 Gbps without).| Hypervisor | Language | Restrictions |
|---|---|---|
| qemu | C | |
| cloud-hypervisor | Rust | no 9p shares |
| firecracker | Rust | no 9p/virtiofs shares |
| crosvm | Rust | 9p shares broken |
| kvmtool | C | no virtiofs shares, no control socket |
| stratovirt | Rust | no 9p shares, no control socket |
| alioth | Rust | no 9p shares, no control socket |
| vfkit | Go | macOS only, no 9p shares, no tap/bridge networking |
We aim to support the currently supported Nixpkgs/NixOS releases - nixos-unstable and the current stable release. Currently there are no releases being tagged, but we run Gradient CI to ensure compatibility and we recommend to consume the repo from the default branch via flakes.
nix registry add microvm github:microvm-nix/microvm.nix
(If you do not want to inflict this change on your system, just
replace microvm with github:microvm-nix/microvm.nix in the following
examples.)
nix flake init -t microvm
$EDITOR flake.nix
nix run .#my-microvm
nix run microvm#qemu-example
nix run microvm#firecracker-example
nix run microvm#cloud-hypervisor-example
nix run microvm#crosvm-example
nix run microvm#kvmtool-example
nix run microvm#stratovirt-example
# On macOS only:
nix run microvm#vfkit-example
nix run microvm#vm
Check networkctl status virbr0 for the DHCP leases of the nested
MicroVMs. They listen for ssh with an empty root password.
On Linux with cloud-hypervisor and Wayland forwarding:
nix run microvm#graphics neverball
On macOS with vfkit, enable graphics with microvm.graphics.enable = true.
Accelerate your operations and secure your infrastructure with support from a team of virtualization experts. Contact Cyberus Technology: https://www.cyberus-technology.de/contact
Looking for help or customization?
Get in touch with Numtide to get a quote. We make it easy for companies to work with Open Source projects: https://numtide.com/contact
(top 24 of 245)
2,589 followers · starred Aug 2025
349 followers · starred Oct 2024
619 followers · starred Jul 2025
556 followers · starred Mar 2023