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 /pkgs/run-firecracker-vm/default.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 'pkgs/run-firecracker-vm/default.nix')
| -rw-r--r-- | pkgs/run-firecracker-vm/default.nix | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pkgs/run-firecracker-vm/default.nix b/pkgs/run-firecracker-vm/default.nix index 106ec05..041bf60 100644 --- a/pkgs/run-firecracker-vm/default.nix +++ b/pkgs/run-firecracker-vm/default.nix @@ -1,7 +1,9 @@ { pkgs ? import <nixpkgs> {} -, kernelPackages ? pkgs.linuxPackages_latest - # The CA of the host's egress proxy (see modules/host), if it's there. -, caCert ? "/var/lib/fcbr0-egress/ca.pem" + # NixOS modules, part of the base system (layer 0, the first image), + # for what all layers share, like the kernel (base/kernel.nix): set in a + # layer instead, the base's kernel modules would stay in the base image, + # unused. +, base ? [ ] # NixOS modules, each a layer on top of the ones before, the first on # top of the base system (below). The guest runs the top layer's # system; its store has an image per layer, each with only the store @@ -155,7 +157,7 @@ let description = "The secrets the guest needs, by name (--secret NAME=FILE)."; }; } - ] ++ lib.take n layers; + ] ++ base ++ lib.take n layers; # nix only with layers/nix.nix, which the run script needs to know # about. @@ -175,7 +177,7 @@ let system.stateVersion = lib.trivial.release; - boot.kernelPackages = kernelPackages; + boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; boot.initrd.allowMissingModules = true; # e.g. ahci, efivarfs with a cut-down kernel boot.initrd.kernelModules = [ "virtio_mmio" "virtio_blk" "erofs" "vmw_vsock_virtio_transport" "9p" "9pnet_fd" "overlay" ]; boot.kernelParams = [ @@ -269,10 +271,11 @@ let networking.useDHCP = false; networking.resolvconf.enable = false; # The host resolves every name to itself and proxies TLS to allowed - # names, decrypting some with certificates from its CA, see modules/host. + # names, decrypting some with certificates from its CA, see modules/host + # (if it's there; another one: security.pki.certificateFiles). environment.etc."resolv.conf".text = "nameserver 172.16.0.1\n"; security.pki.certificateFiles = - lib.optional (builtins.pathExists caCert) (/. + caCert); + lib.optional (builtins.pathExists /var/lib/fcbr0-egress/ca.pem) /var/lib/fcbr0-egress/ca.pem; systemd.network.enable = true; systemd.network.wait-online.enable = false; systemd.network.networks.eth = { |
