aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* cache the store imagetv11 days1-7/+17
| | | | | | | | Building the erofs image takes ~2.5s, as long as the guest's initrd. Keep the image of the last closure in $XDG_CACHE_HOME/run-firecracker-vm, named by the hash of the store path list, and rebuild it only when the closure changes. Older images get deleted; running VMs keep theirs open.
* disable systemd's mount rate limittv11 days1-0/+3
| | | | | | | | | | | | | | | | | | | | systemd processes at most 5 mount events per second (see src/core/mount.c). Booting from a tmpfs root with an erofs store and an overlay /etc exceeds that, and each time the next mount waits for the next one-second window. The boot journal shows three such stalls, two of them exactly one second apart: [0.789652] Finished Virtual Console Setup. [1.588264] Mounting /sysroot... [1.675477] initrd-parse-etc.service: Triggering OnSuccess= dependencies. [2.588523] Mounting /run/nixos-etc-metadata... [3.799810] Finished Virtual Console Setup. [4.446154] Mounting /run/wrappers... The limit can be overridden via PID 1's environment, which the kernel populates from unrecognized command line parameters. A burst of 0 disables it. systemd passes its original environment on when switching root, so this covers the initrd and stage 2.
* add networkingtv11 days2-0/+30
| | | | | | | | | | | | | Give the guest a virtio-net interface backed by the host tap device fctap0, with a static address (172.16.0.2/24, gateway 172.16.0.1) set up by systemd-networkd, and 9.9.9.9 as nameserver. host.nix is a NixOS module for the host that creates fctap0, owned by the given user, and NATs it: imports = [ (import ./host.nix "tv") ]; Firecracker refuses to start if fctap0 doesn't exist.
* strip down the guesttv11 days1-3/+27
| | | | | | | | | | | Import the minimal and perlless profiles, and turn off what a throwaway VM with a read-only store doesn't need: firewall (which also failed to start with the cut-down kernel), timesyncd (kvm-clock keeps time), nscd, sudo and setuid wrappers, coredumps, oomd, TPM2, fstrim, lvm, bcache, kexec, containers, lingering, nano, fuse and switch-to-configuration. This shrinks the guest closure from 709 MiB to 560 MiB with the default kernel, most of what's left being kernel modules, systemd and glibc.
* add optional cut-down guest kerneltv11 days2-0/+33
| | | | | | | | | | | | kernel.nix builds Linux 6.18 with Firecracker's recommended guest configuration (resources/guest_configs/microvm-kernel-ci-x86_64-6.18.config), plus erofs as a module. Use it with nix-build --arg kernelPackages 'import ./kernel.nix {}' Everything Firecracker needs is built in, so NixOS' default initrd modules (ahci, efivarfs, ...) don't exist; allowMissingModules lets the initrd build anyway.
* silence probing of devices Firecracker doesn't havetv11 days1-1/+4
| | | | 8250.nr_uarts=1 stops probing of the legacy ports of ttyS1..ttyS3.
* make guest kernel configurable, default to latesttv11 days1-1/+4
| | | | | Default to linuxPackages_latest, which matches a host running the latest kernel from the same channel, so no extra kernel gets built.
* init firecracker NixOS guesttv11 days1-0/+69
Boot a NixOS guest in Firecracker and drop into a root shell on ttyS0. Firecracker can't share directories with the guest (no 9p or virtio-fs), so the host store is exposed as a read-only block device: run-firecracker-vm packs the guest system's closure, plus the closures of any store paths given as arguments, into a temporary erofs image, which the guest mounts at /nix/store. Root is a tmpfs.