lib/tests: stage the test password file under systemd initrd

`boot.initrd.preDeviceCommands` only runs in the script-based stage 1
and is gated on `!config.boot.initrd.systemd.enable`. Tests that
enable systemd initrd therefore never get `/tmp/secret.key` staged,
and disko's encrypted-filesystem mount hooks fail to find the
configured `passwordFile`.
This commit is contained in:
a-kenji authored and Michael Hoang committed 2026-05-19 16:50:50 +02:00
1 parent 8ebce63228
commit baf057aa5b
1 file changed
+3
+3
View File
@@ -142,6 +142,9 @@ let
boot.initrd.preDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
echo -n 'secretsecret' > /tmp/secret.key
'';
boot.initrd.secrets = lib.mkIf config.boot.initrd.systemd.enable {
"/tmp/secret.key" = pkgs.writeText "secret.key" "secretsecret";
};
boot.consoleLogLevel = lib.mkForce 100;
boot.loader.systemd-boot.enable = lib.mkDefault efi;
};