at 23.11-pre 882 B view raw
1import ./make-test-python.nix ({ pkgs, systemdStage1 ? false, ...} : let 2 msg = "Shutting down NixOS"; 3in { 4 name = "systemd-shutdown"; 5 meta = with pkgs.lib.maintainers; { 6 maintainers = [ das_j ]; 7 }; 8 9 nodes.machine = { 10 imports = [ ../modules/profiles/minimal.nix ]; 11 systemd.shutdownRamfs.contents."/etc/systemd/system-shutdown/shutdown-message".source = pkgs.writeShellScript "shutdown-message" '' 12 echo "${msg}" 13 ''; 14 boot.initrd.systemd.enable = systemdStage1; 15 }; 16 17 testScript = '' 18 machine.wait_for_unit("multi-user.target") 19 # .shutdown() would wait for the machine to power off 20 machine.succeed("systemctl poweroff") 21 # Message printed by systemd-shutdown 22 machine.wait_for_console_text("Unmounting '/oldroot'") 23 machine.wait_for_console_text("${msg}") 24 # Don't try to sync filesystems 25 machine.booted = False 26 ''; 27})