Skip to content

Commit ebe491e

Browse files
committed
docs: Update documentation for vfkit hypervisor support
Updates all documentation to reflect the addition of vfkit as a new hypervisor option for running MicroVMs on macOS. Changes: - Add vfkit to hypervisor comparison table with its restrictions - Update intro and README to mention macOS support - Document vfkit's user-mode (NAT) networking support - Note that vfkit has built-in virtiofs (no separate virtiofsd needed) - Add vfkit-specific configuration options to options table - Include vfkit-example in the examples section
1 parent e4c9e88 commit ebe491e

File tree

5 files changed

+31
-18
lines changed

5 files changed

+31
-18
lines changed

README.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</p>
1515

1616
A Nix Flake to build NixOS and run it on one of several Type-2
17-
Hypervisors on NixOS/Linux. The project is intended to provide a more
17+
Hypervisors on NixOS/Linux or macOS. The project is intended to provide a more
1818
isolated alternative to `nixos-container`. You can either build and
1919
run MicroVMs like Nix packages, or alternatively install them as
2020
systemd services declaratively in your host's Nix Flake or
@@ -26,8 +26,8 @@ imperatively with the provided `microvm` command.
2626

2727
- MicroVMs are Virtual Machines but use special device interfaces
2828
(virtio) for high performance.
29-
- This project runs them on NixOS hosts.
30-
- You can choose one of five hypervisors for each MicroVM.
29+
- This project runs them on NixOS/Linux hosts and macOS (via vfkit).
30+
- You can choose from eight hypervisors for each MicroVM.
3131
- MicroVMs have a fixed RAM allocation (default: 512 MB) but can be
3232
shrunk using `microvm-balloon`
3333
- MicroVMs have a read-only root disk with either a prepopulated
@@ -40,20 +40,21 @@ imperatively with the provided `microvm` command.
4040
a block device, or alternatively as a shared directory hierarchy
4141
through *9p* or *virtiofs*.
4242
- Zero, one, or more virtual tap ethernet network interfaces can be
43-
attached to a MicroVM. `qemu` and `kvmtool` also support *user*
43+
attached to a MicroVM. `qemu`, `kvmtool`, and `vfkit` also support *user*
4444
networking which requires no additional setup on the host.
4545

4646
## Hypervisors
4747

