nixos/*qemu*: Add systemd initrd support

This commit is contained in:
Janne Heß 2022-04-30 19:17:57 +02:00
parent 5b47056b7d
commit 007108f04d
No known key found for this signature in database
GPG key ID: 69165158F05265DF
3 changed files with 29 additions and 31 deletions

View file

@ -65,33 +65,26 @@ in
};
};
boot.initrd.preDeviceCommands =
''
echo 600 > /proc/sys/kernel/hung_task_timeout_secs
'';
boot.kernel.sysctl = {
"kernel.hung_task_timeout_secs" = 600;
# Panic on out-of-memory conditions rather than letting the
# OOM killer randomly get rid of processes, since this leads
# to failures that are hard to diagnose.
"vm.panic_on_oom" = lib.mkDefault 2;
};
boot.initrd.postDeviceCommands =
''
# Using acpi_pm as a clock source causes the guest clock to
# slow down under high host load. This is usually a bad
# thing, but for VM tests it should provide a bit more
# determinism (e.g. if the VM runs at lower speed, then
# timeouts in the VM should also be delayed).
echo acpi_pm > /sys/devices/system/clocksource/clocksource0/current_clocksource
'';
boot.postBootCommands =
''
# Panic on out-of-memory conditions rather than letting the
# OOM killer randomly get rid of processes, since this leads
# to failures that are hard to diagnose.
echo 2 > /proc/sys/vm/panic_on_oom
'';
# Panic if an error occurs in stage 1 (rather than waiting for
# user intervention).
boot.kernelParams =
[ "console=${qemu-common.qemuSerialDevice}" "panic=1" "boot.panic_on_fail" ];
boot.kernelParams = [
"console=${qemu-common.qemuSerialDevice}"
# Panic if an error occurs in stage 1 (rather than waiting for
# user intervention).
"panic=1" "boot.panic_on_fail"
# Using acpi_pm as a clock source causes the guest clock to
# slow down under high host load. This is usually a bad
# thing, but for VM tests it should provide a bit more
# determinism (e.g. if the VM runs at lower speed, then
# timeouts in the VM should also be delayed).
"clock=acpi_pm"
];
# `xwininfo' is used by the test driver to query open windows.
environment.systemPackages = [ pkgs.xorg.xwininfo ];