Conventions between MicroVM packages and the host

This section describes the interface that is used to run MicroVM packages with the flake's host module. While the microvm.nix flake was designed for single-server usage, you can build different MicroVM deployments using the information on this page.

nixosModule.microvm optionMicroVM package filenixosModules.host systemd serviceDescription
microvm.hypervisorbin/microvm-runmicrovm@.serviceStart script for the main MicroVM process
microvm.hypervisorbin/microvm-shutdownmicrovm@.serviceScript for graceful shutdown of the MicroVM (i.e. triggering the power button)
microvm.interfaces.*.idshare/microvm/tap-interfacesmicrovm-tap-interfaces@.serviceNames of the tap network interfaces to setup for the proper user
microvm.devices.*.pathshare/microvm/pci-devicesmicrovm-pci-devices@.servicePCI devices that must be bound to the vfio-pci driver on the host
microvm.shares.*.sourceshare/microvm/virtiofs/${tag}/sourcemicrovm-virtiofsd@.serviceSource directory of a virtiofs instance by tag
microvm.shares.*.socketshare/microvm/virtiofs/${tag}/socketmicrovm-virtiofsd@.servicevirtiofsd socket path by tag
share/microvm/systemconfig.system.build.toplevel symlink, used for comparing versions when running microvm -l

Generating custom operating system hypervisor packages

Because a microvm.nix runner package completely defines how to run the Hypervisor, it is possible to define independent packages that virtualize other operating systems than NixOS.

  • Your NixOS configurations should export their runner package as config.microvm.declaredRunner so that it can be picked up either as declarative MicroVMs or by the microvm command.

  • The runner package must have a file layout as described in the table above.

microvm-solo5-spt is an example of a Flake that can run on a microvm.nix host.