aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-16 13:31:16 +0000
committertv <tv@krebsco.de>2026-11-16 13:31:16 +0000
commit1bad8c85a23dacf33ad6285d141f6e07068054f0 (patch)
tree93269b423734c405500cb03890a5d959dc3bfaf3
parent537ed0d545baaa0e4721aab1469cc72562a6ab71 (diff)
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.
-rw-r--r--default.nix6
1 files changed, 5 insertions, 1 deletions
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";