From 2922dea563aaaf43a034a842cf5cbedcafb175d1 Mon Sep 17 00:00:00 2001 From: Winter Date: Mon, 20 Jul 2026 20:23:26 -0400 Subject: [PATCH] nixos/lib/testing: `builtins.length (lib.attrNames ...) > 0 -> != to the empty set (cherry picked from commit 244057cf9fe516aad51a689de8519daedf49dc97) --- nixos/lib/testing/run.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nixos/lib/testing/run.nix b/nixos/lib/testing/run.nix index 0b35007f0c0b..b8a850489ffe 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,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."; };