From 1bad8c85a23dacf33ad6285d141f6e07068054f0 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 13:31:16 +0000 Subject: use nixos-init In the initrd, NixOS Activation spends ~0.1s before its first output and ~0.15s in total, running prepare-root and the activation script in bash from the (cold) store image: [0.907724] Starting NixOS Activation... [1.009663] booting system configuration /nix/store/... [1.054987] Finished NixOS Activation. nixos-init does the same from a single program. perlless already gives us what it requires: systemd in the initrd, an overlay /etc and userborn. Mount the store with nodev,nosuid right away, so nixos-init doesn't have to remount it. --- default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 8b03123..ad2610e 100644 --- a/default.nix +++ b/default.nix @@ -12,6 +12,10 @@ let (modulesPath + "/profiles/perlless.nix") ]; + # Activate and switch root from the initrd with a single program, + # instead of bash running prepare-root and the activation script. + system.nixos-init.enable = true; + system.stateVersion = lib.trivial.release; boot.kernelPackages = kernelPackages; @@ -32,7 +36,7 @@ let fileSystems."/nix/store" = { device = "/dev/vda"; fsType = "erofs"; - options = [ "ro" ]; + options = [ "ro" "nodev" "nosuid" ]; }; fileSystems."/xchg" = { device = "/dev/vdb"; -- cgit v1.3.1