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 # 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;