From 4cfbbb3c1ded303eccb09d53319dfb1cd862bfdc Mon Sep 17 00:00:00 2001 From: K900 Date: Sun, 8 Sep 2024 08:27:28 +0300 Subject: [PATCH] nixos/tests: don't include switch-to-configuration in DUT by default --- nixos/lib/testing/nixos-test-base.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nixos/lib/testing/nixos-test-base.nix b/nixos/lib/testing/nixos-test-base.nix index d76a25361f8c..65fe15c6162e 100644 --- a/nixos/lib/testing/nixos-test-base.nix +++ b/nixos/lib/testing/nixos-test-base.nix @@ -3,7 +3,7 @@ # even in `inheritParentConfig = false` specialisations. { lib, ... }: let - inherit (lib) mkForce; + inherit (lib) mkDefault mkForce; in { imports = [ @@ -22,6 +22,11 @@ in label = mkForce "test"; }; } - + ({ config, ... }: { + # Don't pull in switch-to-configuration by default, except when specialisations are involved. + # This is mostly a Hydra optimization, so we don't rebuild all the tests every time switch-to-configuration-ng changes. + key = "no-switch-to-configuration"; + system.switch.enable = mkDefault (config.isSpecialisation || config.specialisation != {}); + }) ]; }