From 5e77974dc9953b162610b6c3bc0a1362c72cf291 Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 21 Nov 2026 05:10:40 +0000 Subject: run-firecracker-vm: no console, fontconfig, su xauth, hwdb, shutdown ramfs The guest has no screen, no X, and no hardware to tell apart but virtio, so the base system leaves out kbd and systemd-vconsole-setup (console.enable; the unit doesn't need disabling any more), fontconfig and freetype, su's xauth with libX11 & co. (which shadow.nix turns on, not as a default), and udev's hardware database (14M). And there's nothing to unmount from a ramfs at shutdown: / is a tmpfs, and the store's images are read-only; systemd-shutdown remounts what's still busy, like the rw-store, read-only. About 30M less in the base image, and a service less at every shutdown. --- pkgs/run-firecracker-vm/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pkgs/run-firecracker-vm') diff --git a/pkgs/run-firecracker-vm/default.nix b/pkgs/run-firecracker-vm/default.nix index dbdf2b6..a8b3a92 100644 --- a/pkgs/run-firecracker-vm/default.nix +++ b/pkgs/run-firecracker-vm/default.nix @@ -217,6 +217,19 @@ let systemd.tpm2.enable = false; users.manageLingering = false; + # No screen, no X, and no hardware to tell apart, but virtio: + # neither kbd and systemd-vconsole-setup, nor fontconfig, nor su's + # xauth (shadow.nix sets it, not as a default), nor udev's hardware + # database. + console.enable = false; + fonts.fontconfig.enable = false; + security.pam.services.su.forwardXAuth = lib.mkForce false; + environment.etc."udev/hwdb.bin".enable = false; + # Nothing to unmount from a ramfs at shutdown: / is a tmpfs, and the + # store's images are read-only (systemd-shutdown remounts what's + # still busy, like the rw-store, read-only). + systemd.shutdownRamfs.enable = false; + # /var is empty on every boot, which makes these run every time, # in the critical path to sysinit.target. systemd.suppressedSystemUnits = [ @@ -238,7 +251,6 @@ let "sys-kernel-debug.mount" "sys-kernel-tracing.mount" "systemd-pstore.service" - "systemd-vconsole-setup.service" ] (_: { enable = lib.mkForce false; }); # Of the generators systemd runs after switching root, only fstab and -- cgit v1.3.1