aboutsummaryrefslogtreecommitdiffstats
path: root/layers
Commit message (Collapse)AuthorAgeFilesLines
* rigs: the README, and the restHEADmastertv17 hours1-1/+1
| | | | | | | | The README is about rigs now, NixOS guests, each a computer of its own, in Firecracker or Cloud Hypervisor, with the new names in its examples (rig.home.required, rig.secrets, rig-drop-caches, ~/rig-store.img, rig-layer-K images), and where any VMM is meant, it says the VMM, not Firecracker.
* rigs: run-rig, not run-firecracker-vmtv17 hours2-3/+3
| | | | | | The run script starts its VMs in Cloud Hypervisor, too, so it's pkgs/run-rig, and run-rig (also its lock files), and the examples' paths are /path/to/rigs.
* rigs: the guest's names, rig.* and rig-*tv17 hours2-17/+17
| | | | | | | | | | | | The project is called rigs now, as it runs its VMs in Cloud Hypervisor, too, not only Firecracker. So the guest's options (rig.secrets, rig.home.required, rig.nix, ...), its kernel command line (rig.vmm, rig.home, rig.xchg, rig.registration, rig.9pPORT), its units (rig-secrets, rig-home, rig-xchg, rig-vmm-exit, rig-drop-caches, rig-rw-store-unshadow), the drives' labels (rig-layer-K, rig-store, rig-home; the run script relabels existing store and home images), and the images (rig-layer-K.img) lose the fc and firecracker. Firecracker itself, the VMM, keeps its name.
* layers/nix.nix: nix-load-db fails no more on what --verify can't fixtv27 hours1-2/+5
| | | | | | | | | nix-store --verify removes paths that are gone from the database, but not those that other valid paths refer to: it reports them, and exits with an error, which failed nix-load-db, and with it the nix daemon, so every nix command failed in the guest. Now nix-load-db reports it, and the guest keeps its nix: a build that needs a missing path fails, and says why.
* layers/nix.nix: keep the rw-store's copies of the host's store's pathstv27 hours1-5/+14
| | | | | | | | | | | | | | fc-rw-store-unshadow dropped every path in the rw-store that a lower layer had, as complete there, including the host's store. But the host's store isn't fixed like the images: its garbage collection can remove a path any time, and then a path the guest's nix had added and still has registered (its own copy dropped at boot, in favour of the host's) is gone. nix-store --verify then can't fix the database (the missing paths have valid referrers), nix-load-db fails, and with it the nix daemon. Now only paths that an image has get dropped, and of the host's store's, only whiteouts, which would hide its path; real copies stay (tested in a scratch tree, with a whiteout made in a user namespace).
* run-firecracker-vm: the guest drops its caches when nixpkgs's commit changestv29 hours1-0/+14
| | | | | | | | | | With --nixpkgs-cache (loose: 7s for nix-instantiate '<nixpkgs>' -A hello, against 20s without), the guest doesn't see changes to the host's nixpkgs until it drops its caches. When nixpkgs is a Git checkout, the run script now checks its commit every 5 seconds, and on a change (checkout, pull, rebase), connects to the guest's vsock port 1235, where layers/nix.nix has fc-drop-caches run. Changes without a commit still need fc-drop-caches by hand.
* layers/nix.nix: fc-drop-caches, for 9P's stale cachestv29 hours1-0/+26
| | | | | | | | | | | 9P with cache=loose (the host's store; /nixpkgs with --nixpkgs-cache=loose, which evaluates three times as fast as without) never asks the host again: a file changed on the host keeps its old size and contents in the guest (nix then reads a truncated aliases.nix), and a name looked up before the host had it stays missing, until the guest drops its cached dentries and inodes, which only root can. fc-drop-caches lets anyone: a setuid wrapper for a program that takes no input and only ever writes 2 to drop_caches.
* run-firecracker-vm: the store's layers as lowerdir+=, not one lowerdirtv4 days1-6/+8
| | | | | | | | | | | | | | | | | | NixOS's overlay.lowerdir makes the store's lower layers a single mount option, lowerdir=/sysroot/nix/.image/0:..., which util-linux passes with the new mount API, which caps a string option at 255 bytes: at most 11 images, 10 with nix. Now the base system generates the store's mount from the layers, a lowerdir+= each (kernel 6.8 and later), which has that limit per path only (tested in a user namespace: 30 long paths, 4470 bytes, mount; a single lowerdir of them doesn't; and lowerdir+= can't follow lowerdir=, so it's one or the other). The limit is now Firecracker's number of devices. The lower layers are fc.storeLowerdirs: the images first, as reading them is fast, then what layers add, like layers/nix.nix the host's store, which also adds its upper layer to the options, created by fc-rw-store-unshadow now (NixOS's service for that comes only with overlay.lowerdir).
* layers/switch.nix: switching a running guest, for developmenttv4 days1-0/+25
| | | | | | | | | | | | | | | | | | | Every change to a guest meant a new image and a reboot. For a faster development loop, a guest with nix can now switch to a new build of its system instead: layers/switch.nix, imported into a layer, turns the switch on (the base system keeps it off, as a default now), and the run script's derivation has the system, so the host builds it with nix-build -A toplevel and runs its switch-to-configuration in the guest, which sees the host's store, where it got built (tested: a path added on the host shows up in the running guest). A switched guest runs what it didn't boot, so for production, it's still a reboot with the new run script. The kernel, its command line, Firecracker's configuration, new secrets, and adding or removing layers need one anyway. A path the guest looked for before the host had it stays missing, as the store's overlay remembers that (tested), until the guest drops its caches, which takes seconds, so that's documented, not done every time: nothing in the guest looks for paths it doesn't have, as a rule.
* run-firecracker-vm: drives by label, not by vda, vdb, ...tv5 days1-1/+1
| | | | | | | | | | | | | | | | The guest mounted its drives by their device names, which come in the order the kernel probes the drives, not necessarily in their order in the Firecracker configuration: booted with linuxPackages_latest, where virtio_blk and virtio_mmio are modules, the base image and nix's came swapped (vdb and vdc), which went unnoticed only because the store's lower layers can be in any order. With /home or the rw-store swapped, it wouldn't have been harmless. Now the guest goes by filesystem labels: image k is fc-layer-K (mkfs.erofs -L), the rw-store fc-store, and home fc-home. The run script labels the ext4 images when it creates them, and existing ones, from before labels, before the guest starts. This also drops the drive letters' limit of 26 drives.
* layers/console.nix: the console's size follows the terminal'stv5 days1-1/+41
| | | | | | | | | | | | | A serial line, unlike a pty, doesn't get told when the terminal's size changes, so the console kept the size the run script saw at boot (systemd.tty.rows/columns.ttyS0), e.g. 6 rows, from a tmux pane that small for a moment, and a tmux attached there drew for that, whatever the terminal's size. Now there's resize, which asks the terminal (ESC[6n, after moving the cursor as far as it goes, then back) and sets what it answers (stty rows, cols), and the shell on the serial console runs it before each prompt, until the terminal doesn't answer (within a second). A tmux attached there still keeps its size until attached again.
* layers/console.nix: a shell on the serial console, to import into a layertv5 days1-0/+23
| | | | | | | | | | | | | | | Since the base system turned off the console (and with it kbd), it had no getty at all: NixOS's gettys come with the console (services/ttys/getty.nix), so there was no shell on ttyS0 any more, only the kernel's and systemd's messages, and ssh. That stays the default, and the base system's console.enable is only that now, a default, for layers/console.nix: the console, with root logged in on ttyS0 (a default, too: services.getty.autologinUser can name another user, or be null for a login prompt), but no getty on tty1, and no systemd-vconsole-setup, which moved there from the base system, like the autologin. It's small, so the README has it imported into another layer, rather than as a layer, with an image, of its own, which works, too.
* run-firecracker-vm: nix as a layer, a read-only store without ittv6 days1-0/+120
The base system had nix, the nix-daemon, the host's store and nixpkgs via 9P, and a writable store on a drive, a scratch file without --store. Now all of that is in a layer of its own, layers/nix.nix, and the base system has neither nix nor nix-daemon in its closure: its store is its images, read-only, an overlay of them, or with a single image, the image itself, as overlayfs needs at least two lower layers without an upper one. This can become the base layer for guests that only run services. As a layer, nix gets an image of its own: put first, it's the same for all guests with nix, instead of in the image of whichever layer wants nix. It sets fc.nix, which the run script goes by, and nix.enable; setting nix.enable without it fails an assertion, as the run script wouldn't give the guest the drive for its store. The image decides, so the run script checks that the options fit it: a guest with nix requires --store (no more scratch store), and one without refuses --store, --store-size, --nixpkgs and --nixpkgs-cache. Without the rw-store drive, the images come first, and home after them; the store and nixpkgs aren't served, there's no fc.registration, and the initrd doesn't mount anything via 9P. The run script now waits for each of the 9P servers it starts, not only the store's.