nixos/lib/testing: don't require kvm if only containers are specified (#538271)

This commit is contained in:
Maximilian Bosch
2026-08-21 13:51:40 +00:00
committed by GitHub

View File

@@ -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 {