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
parent 1d3f49f8da
commit 3c816b862c
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

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;