From be2fb2187ddeb58a0d16a3d3ded2347764317f33 Mon Sep 17 00:00:00 2001
From: astro microvm.b
0
Declared by:
What CPU to emulate, if any. If different from the host @@ -251,7 +251,7 @@
null
Declared by:
Extra arguments to pass to crosvm.
@@ -261,7 +261,7 @@Declared by:
A Hypervisor’s sandbox directory
@@ -271,7 +271,7 @@Declared by:
Generated Hypervisor declared by config.microvm.hypervisor
"config.microvm.runner.${config.microvm.hypervisor}"
Declared by:
PCI/USB devices that are passed from the host to the MicroVM
@@ -304,7 +304,7 @@Declared by:
Device is either on the pci
or the usb
bus
Declared by:
Identification of the device on its bus
@@ -320,7 +320,7 @@Declared by:
When using the SLiRP user networking (default), this option allows to @@ -349,7 +349,7 @@
Declared by:
Controls the direction in which the ports are mapped:
@@ -369,7 +369,7 @@The IPv4 address on the guest VLAN.
@@ -379,7 +379,7 @@The guest port to be mapped.
@@ -387,7 +387,7 @@The IPv4 address of the host.
@@ -397,7 +397,7 @@The host port to be mapped.
@@ -405,7 +405,7 @@The protocol to forward.
@@ -415,7 +415,7 @@Enable GUI support.
@@ -431,7 +431,7 @@false
Declared by:
Path of vhost-user socket
@@ -441,7 +441,7 @@"$HOSTNAME-gpu.sock"
Declared by:
Whether to enable the microvm.nix guest module at all.
@@ -451,7 +451,7 @@true
Declared by:
Whether to use hugepages as memory backend. @@ -462,7 +462,7 @@
false
Declared by:
Which hypervisor to use for this MicroVM
@@ -473,7 +473,7 @@"qemu"
Declared by:
Path to the initrd file in the initrd package
@@ -483,7 +483,7 @@"${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"
Declared by:
Network interfaces
@@ -493,7 +493,7 @@[ ]
Declared by:
Attach network interface to host bridge interface for type = “bridge”
@@ -503,7 +503,7 @@Interface name on the host
@@ -511,7 +511,7 @@Declared by:
MAC address of the guest’s network interface
@@ -519,7 +519,7 @@Declared by:
Attach network interface to host interface for type = “macvlan”
@@ -529,7 +529,7 @@The MACVLAN mode to use
@@ -539,7 +539,7 @@Interface type
@@ -547,7 +547,7 @@Declared by:
Kernel package to use for MicroVM runners
@@ -557,7 +557,7 @@Declared by:
Includes boot.kernelParams but doesn’t end up in toplevel, thereby allowing references to toplevel
@@ -565,7 +565,7 @@Declared by:
Amount of RAM in megabytes
@@ -575,7 +575,7 @@512
Declared by:
Commands to run before starting the hypervisor
@@ -585,7 +585,7 @@""
Declared by:
Set a recognizable process name right before executing the Hyperisor.
@@ -595,7 +595,7 @@Declared by:
Extra arguments to pass to qemu.
@@ -605,7 +605,7 @@[ ]
Declared by:
Whether to enable the virtual serial console on qemu.
@@ -615,7 +615,7 @@Generated Hypervisor runner for this NixOS
@@ -623,7 +623,7 @@Declared by:
Shared directory trees
@@ -633,7 +633,7 @@Declared by:
Where to mount the share inside the container
@@ -641,7 +641,7 @@Protocol for this share
@@ -651,7 +651,7 @@"9p"
Declared by:
Socket for communication with virtiofs daemon
@@ -661,7 +661,7 @@null
Declared by:
Path to shared directory tree
@@ -669,7 +669,7 @@Declared by:
Unique virtiofs daemon tag
@@ -677,7 +677,7 @@Declared by:
Hypervisor control socket path
@@ -687,7 +687,7 @@Declared by:
Whether to boot with the storeDisk, that is, unless the host’s /nix/store is a microvm.share.
@@ -697,7 +697,7 @@true
Declared by:
User to switch to when started as root
@@ -707,7 +707,7 @@null
Declared by:
Number of virtual CPU cores
@@ -717,7 +717,7 @@1
Declared by:
Disk images
@@ -727,7 +727,7 @@[ ]
Declared by:
Created image on host automatically before start?
@@ -737,7 +737,7 @@File system for automatic creation and mounting
@@ -747,7 +747,7 @@"ext4"
Declared by:
Path to disk image on the host
@@ -755,7 +755,7 @@Declared by:
Label of the volume, if any. Only applicable if autoCreate is true; otherwise labeling of the volume must be done manually
@@ -765,7 +765,7 @@null
Declared by:
If and where to mount the volume inside the container
@@ -773,7 +773,7 @@Volume size if created automatically
@@ -781,7 +781,7 @@Declared by:
Virtual Machine address; @@ -798,7 +798,7 @@
null
Declared by:
Path to the writable /nix/store overlay.
@@ -817,7 +817,7 @@0
Declared by:
What CPU to emulate, if any. If different from the host @@ -546,7 +546,7 @@
null
Declared by:
Extra arguments to pass to crosvm.
@@ -556,7 +556,7 @@Declared by:
A Hypervisor’s sandbox directory
@@ -566,7 +566,7 @@Declared by:
Generated Hypervisor declared by config.microvm.hypervisor
"config.microvm.runner.${config.microvm.hypervisor}"
Declared by:
PCI/USB devices that are passed from the host to the MicroVM
@@ -599,7 +599,7 @@Declared by:
Device is either on the pci
or the usb
bus
Declared by:
Identification of the device on its bus
@@ -615,7 +615,7 @@Declared by:
When using the SLiRP user networking (default), this option allows to @@ -644,7 +644,7 @@
Declared by:
Controls the direction in which the ports are mapped:
@@ -664,7 +664,7 @@The IPv4 address on the guest VLAN.
@@ -674,7 +674,7 @@The guest port to be mapped.
@@ -682,7 +682,7 @@The IPv4 address of the host.
@@ -692,7 +692,7 @@The host port to be mapped.
@@ -700,7 +700,7 @@The protocol to forward.
@@ -710,7 +710,7 @@Enable GUI support.
@@ -726,7 +726,7 @@false
Declared by:
Path of vhost-user socket
@@ -736,7 +736,7 @@"$HOSTNAME-gpu.sock"
Declared by:
Whether to enable the microvm.nix guest module at all.
@@ -746,7 +746,7 @@true
Declared by:
Whether to use hugepages as memory backend. @@ -757,7 +757,7 @@
false
Declared by:
Which hypervisor to use for this MicroVM
@@ -768,7 +768,7 @@"qemu"
Declared by:
Path to the initrd file in the initrd package
@@ -778,7 +778,7 @@"${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"
Declared by:
Network interfaces
@@ -788,7 +788,7 @@[ ]
Declared by:
Attach network interface to host bridge interface for type = “bridge”
@@ -798,7 +798,7 @@Interface name on the host
@@ -806,7 +806,7 @@Declared by:
MAC address of the guest’s network interface
@@ -814,7 +814,7 @@Declared by:
Attach network interface to host interface for type = “macvlan”
@@ -824,7 +824,7 @@The MACVLAN mode to use
@@ -834,7 +834,7 @@Interface type
@@ -842,7 +842,7 @@Declared by:
Kernel package to use for MicroVM runners
@@ -852,7 +852,7 @@Declared by:
Includes boot.kernelParams but doesn’t end up in toplevel, thereby allowing references to toplevel
@@ -860,7 +860,7 @@Declared by:
Amount of RAM in megabytes
@@ -870,7 +870,7 @@512
Declared by:
Commands to run before starting the hypervisor
@@ -880,7 +880,7 @@""
Declared by:
Set a recognizable process name right before executing the Hyperisor.
@@ -890,7 +890,7 @@Declared by:
Extra arguments to pass to qemu.
@@ -900,7 +900,7 @@[ ]
Declared by:
Whether to enable the virtual serial console on qemu.
@@ -910,7 +910,7 @@Generated Hypervisor runner for this NixOS
@@ -918,7 +918,7 @@Declared by:
Shared directory trees
@@ -928,7 +928,7 @@Declared by:
Where to mount the share inside the container
@@ -936,7 +936,7 @@Protocol for this share
@@ -946,7 +946,7 @@"9p"
Declared by:
Socket for communication with virtiofs daemon
@@ -956,7 +956,7 @@null
Declared by:
Path to shared directory tree
@@ -964,7 +964,7 @@Declared by:
Unique virtiofs daemon tag
@@ -972,7 +972,7 @@Declared by:
Hypervisor control socket path
@@ -982,7 +982,7 @@Declared by:
Whether to boot with the storeDisk, that is, unless the host’s /nix/store is a microvm.share.
@@ -992,7 +992,7 @@true
Declared by:
User to switch to when started as root
@@ -1002,7 +1002,7 @@null
Declared by:
Number of virtual CPU cores
@@ -1012,7 +1012,7 @@1
Declared by:
Disk images
@@ -1022,7 +1022,7 @@[ ]
Declared by:
Created image on host automatically before start?
@@ -1032,7 +1032,7 @@File system for automatic creation and mounting
@@ -1042,7 +1042,7 @@"ext4"
Declared by:
Path to disk image on the host
@@ -1050,7 +1050,7 @@Declared by:
Label of the volume, if any. Only applicable if autoCreate is true; otherwise labeling of the volume must be done manually
@@ -1060,7 +1060,7 @@null
Declared by:
If and where to mount the volume inside the container
@@ -1068,7 +1068,7 @@Volume size if created automatically
@@ -1076,7 +1076,7 @@Declared by:
Virtual Machine address; @@ -1093,7 +1093,7 @@
null
Declared by:
Path to the writable /nix/store overlay.
@@ -1112,7 +1112,7 @@Quickly running a MicroVM interactively is great for testing. You get
diff --git a/searchindex.js b/searchindex.js
index 48417831..67cded8f 100644
--- a/searchindex.js
+++ b/searchindex.js
@@ -1 +1 @@
-Object.assign(window.search, {"doc_urls":["intro.html#intro","intro.html#compartmentalization","intro.html#the-case-against-containers","intro.html#just-virtual-machines","declaring.html#declaring-nixos-microvms","declaring.html#the-microvm-module","options.html#configuration-options","interfaces.html#network-interfaces","interfaces.html#type--user","interfaces.html#type--tap","interfaces.html#type--macvtap","interfaces.html#type--bridge","shares.html#shares","shares.html#sharing-a-hosts-nixstore","shares.html#writable-nixstore-overlay","cpu-emulation.html#cpu-emulation","cpu-emulation.html#defining-an-emulated-nixos-system","output-options.html#microvm-output-options","output-options.html#configure-microvmhypervisor-use-microvmdeclaredrunner","microvm-options.html#_moduleargs","microvm-options.html#microvmballoonmem","microvm-options.html#microvmcpu","microvm-options.html#microvmcrosvmextraargs","microvm-options.html#microvmcrosvmpivotroot","microvm-options.html#microvmdeclaredrunner","microvm-options.html#microvmdevices","microvm-options.html#microvmdevicesbus","microvm-options.html#microvmdevicespath","microvm-options.html#microvmforwardports","microvm-options.html#microvmforwardportsfrom","microvm-options.html#microvmforwardportsguestaddress","microvm-options.html#microvmforwardportsguestport","microvm-options.html#microvmforwardportshostaddress","microvm-options.html#microvmforwardportshostport","microvm-options.html#microvmforwardportsproto","microvm-options.html#microvmgraphicsenable","microvm-options.html#microvmgraphicssocket","microvm-options.html#microvmguestenable","microvm-options.html#microvmhugepagemem","microvm-options.html#microvmhypervisor","microvm-options.html#microvminitrdpath","microvm-options.html#microvminterfaces","microvm-options.html#microvminterfacesbridge","microvm-options.html#microvminterfacesid","microvm-options.html#microvminterfacesmac","microvm-options.html#microvminterfacesmacvtaplink","microvm-options.html#microvminterfacesmacvtapmode","microvm-options.html#microvminterfacestype","microvm-options.html#microvmkernel","microvm-options.html#microvmkernelparams","microvm-options.html#microvmmem","microvm-options.html#microvmprestart","microvm-options.html#microvmprettyprocnames","microvm-options.html#microvmqemuextraargs","microvm-options.html#microvmqemuserialconsole","microvm-options.html#microvmrunner","microvm-options.html#microvmshares","microvm-options.html#microvmsharesmountpoint","microvm-options.html#microvmsharesproto","microvm-options.html#microvmsharessocket","microvm-options.html#microvmsharessource","microvm-options.html#microvmsharestag","microvm-options.html#microvmsocket","microvm-options.html#microvmstoreondisk","microvm-options.html#microvmuser","microvm-options.html#microvmvcpu","microvm-options.html#microvmvolumes","microvm-options.html#microvmvolumesautocreate","microvm-options.html#microvmvolumesfstype","microvm-options.html#microvmvolumesimage","microvm-options.html#microvmvolumeslabel","microvm-options.html#microvmvolumesmountpoint","microvm-options.html#microvmvolumessize","microvm-options.html#microvmvsockcid","microvm-options.html#microvmwritablestoreoverlay","packages.html#running-a-microvm-as-a-package","packages.html#immediately-running-a-nixosconfiguration","packages.html#add-a-runner-package-to-your-flake","host.html#preparing-a-nixos-host-for-declarative-microvms","host.html#preparing-a-non-flakes-host","simple-network.html#a-simple-network-setup","simple-network.html#a-bridge-to-link-tap-interfaces","simple-network.html#advanced-improving-performance","advanced-network.html#advanced-network-setup","advanced-network.html#a-bridge-to-link-tap-interfaces","advanced-network.html#provide-internet-access-with-nat","advanced-network.html#port-forwarding","host-systemd.html#systemd-services-on-a-microvm-host","host-systemd.html#install-microvm-nameservice","host-systemd.html#microvm-tap-interfacesservice","host-systemd.html#microvm-macvtap-interfacesservice","host-systemd.html#microvm-pci-devicesservice","host-systemd.html#microvm-virtiofsdservice","host-systemd.html#microvmservice","host-systemd.html#microvmstarget","declarative.html#declarative-microvms","declarative.html#fully-declarative","declarative.html#declarative-deployment","ssh-deploy.html#deploying-via-ssh","ssh-deploy.html#microvmdeployrebuild","ssh-deploy.html#microvmdeployinstallonhost","ssh-deploy.html#microvmdeploysshswitch","microvm-command.html#imperative-microvm-management-with-the-microvm-command","microvm-command.html#create-a-microvm","microvm-command.html#enabling-microvm-autostart","microvm-command.html#update-a-microvm","microvm-command.html#list-microvms","microvm-command.html#removing-microvms","conventions.html#conventions-between-microvm-packages-and-the-host","conventions.html#generating-custom-operating-system-hypervisor-packages","faq.html#frequently-asked-questions","faq.html#can-i-support-the-development-and-maintenance-of-this-project","faq.html#how-to-centralize-logging-with-journald","faq.html#can-i-build-with-hypervisors-from-the-hosts-nixpkgs-instead-of-the-microvms","faq.html#how-can-i-deploy-imperatively-from-continuous-integration","faq.html#can-i-include-my-hosts--channel-when-building-the-vm"],"index":{"documentStore":{"docInfo":{"0":{"body":19,"breadcrumbs":2,"title":1},"1":{"body":29,"breadcrumbs":2,"title":1},"10":{"body":85,"breadcrumbs":6,"title":2},"100":{"body":32,"breadcrumbs":6,"title":1},"101":{"body":49,"breadcrumbs":6,"title":1},"102":{"body":15,"breadcrumbs":8,"title":5},"103":{"body":21,"breadcrumbs":5,"title":2},"104":{"body":13,"breadcrumbs":6,"title":3},"105":{"body":38,"breadcrumbs":5,"title":2},"106":{"body":30,"breadcrumbs":5,"title":2},"107":{"body":29,"breadcrumbs":5,"title":2},"108":{"body":105,"breadcrumbs":6,"title":5},"109":{"body":34,"breadcrumbs":7,"title":6},"11":{"body":26,"breadcrumbs":6,"title":2},"110":{"body":0,"breadcrumbs":6,"title":3},"111":{"body":1,"breadcrumbs":7,"title":4},"112":{"body":92,"breadcrumbs":6,"title":3},"113":{"body":18,"breadcrumbs":9,"title":6},"114":{"body":121,"breadcrumbs":7,"title":4},"115":{"body":11,"breadcrumbs":9,"title":6},"12":{"body":49,"breadcrumbs":5,"title":1},"13":{"body":21,"breadcrumbs":7,"title":3},"14":{"body":65,"breadcrumbs":7,"title":3},"15":{"body":14,"breadcrumbs":6,"title":2},"16":{"body":122,"breadcrumbs":8,"title":4},"17":{"body":55,"breadcrumbs":7,"title":3},"18":{"body":26,"breadcrumbs":8,"title":4},"19":{"body":142,"breadcrumbs":5,"title":1},"2":{"body":74,"breadcrumbs":4,"title":3},"20":{"body":30,"breadcrumbs":5,"title":1},"21":{"body":19,"breadcrumbs":5,"title":1},"22":{"body":12,"breadcrumbs":5,"title":1},"23":{"body":12,"breadcrumbs":5,"title":1},"24":{"body":12,"breadcrumbs":5,"title":1},"25":{"body":27,"breadcrumbs":5,"title":1},"26":{"body":12,"breadcrumbs":5,"title":1},"27":{"body":9,"breadcrumbs":5,"title":1},"28":{"body":67,"breadcrumbs":5,"title":1},"29":{"body":32,"breadcrumbs":5,"title":1},"3":{"body":39,"breadcrumbs":3,"title":2},"30":{"body":11,"breadcrumbs":5,"title":1},"31":{"body":17,"breadcrumbs":5,"title":1},"32":{"body":10,"breadcrumbs":5,"title":1},"33":{"body":17,"breadcrumbs":5,"title":1},"34":{"body":12,"breadcrumbs":5,"title":1},"35":{"body":30,"breadcrumbs":5,"title":1},"36":{"body":13,"breadcrumbs":5,"title":1},"37":{"body":13,"breadcrumbs":5,"title":1},"38":{"body":18,"breadcrumbs":5,"title":1},"39":{"body":27,"breadcrumbs":5,"title":1},"4":{"body":15,"breadcrumbs":5,"title":3},"40":{"body":13,"breadcrumbs":5,"title":1},"41":{"body":10,"breadcrumbs":5,"title":1},"42":{"body":17,"breadcrumbs":5,"title":1},"43":{"body":9,"breadcrumbs":5,"title":1},"44":{"body":11,"breadcrumbs":5,"title":1},"45":{"body":16,"breadcrumbs":5,"title":1},"46":{"body":17,"breadcrumbs":5,"title":1},"47":{"body":12,"breadcrumbs":5,"title":1},"48":{"body":13,"breadcrumbs":5,"title":1},"49":{"body":17,"breadcrumbs":5,"title":1},"5":{"body":60,"breadcrumbs":4,"title":2},"50":{"body":12,"breadcrumbs":5,"title":1},"51":{"body":14,"breadcrumbs":5,"title":1},"52":{"body":16,"breadcrumbs":5,"title":1},"53":{"body":12,"breadcrumbs":5,"title":1},"54":{"body":14,"breadcrumbs":5,"title":1},"55":{"body":12,"breadcrumbs":5,"title":1},"56":{"body":11,"breadcrumbs":5,"title":1},"57":{"body":10,"breadcrumbs":5,"title":1},"58":{"body":12,"breadcrumbs":5,"title":1},"59":{"body":13,"breadcrumbs":5,"title":1},"6":{"body":95,"breadcrumbs":6,"title":2},"60":{"body":12,"breadcrumbs":5,"title":1},"61":{"body":10,"breadcrumbs":5,"title":1},"62":{"body":13,"breadcrumbs":5,"title":1},"63":{"body":15,"breadcrumbs":5,"title":1},"64":{"body":13,"breadcrumbs":5,"title":1},"65":{"body":13,"breadcrumbs":5,"title":1},"66":{"body":10,"breadcrumbs":5,"title":1},"67":{"body":14,"breadcrumbs":5,"title":1},"68":{"body":13,"breadcrumbs":5,"title":1},"69":{"body":10,"breadcrumbs":5,"title":1},"7":{"body":29,"breadcrumbs":6,"title":2},"70":{"body":19,"breadcrumbs":5,"title":1},"71":{"body":11,"breadcrumbs":5,"title":1},"72":{"body":11,"breadcrumbs":5,"title":1},"73":{"body":24,"breadcrumbs":5,"title":1},"74":{"body":51,"breadcrumbs":5,"title":1},"75":{"body":26,"breadcrumbs":6,"title":3},"76":{"body":9,"breadcrumbs":6,"title":3},"77":{"body":18,"breadcrumbs":7,"title":4},"78":{"body":95,"breadcrumbs":9,"title":5},"79":{"body":16,"breadcrumbs":8,"title":4},"8":{"body":26,"breadcrumbs":6,"title":2},"80":{"body":37,"breadcrumbs":10,"title":3},"81":{"body":110,"breadcrumbs":11,"title":4},"82":{"body":41,"breadcrumbs":10,"title":3},"83":{"body":30,"breadcrumbs":10,"title":3},"84":{"body":96,"breadcrumbs":11,"title":4},"85":{"body":53,"breadcrumbs":11,"title":4},"86":{"body":48,"breadcrumbs":9,"title":2},"87":{"body":13,"breadcrumbs":11,"title":4},"88":{"body":39,"breadcrumbs":10,"title":3},"89":{"body":8,"breadcrumbs":10,"title":3},"9":{"body":55,"breadcrumbs":6,"title":2},"90":{"body":8,"breadcrumbs":10,"title":3},"91":{"body":5,"breadcrumbs":10,"title":3},"92":{"body":9,"breadcrumbs":9,"title":2},"93":{"body":8,"breadcrumbs":8,"title":1},"94":{"body":5,"breadcrumbs":8,"title":1},"95":{"body":44,"breadcrumbs":4,"title":2},"96":{"body":84,"breadcrumbs":4,"title":2},"97":{"body":53,"breadcrumbs":4,"title":2},"98":{"body":68,"breadcrumbs":8,"title":3},"99":{"body":54,"breadcrumbs":6,"title":1}},"docs":{"0":{"body":"microvm.nix is a Flake to run lightweight NixOS virtual machines on NixOS. Starting with the reasons why for the remainder of this chapter, this handbook guides you through the provisioning of MicroVMs on your NixOS machine.","breadcrumbs":"Intro » Intro","id":"0","title":"Intro"},"1":{"body":"NixOS makes running services a breeze. Being able to quickly rollback configuration is a life-saver. Not so much however on systems that are shared by multiple services where maintenance of one affects others. Increase stability by partitioning services into virtual NixOS systems that can be updated individually.","breadcrumbs":"Intro » Compartmentalization","id":"1","title":"Compartmentalization"},"10":{"body":"MACVTAP interfaces attach to a host's physical network interface, joining the same Ethernet segment with a separate MAC address. Before running a MicroVM interactively from a package, do the following steps manually: # Parent interface:\nLINK=eth0\n# MACVTAP interface, as specified under microvm.interfaces.*.id:\nID=microvm1\n# Create the interface\nsudo ip l add link $LINK name $ID type macvtap mode bridge\n# Obtain the interface index number\nIFINDEX=$(cat /sys/class/net/$ID/ifindex)\n# Grant yourself permission\nsudo chown $USER /dev/tap$IFINDEX When running MicroVMs through the host module, the macvtap network interfaces are created through a systemd service dependency. Per interface with type = \"macvtap\", a link attribute with the parent interface, and mode attribute for the MACVTAP filtering mode must be specified.","breadcrumbs":"Declaring MicroVMs » Network interfaces » type = \"macvtap\"","id":"10","title":"type = \"macvtap\""},"100":{"body":"This script will evaluate only the system's derivations locally. It then transfers these and their dependencies to the remote system so the actual build can be performed there. Just like the microvm command , it then installs the MicroVM under /var/lib/microvms/$NAME so that the systemd services of the host module can pick it up. It is irrelevant whether you create a new MicrVOM or update an existing one.","breadcrumbs":"Declarative MicroVMs » Deploy via SSH » microvm.deploy.installOnHost","id":"100","title":"microvm.deploy.installOnHost"},"101":{"body":"Once the host has an updated MicroVM in its /nix/store (see above) the new system must be activated. For a proper state, this script does a bit more in the MicroVM than just switch-to-configuration: First, the config.networking.hostName is compared to the running system for safety reasons. The Nix database registration will be imported which is important if you build packages into a microvm.writableStoreOverlay. The new system is installed into /nix/var/nix/profiles/system which is optional but expected by some Nix tooling. Finally, run switch-to-configuration with the provided parameter (eg. switch).","breadcrumbs":"Declarative MicroVMs » Deploy via SSH » microvm.deploy.sshSwitch","id":"101","title":"microvm.deploy.sshSwitch"},"102":{"body":"Compartmentalizing services in an infrastructure landscape allows us to conduct maintenance individually and without affecting unrelated MicroVMs. The microvm command helps with that.","breadcrumbs":"Imperative MicroVM management » Imperative MicroVM management with the microvm command","id":"102","title":"Imperative MicroVM management with the microvm command"},"103":{"body":"You can specify this MicroVM's source flake with -f. If omitted, the tool will assume git+file:///etc/nixos. The source flakeref will be kept in /var/lib/microvms/*/flake for future updating the MicroVM. microvm -f git+https://... -c my-microvm","breadcrumbs":"Imperative MicroVM management » Create a MicroVM","id":"103","title":"Create a MicroVM"},"104":{"body":"Extension of the host's systemd units must happen declaratively in the host's NixOS configuration: microvm.autostart = [ \"myvm1\" \"myvm2\" \"myvm3\"\n];","breadcrumbs":"Imperative MicroVM management » Enabling MicroVM autostart","id":"104","title":"Enabling MicroVM autostart"},"105":{"body":"Updating does not refresh your packages but simply rebuilds the MicroVM. Use nix flake update to get new package versions. microvm -u my-microvm Until ways have been found to safely transfer the profile into the target /nix/store, and subsequently activate it, you must restart the MicroVM for the update to take effect. Use the -R flag to automatically restart if an update was built.","breadcrumbs":"Imperative MicroVM management » Update a MicroVM","id":"105","title":"Update a MicroVM"},"106":{"body":"Listing your MicroVMs is as trivial as ls -1 /var/lib/microvms For more insight, the following command will read the current system version of all MicroVMs and compare them to what the corresponding flake evaluates. It is therefore quite slow to run, yet very useful for an updatable VM overview. microvm -l","breadcrumbs":"Imperative MicroVM management » List MicroVMs","id":"106","title":"List MicroVMs"},"107":{"body":"First, stop the MicroVM: systemctl stop microvm@$NAME If you don't use absolute filesystem paths for sockets, volumes, or shares, all MicroVM state is kept under /var/lib/microvms/$NAME/. The microvm@.serivce systemd service template depends on existence of this directory. rm -rf /var/lib/microvms/$NAME","breadcrumbs":"Imperative MicroVM management » Removing MicroVMs","id":"107","title":"Removing MicroVMs"},"108":{"body":"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 option MicroVM package file nixosModules.host systemd service Description microvm.hypervisor bin/microvm-run microvm@.service Start script for the main MicroVM process microvm.hypervisor bin/microvm-shutdown microvm@.service Script for graceful shutdown of the MicroVM (i.e. triggering the power button) microvm.interfaces.*.id share/microvm/tap-interfaces microvm-tap-interfaces@.service Names of the tap network interfaces to setup for the proper user microvm.devices.*.path share/microvm/pci-devices microvm-pci-devices@.service PCI devices that must be bound to the vfio-pci driver on the host microvm.shares.*.source share/microvm/virtiofs/${tag}/source microvm-virtiofsd@.service Source directory of a virtiofs instance by tag microvm.shares.*.socket share/microvm/virtiofs/${tag}/socket microvm-virtiofsd@.service virtiofsd socket path by tag share/microvm/system config.system.build.toplevel symlink, used for comparing versions when running microvm -l","breadcrumbs":"Conventions » Conventions between MicroVM packages and the host","id":"108","title":"Conventions between MicroVM packages and the host"},"109":{"body":"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.","breadcrumbs":"Conventions » Generating custom operating system hypervisor packages","id":"109","title":"Generating custom operating system hypervisor packages"},"11":{"body":"This mode lets qemu create a tap interface and attach it to a bridge. The qemu-bridge-helper binary needs to be setup with the proper permissions. See the host module for that. qemu will be run without -sandbox on in order for this contraption to work.","breadcrumbs":"Declaring MicroVMs » Network interfaces » type = \"bridge\"","id":"11","title":"type = \"bridge\""},"110":{"body":"","breadcrumbs":"Frequently Asked Questions » Frequently Asked Questions","id":"110","title":"Frequently Asked Questions"},"111":{"body":"❤ Sponsor","breadcrumbs":"Frequently Asked Questions » Can I support the development and maintenance of this project?","id":"111","title":"Can I support the development and maintenance of this project?"},"112":{"body":"That is possible without even requiring a network transport by just making the journals available to the host as a share. Because journald identifies hosts by their /etc/machine-id, we propose to use static content for that file. Add a NixOS module like the following to your MicroVM configuration: environment.etc.\"machine-id\" = { mode = \"0644\"; text = # change this to suit your flake's interface self.lib.addresses.machineId.${config.networking.hostName} + \"\\n\";\n}; microvm.shares = [ { # On the host source = \"/var/lib/microvms/${config.networking.hostName}/journal\"; # In the MicroVM mountPoint = \"/var/log/journal\"; tag = \"journal\"; proto = \"virtiofs\"; socket = \"journal.sock\";\n} ]; Last, make the MicroVM journals available to your host. The machine-id must be available. systemd.tmpfiles.rules = map (vmHost: let machineId = self.lib.addresses.machineId.${vmHost}; in # creates a symlink of each MicroVM's journal under the host's /var/log/journal \"L+ /var/log/journal/${machineId} - - - - /var/lib/microvms/${vmHost}/journal/${machineId}\"\n) (builtins.attrNames self.lib.addresses.machineId); Once your MicroVM's journal data is visible in the /var/log/journal/$machineId/ directories, journalctl can pick it up using the -m/--merge switch.","breadcrumbs":"Frequently Asked Questions » How to centralize logging with journald?","id":"112","title":"How to centralize logging with journald?"},"113":{"body":"Yes. This scenario is enabled through the flake's lib.buildRunner function. See the nix run microvm#build-microvm script that you will need to customize to fit your deployment scenario.","breadcrumbs":"Frequently Asked Questions » Can I build with hypervisors from the host's nixpkgs instead of the MicroVM's?","id":"113","title":"Can I build with hypervisors from the host's nixpkgs instead of the MicroVM's?"},"114":{"body":"Do this by integrating into your automation what the microvm command does. environment.systemPackages = [ ( # Provide a manual updating script that fetches the latest # updated+built system from Hydra pkgs.writeScriptBin \"update-microvm\" '' #! ${pkgs.runtimeShell} -e if [ $# -lt 1 ]; then NAMES=\"$(ls -1 /var/lib/microvms)\" else NAMES=\"$@\" fi for NAME in $NAMES; do echo MicroVM $NAME cd /var/lib/microvms/$NAME # Is this truly the flake that is being built on Hydra? if [ \"$(cat flake)\" = \"git+https://gitea.example.org/org/nix-config?ref=flake-update\" ]; then NEW=$(curl -sLH \"Accept: application/json\" https://hydra.example.org/job/org/nix-config/$NAME/latest | ${pkgs.jq}/bin/jq -er .buildoutputs.out.path) nix copy --from https://nix-cache.example.org $NEW if [ -e booted ]; then nix store diff-closures $(readlink booted) $NEW elif [ -e current ]; then echo \"NOT BOOTED! Diffing to old current:\" nix store diff-closures $(readlink current) $NEW else echo \"NOT BOOTED?\" fi CHANGED=no if ! [ -e current ]; then ln -s $NEW current CHANGED=yes elif [ \"$(readlink current)\" != $NEW ]; then rm -f old cp --no-dereference current old rm -f current ln -s $NEW current CHANGED=yes fi fi if [ \"$CHANGED\" = \"yes\" ]; then systemctl restart microvm@$NAME fi echo done ''\n) ];","breadcrumbs":"Frequently Asked Questions » How can I deploy imperatively from Continuous Integration?","id":"114","title":"How can I deploy imperatively from Continuous Integration?"},"115":{"body":"Use the following configuration if you build your MicroVM with --impure from channels, not Flakes: nix.nixPath = [ \"nixpkgs=${builtins.storePath