about summary refs log tree commit diff
path: root/nixos/tests/systemd-shutdown.nix
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2022-04-24 14:47:28 -0400
committerWill Fancher <elvishjerricco@gmail.com>2022-04-28 14:12:14 -0400
commit69d804751678ca42175203252251cd74ff362812 (patch)
treec283f3c63eaaeb7adac4624b8882f2ac2adb16b3 /nixos/tests/systemd-shutdown.nix
parente325f7aeaafa51db41bd7e8d86d04b934dbab949 (diff)
nixos: Fix up systemd shutdown ramfs
Diffstat (limited to 'nixos/tests/systemd-shutdown.nix')
-rw-r--r--nixos/tests/systemd-shutdown.nix11
1 files changed, 8 insertions, 3 deletions
diff --git a/nixos/tests/systemd-shutdown.nix b/nixos/tests/systemd-shutdown.nix
index 9283489c25591..688cd6dd2c175 100644
--- a/nixos/tests/systemd-shutdown.nix
+++ b/nixos/tests/systemd-shutdown.nix
@@ -1,4 +1,6 @@
-import ./make-test-python.nix ({ pkgs, systemdStage1 ? false, ...} : {
+import ./make-test-python.nix ({ pkgs, systemdStage1 ? false, ...} : let
+  msg = "Shutting down NixOS";
+in {
   name = "systemd-shutdown";
   meta = with pkgs.lib.maintainers; {
     maintainers = [ das_j ];
@@ -6,7 +8,9 @@ import ./make-test-python.nix ({ pkgs, systemdStage1 ? false, ...} : {
 
   nodes.machine = {
     imports = [ ../modules/profiles/minimal.nix ];
-    boot.initrd.systemd.enable = systemdStage1;
+    systemd.shutdownRamfs.contents."/etc/systemd/system-shutdown/shutdown-message".source = pkgs.writeShellScript "shutdown-message" ''
+      echo "${msg}"
+    '';
   };
 
   testScript = ''
@@ -14,7 +18,8 @@ import ./make-test-python.nix ({ pkgs, systemdStage1 ? false, ...} : {
     # .shutdown() would wait for the machine to power off
     machine.succeed("systemctl poweroff")
     # Message printed by systemd-shutdown
-    machine.wait_for_console_text("All filesystems, swaps, loop devices, MD devices and DM devices detached.")
+    machine.wait_for_console_text("Unmounting '/oldroot'")
+    machine.wait_for_console_text("${msg}")
     # Don't try to sync filesystems
     machine.booted = False
   '';