48-
| Hypervisor | Language | Restrictions |
49-
|-------------------------------------------------------------------------|----------|------------------------------------------|
50-
| [qemu](https://www.qemu.org/) | C | |
51-
| [cloud-hypervisor](https://www.cloudhypervisor.org/) | Rust | no 9p shares |
52-
| [firecracker](https://firecracker-microvm.github.io/) | Rust | no 9p/virtiofs shares |
53-
| [crosvm](https://chromium.googlesource.com/chromiumos/platform/crosvm/) | Rust | 9p shares broken |
54-
| [kvmtool](https://github.com/kvmtool/kvmtool) | C | no virtiofs shares, no control socket |
55-
| [stratovirt](https://github.com/openeuler-mirror/stratovirt) | Rust | no 9p/virtiofs shares, no control socket |
56-
| [alioth](https://github.com/google/alioth) | Rust | no virtiofs shares, no control socket |
48+
| Hypervisor | Language | Restrictions |
49+
|-------------------------------------------------------------------------|----------|-------------------------------------------------------|
50+
| [qemu](https://www.qemu.org/) | C | |
51+
| [cloud-hypervisor](https://www.cloudhypervisor.org/) | Rust | no 9p shares |
52+
| [firecracker](https://firecracker-microvm.github.io/) | Rust | no 9p/virtiofs shares |
53+
| [crosvm](https://chromium.googlesource.com/chromiumos/platform/crosvm/) | Rust | 9p shares broken |
54+
| [kvmtool](https://github.com/kvmtool/kvmtool) | C | no virtiofs shares, no control socket |
55+
| [stratovirt](https://github.com/openeuler-mirror/stratovirt) | Rust | no 9p/virtiofs shares, no control socket |
56+
| [alioth](https://github.com/google/alioth) | Rust | no virtiofs shares, no control socket |
57+
| [vfkit](https://github.com/crc-org/vfkit) | Go | macOS only, no 9p shares, no tap/bridge networking |
5758

5859

5960
## Installation
@@ -85,6 +86,9 @@ nix run microvm#cloud-hypervisor-example
8586
nix run microvm#crosvm-example
8687
nix run microvm#kvmtool-example
8788
nix run microvm#stratovirt-example
89+
90+
# On macOS only:
91+
nix run microvm#vfkit-example
8892
```
8993

9094
### Run a MicroVM example with nested MicroVMs on 5 different Hypervisors

doc/src/interfaces.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ configuration:
2020

2121
## `type = "user"`
2222

23-
User-mode networking is only provided by qemu and kvmtool, providing
23+
User-mode networking is provided by qemu, kvmtool, and vfkit, providing
2424
outgoing connectivity to your MicroVM without any further setup.
2525

2626
As kvmtool seems to lack a built-in DHCP server, additional static IP
2727
configuration is necessary inside the MicroVM.
2828

29+
**Note:** vfkit (macOS) only supports user-mode networking. TAP and bridge
30+
networking are not available.
31+
2932
## `type = "tap"`
3033

3134
Use a virtual tuntap Ethernet interface. Its name is the value of

doc/src/intro.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Intro
22

33
**microvm.nix** is a Flake to run lightweight NixOS virtual machines
4-
on NixOS. Starting with the reasons why for the remainder of this
4+
on NixOS and macOS. Starting with the reasons why for the remainder of this
55
chapter, this handbook guides you through the provisioning of MicroVMs
6-
on your NixOS machine.
6+
on your NixOS or macOS machine.
77

88
## Compartmentalization
99

@@ -47,4 +47,5 @@ overhead has been reduced a lot by replacing emulated devices with
4747
This Flake offers you to run your MicroVMs not only on QEMU but with
4848
other Hypervisors that have been explicitly authored for
4949
*virtio*. Some of them are written in Rust, a programming language
50-
that is renowned for being safer than C.
50+
that is renowned for being safer than C. On macOS, vfkit leverages
51+
Apple's native Virtualization.framework for running Linux VMs.

doc/src/options.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ available for customization. These are the most important ones:
1515
| `microvm.socket` | Control socket for the Hypervisor so that a MicroVM can be shutdown cleanly |
1616
| `microvm.user` | (qemu only) User account which Qemu will switch to when started as root |
1717
| `microvm.forwardPorts` | (qemu user-networking only) TCP/UDP port forwarding |
18+
| `microvm.vfkit.extraArgs` | (vfkit only) Extra arguments to pass to vfkit |
19+
| `microvm.vfkit.logLevel` | (vfkit only) Log level: "debug", "info", or "error" (default: "info") |
1820
| `microvm.kernelParams` | Like `boot.kernelParams` but will not end up in `system.build.toplevel`, saving you rebuilds |
1921
| `microvm.storeOnDisk` | Enables the store on the boot squashfs even in the presence of a share with the host's `/nix/store` |
2022
| `microvm.writableStoreOverlay` | Optional string of the path where all writes to `/nix/store` should go to. |

doc/src/shares.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In `microvm.shares` elements the `proto` field allows either of two
1010
values:
1111

1212
- `9p` (default) is built into many hypervisors, allowing you to
13-
quickly share a directory tree
13+
quickly share a directory tree. Not supported by vfkit on macOS.
1414

1515
- `virtiofs` requires a separate virtiofsd service which is started as
1616
a prerequisite when you start MicroVMs through a systemd service
@@ -21,6 +21,9 @@ values:
2121

2222
Expect `virtiofs` to yield better performance over `9p`.
2323

24+
**Note:** vfkit (macOS) has built-in virtiofs support and does not
25+
require a separate virtiofsd service.
26+
2427
```nix
2528
microvm.shares = [ {
2629
proto = "virtiofs";

0 commit comments

Comments
 (0)