From 51224f522f7a7d3a00ac2da4ceeedeea296cd2ed Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 6 Jun 2022 19:24:30 +0200 Subject: [PATCH 1/2] nixosTests.allDrivers: Move logic to all-packages.nix Bring it in line with release.nix --- nixos/tests/all-tests.nix | 19 ++----------------- pkgs/top-level/all-packages.nix | 9 +++++++++ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5ef2a8a82804..0f75548ff6fd 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -27,21 +27,7 @@ let }; evalMinimalConfig = module: nixosLib.evalModules { modules = [ module ]; }; - allDrivers = getDrivers tests; - - getDrivers = ts: - if isDerivation ts - then ts.driver or null - else if isAttrs ts - then recurseIntoAttrs (mapAttrs (k: getDrivers) ts) - else null; - - tests = { - - # for typechecking of the scripts and evaluation of - # the nodes, without running VMs. - inherit allDrivers; - +in { _3proxy = handleTest ./3proxy.nix {}; acme = handleTest ./acme.nix {}; adguardhome = handleTest ./adguardhome.nix {}; @@ -634,5 +620,4 @@ let zookeeper = handleTest ./zookeeper.nix {}; zrepl = handleTest ./zrepl.nix {}; zsh-history = handleTest ./zsh-history.nix {}; -}; -in tests +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 66c78c6783d2..22b477141493 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -133,10 +133,19 @@ with pkgs; ### Push NixOS tests inside the fixed point + # See also allTestsForSystem in nixos/release.nix nixosTests = import ../../nixos/tests/all-tests.nix { inherit pkgs; system = stdenv.hostPlatform.system; callTest = t: t.test; + } // { + # for typechecking of the scripts and evaluation of + # the nodes, without running VMs. + allDrivers = import ../../nixos/tests/all-tests.nix { + inherit pkgs; + system = stdenv.hostPlatform.system; + callTest = t: t.test.driver; + }; }; ### BUILD SUPPORT From 03bcd6fd64ce7aead3fd852118267bd69d4eef50 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 6 Jun 2022 19:25:04 +0200 Subject: [PATCH 2/2] nixos/release.nix: Add nixos.tests.allDrivers --- nixos/release.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/release.nix b/nixos/release.nix index 0df443dd204c..e0d782bcaec3 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -17,6 +17,7 @@ let # Run the tests for each platform. You can run a test by doing # e.g. ‘nix-build -A tests.login.x86_64-linux’, or equivalently, # ‘nix-build tests/login.nix -A result’. + # See also nixosTests in pkgs/top-level/all-packages.nix allTestsForSystem = system: import ./tests/all-tests.nix { inherit system; @@ -24,7 +25,19 @@ let callTest = t: { ${system} = hydraJob t.test; }; + } // { + # for typechecking of the scripts and evaluation of + # the nodes, without running VMs. + allDrivers = + import ./tests/all-tests.nix { + inherit system; + pkgs = import ./.. { inherit system; }; + callTest = t: { + ${system} = hydraJob t.test.driver; + }; + }; }; + allTests = foldAttrs recursiveUpdate {} (map allTestsForSystem supportedSystems);