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. --- base/kernel.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 base/kernel.nix (limited to 'base') diff --git a/base/kernel.nix b/base/kernel.nix new file mode 100644 index 0000000..fe551c5 --- /dev/null +++ b/base/kernel.nix @@ -0,0 +1,37 @@ +# Cut-down guest kernel, based on Firecracker's recommended configuration, +# as a module for the base system: +# nix-build pkgs/run-firecracker-vm --arg base '[ base/kernel.nix ]' +{ pkgs, ... }: +let + linux = pkgs.linux_6_18; + + firecrackerConfig = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/firecracker-microvm/firecracker/cc88013eadcf432da1b37d47d445b7e8bcc3046e/resources/guest_configs/microvm-kernel-ci-x86_64-6.18.config"; + sha256 = "05ajrz05kcfk0qa6gvgssazz38flcaji1kgb4k0a94kj1hd408ms"; + }; + + configfile = pkgs.stdenv.mkDerivation { + name = "linux-config-${linux.version}-firecracker"; + inherit (linux) src; + nativeBuildInputs = [ pkgs.bison pkgs.flex ]; + dontConfigure = true; + buildPhase = '' + cat ${firecrackerConfig} - > .config <