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

View File

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