diff options
| author | tv <tv@krebsco.de> | 2026-11-21 16:31:57 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-21 16:50:30 +0000 |
| commit | 5b918e0b892a3c3eeddd866170eefe2cbd7e6ba3 (patch) | |
| tree | ecbee40a8bc0c5c189d348d7b8c90af901a15aa9 /base/kernel.nix | |
| parent | 4148b4543c7d776d3428d01497cfc9de3ae7c9f7 (diff) | |
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.
Diffstat (limited to 'base/kernel.nix')
| -rw-r--r-- | base/kernel.nix | 37 |
1 files changed, 37 insertions, 0 deletions
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 <<EOF + CONFIG_EROFS_FS=m + CONFIG_NET_9P=m + CONFIG_9P_FS=m + EOF + make olddefconfig + ''; + installPhase = '' + cp .config $out + ''; + }; +in +{ + boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linuxManualConfig { + inherit (linux) src version modDirVersion; + inherit configfile; + allowImportFromDerivation = true; + }); +} |
