nixos/lib/testing: `builtins.length (lib.attrNames ...) > 0 -> != to the empty set

(cherry picked from commit 244057cf9f)
This commit is contained in:
Winter
2026-07-20 20:23:26 -04:00
committed by github-actions[bot]
parent 44b4e8026b
commit 2922dea563

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,7 +51,7 @@ 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.";
};