From 257855753073987160c293fdedc9d95a33cbc0e8 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 16 Aug 2020 13:50:51 +0200 Subject: [PATCH] nixos/test-instrumentation.nix: Fix evaluation error Discovered via https://github.com/NixOS/nixpkgs/pull/82743 which improved option checking, causing an evaluation error that was hard to understand without running the evaluation manually. --- nixos/modules/testing/test-instrumentation.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nixos/modules/testing/test-instrumentation.nix b/nixos/modules/testing/test-instrumentation.nix index 1baeab53b0c..a6b34e36d20 100644 --- a/nixos/modules/testing/test-instrumentation.nix +++ b/nixos/modules/testing/test-instrumentation.nix @@ -55,7 +55,12 @@ with import ../../lib/qemu-flags.nix { inherit pkgs; }; systemd.services."serial-getty@hvc0".enable = false; # Only use a serial console, no TTY. - virtualisation.qemu.consoles = [ qemuSerialDevice ]; + # NOTE: optionalAttrs + # test-instrumentation.nix appears to be used without qemu-vm.nix, so + # we avoid defining consoles if not possible. + # TODO: refactor such that test-instrumentation can import qemu-vm + # or declare virtualisation.qemu.console option in a module that's always imported + virtualisation = lib.optionalAttrs (options ? virtualisation.qemu.consoles) { qemu.consoles = [ qemuSerialDevice ]; }; boot.initrd.preDeviceCommands = ''