tests/vmWithoutTests: poweroff on shell exit

This allows quitting the VM with Ctrl-D like in the minimal example VM.
This commit is contained in:
Erik Arvstedt 2022-10-22 19:37:46 +02:00 committed by Greg Shuflin
parent c12489d838
commit 514c05ee47
1 changed files with 4 additions and 6 deletions

View File

@ -97,12 +97,10 @@ name: testConfig:
# Avoid lengthy build of the nixos manual
documentation.nixos.enable = false;
# Provide a shortcut for instant poweroff from within the machine
environment.systemPackages = with pkgs; [
(lowPrio (writeScriptBin "q" ''
echo o >/proc/sysrq-trigger
''))
];
# Power off VM when the user exits the shell
systemd.services."serial-getty@".preStop = ''
echo o >/proc/sysrq-trigger
'';
system.stateVersion = lib.mkDefault config.system.nixos.release;
})).config.system.build.vm;