From 5b918e0b892a3c3eeddd866170eefe2cbd7e6ba3 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 21 Nov 2026 16:31:57 +0000 Subject: run-firecracker-vm: base, modules for the base system, instead of kernelPackages and caCert The base system could only be changed by its two arguments, and a kernel set in a layer was a conflict with the base's plain boot.kernelPackages = kernelPackages. Now base takes NixOS modules, merged into the base system, i.e. layer 0 and its image, so what all layers share goes there, the kernel above all: kernel.nix is such a module now, and no package any more, so it moves to base/ (--arg base '[ base/kernel.nix ]', like --arg layers '[ layers/nix.nix ]'), and the base's linuxPackages_latest is only a default. A layer can set the kernel, too, now, but then the base image keeps its own kernel's modules (161M for linuxPackages_latest), unused. caCert wasn't used: the egress proxy's CA stays where modules/host puts it, picked up if it's there; another one is security.pki.certificateFiles, in base or a layer. --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 478beb2..709aeb6 100644 --- a/README.md +++ b/README.md @@ -197,12 +197,15 @@ a service layer costs a small image of its own, named after its file (`firecracker-layer-2-my-service.img`). Changing a layer changes the images of the layers above it. -To use a cut-down kernel, based on Firecracker's recommended guest -configuration, instead of `linuxPackages_latest`: +What all layers share goes into the base system, with `base`, NixOS +modules like layers', but in the base image. The kernel, for one: set +in a layer, it would leave the base's kernel modules unused in the base +image. So to use a cut-down kernel, based on Firecracker's recommended +guest configuration, instead of `linuxPackages_latest`: ```sh nix-build pkgs/run-firecracker-vm \ - --arg kernelPackages 'import pkgs/run-firecracker-vm/kernel.nix {}' + --arg base '[ base/kernel.nix ]' ``` ## Egress @@ -282,7 +285,7 @@ the list its own VM uses. - `pkgs/run-firecracker-vm/default.nix`: the guest's NixOS configuration, the Firecracker configuration, and the `run-firecracker-vm` script. -- `pkgs/run-firecracker-vm/kernel.nix`: the cut-down kernel. +- `base/kernel.nix`: the cut-down kernel, for `base`. - `layers/nix.nix`: nix, as a layer. - `layers/console.nix`: a shell on the serial console, to import into a layer. - `modules/host/default.nix`: the host's side: network, DHCP/DNS, egress -- cgit v1.3.1