diff --git a/nixos/lib/testing/run.nix b/nixos/lib/testing/run.nix index 0b35007f0c0b..f97489f67be5 100644 --- a/nixos/lib/testing/run.nix +++ b/nixos/lib/testing/run.nix @@ -35,8 +35,7 @@ let options = { devnet = mkOption { type = types.bool; - default = - builtins.length (lib.attrNames containers) > 0 && builtins.length (lib.attrNames nodes) > 0; + default = containers != { } && nodes != { }; defaultText = lib.literalMD "`true` if both VMs and containers are present."; description = '' This heuristic setting that assumes that the majority of tests requires VMs and containers @@ -52,14 +51,14 @@ let }; uid-range = mkOption { type = types.bool; - default = builtins.length (lib.attrNames containers) > 0; + default = containers != { }; defaultText = lib.literalMD "`true` if containers are present."; description = "Containers use systemd-nspawn, which requires pid 0 inside of the sandbox. `uid-range` enables that."; }; kvm = mkOption { type = types.bool; - default = isLinux; - defaultText = lib.literalMD "`true` if built to run on Linux."; + default = isLinux && nodes != { }; + defaultText = lib.literalMD "`true` if built to run on Linux and any virtual machines are specified."; description = "Whether Linux KVM virtualization is required when running this test. Can be disabled to allow emulated execution."; }; apple-virt = mkOption {