Templates
Templates are reusable microVM images built from Nix flakes. Build once, run anywhere. Share via an S3-compatible registry.
Scaffold a Template
Section titled “Scaffold a Template”mvmctl template init my-service --localCreates a minimal directory:
my-service/├── flake.nix # Nix flake via mkGuest├── .gitignore└── README.mdFrom an Existing Flake
Section titled “From an Existing Flake”If you already have a Nix flake, register it directly:
mvmctl template create openclaw --flake ../openclaw --profile minimal --role workermvmctl template build openclawAll flags have defaults: --flake ., --profile default, --role worker, --cpus 2, --mem 1024. Local flake paths are resolved to absolute paths at creation time.
mvmctl template build my-servicemvmctl template build my-service --force # Rebuild even if cachedBuilds run nix build inside the Lima VM to produce kernel + rootfs artifacts.
Snapshots
Section titled “Snapshots”Build with --snapshot to capture a fully booted, healthy VM state. Subsequent runs restore from this snapshot instead of cold-booting — sub-second startup instead of minutes.
# Build + snapshot (one-time, waits for all services to be healthy)mvmctl template build my-service --snapshot
# Every subsequent run auto-detects the snapshot and restores instantly:mvmctl run --template my-service --name svcThe snapshot process:
- Builds the template normally (
nix build) - Boots a temporary VM from the built artifacts
- Waits for the guest agent to respond (health check)
- Waits for all integrations to report healthy (e.g., gateway listening)
- Pauses vCPUs and captures a full Firecracker snapshot (
vmstate.bin+mem.bin) - Stores the snapshot alongside the template revision
No flags are needed on run — snapshot detection is automatic. If a template has a snapshot, it’s used; otherwise the VM cold-boots.
Share via Registry
Section titled “Share via Registry”Push and pull templates to S3-compatible storage:
mvmctl template push my-servicemvmctl template pull my-servicemvmctl template verify my-service # Verify checksumsConfigure the registry with environment variables:
export MVM_TEMPLATE_REGISTRY_ENDPOINT="https://s3.amazonaws.com"export MVM_TEMPLATE_REGISTRY_BUCKET="mvm-templates"export MVM_TEMPLATE_REGISTRY_ACCESS_KEY_ID="..."export MVM_TEMPLATE_REGISTRY_SECRET_ACCESS_KEY="..."Multiple Roles
Section titled “Multiple Roles”Create templates for multiple roles at once:
mvmctl template create-multi my-app --flake . --roles worker,gatewaymvmctl template build my-app-gatewaymvmctl template build my-app-workerUpdate an existing template’s configuration:
# Increase memory for an existing templatemvmctl template edit openclaw --mem 2048
# Update multiple settings at oncemvmctl template edit my-service --cpus 4 --mem 4096
# Change the flake referencemvmctl template edit my-service --flake /new/pathAfter editing, rebuild the template for changes to take effect:
mvmctl template build my-service --forceAvailable edit options:
--flake- Update the Nix flake reference--profile- Change the flake package variant--role- Update the VM role (worker, gateway)--cpus- Change vCPU count--mem- Update memory in MiB--data-disk- Change data disk size in MiB
Manage
Section titled “Manage”mvmctl template list # List all templatesmvmctl template info my-service # Show details + revisionsmvmctl template edit my-service --mem 2048 # Edit template settingsmvmctl template delete my-service # Remove a template