Skip to content

microVM guests

A microVM guest is an ordinary DNF host (zone IP, services, monitoring) running in a lightweight virtual machine, on another host of the fleet: the hypervisor. DNF relies on microvm.nix 🡕 and cloud-hypervisor. Typical use: a closed AI workspace per person or per team.

  1. Declare the host

    The microvm-guest feature names the hypervisor, from the same zone. The static IP is mandatory: the interface and MAC address are derived from it. Like any host, the guest is only monitored with the monitoring-node feature.

    etc/config.yaml
    hosts:
    - hostname: "espace1"
    zone: "maison:1.40"
    profile: "ai-space"
    features: ["microvm-guest:serveur", "monitoring-node"]
  2. Size it

    Optional, 2 vCPU and 4096 Mio by default.

    usr/machines/espace1/configuration.nix
    {
    darkone.system.microvm.guest = {
    vcpu = 4;
    mem = 6144; # Mio
    };
    }
  3. Pin the state version

    A guest never goes through just install: create the file by hand, with the NixOS version of the first deployment.

    usr/machines/espace1/install/state.nix
    { system.stateVersion = "26.05"; }
  4. Initialize its secrets

    The guest only reads its own secrets: see isolated hosts.

    Fenêtre de terminal
    just space-init espace1
  5. Deploy the hypervisor

    Fenêtre de terminal
    just generate
    just apply serveur

A guest is not a deployment target: just apply <hypervisor> builds the guests, starts the new ones and restarts those that changed. Guests start with the hypervisor.

ItemLocation
Persistent data/var/lib/microvms/<guest>/ on the hypervisor, closed to its accounts except root (0770) and mounted nosuid,nodev: a setuid file or a device created by the guest stays inert there
/persist, /var/lib, /homevirtiofs shares of this folder
Root /In memory, wiped at each boot
Nix storeThe hypervisor’s one in read-only, plus an in-memory layer for what the guest installs (nix shell, Home Manager), wiped at each boot

Each guest has its own interface vm-X-Y, routed as a /32 by the hypervisor, which answers for it on the LAN (ARP proxy), without a bridge. The hypervisor runs systemd-networkd, with DNS set to the zone gateway : it cannot be that gateway, nor a host running NetworkManager.

FlowAllowed
Guest → InternetYes
Guest → Gateway DNSYes
Guest → LAN, tailnet, other guestsNo
Guest → hypervisorTranscription only, if requested
Gateway → guestYes (proxy, supervision)
Other host → guestPing and SSH only

Like any host, from an administration workstation: just enter <guest>. Its name is published by the gateways’ DNS, which must therefore be redeployed after adding the guest.

No: the guest reads this store through an overlay layer, which returns Stale file handle when a file read becomes a hard link. DNF therefore does not run nix-store --optimise (the GC stays active); done manually, restart the guests.

The hypervisor hosts a whisper.cpp 🡕 server, started and opened only for the guests that request it (voice notes from an AI space). Nothing to declare ; darkone.system.microvm.whisper.model (default large-v3-turbo) and .threads (default 8) configure it.

Remove it from etc/config.yaml, deploy the hypervisor, then delete /var/lib/microvms/<guest>/ on the hypervisor.