about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-12-11 07:34:35 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-12-11 07:34:35 +0100
commitaa6741135cb7e78ab038eee798067f2df32bb6d9 (patch)
treec89fdc06e3ba3918aa1915366bedbf5756fcd4e2
parentf48fe4b7f4509c919e3897e83490da34a095d0fc (diff)
modules: Make requiresTests a list of paths.
Unfortunately, we went into trouble and the Hydra machine not only
consumed lots of ram during evaluation but it also triggered a bunch of
evaluation errors because the available tests were strictly evaluated.

Using attribute paths consisting of plain strings doesn't have the same
problem, even though they look a bit uglier.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r--modules/profiles/common.nix14
-rw-r--r--modules/profiles/tests.nix4
-rw-r--r--modules/user/aszlig/services/i3/default.nix4
-rw-r--r--release.nix16
4 files changed, 16 insertions, 22 deletions
diff --git a/modules/profiles/common.nix b/modules/profiles/common.nix
index 58d6c27b..486426e9 100644
--- a/modules/profiles/common.nix
+++ b/modules/profiles/common.nix
@@ -35,11 +35,15 @@ with lib;
     };
 
     requiresTests = mkOption {
-      type = types.listOf types.package;
+      type = types.listOf (types.listOf types.str);
       default = [];
+      example = [ ["nixos" "nat" "firewall"] ["vuizvui" "foo"] ];
       description = ''
-        A list of derivations which have to succeed in order to trigger a
-        channel update for the current configuration/machine.
+        A list of attribute paths to the tests which need to succeed in order to
+        trigger a channel update for the current configuration/machine.
+
+        Every attribute path itself is a list of attribute names, which are
+        queried using <function>lib.getAttrFromPath</function>.
       '';
     };
   };
@@ -93,9 +97,5 @@ with lib;
         rootChannelsPath
       ] ++ optional config.vuizvui.enableGlobalNixpkgsConfig nixpkgsConfig;
     in mkIf config.vuizvui.modifyNixPath (mkOverride 90 nixPath);
-
-    _module.args.tests = import ../../lib/get-tests.nix {
-      inherit nixpkgs system;
-    };
   };
 }
diff --git a/modules/profiles/tests.nix b/modules/profiles/tests.nix
index 66ea76e5..811d6cf8 100644
--- a/modules/profiles/tests.nix
+++ b/modules/profiles/tests.nix
@@ -1,10 +1,10 @@
-{ config, lib, tests, ... }:
+{ config, lib, ... }:
 
 with lib;
 
 let
   which = if config.networking.useNetworkd then "networkd" else "scripted";
-  networkTests = map (attr: getAttr attr tests.nixos.networking.${which}) [
+  networkTests = map (name: ["nixos" "networking" which]) [
     "static" "dhcpSimple" "dhcpOneIf" "bond" "bridge" "macvlan" "sit" "vlan"
   ];
 
diff --git a/modules/user/aszlig/services/i3/default.nix b/modules/user/aszlig/services/i3/default.nix
index b9025766..0814ac1e 100644
--- a/modules/user/aszlig/services/i3/default.nix
+++ b/modules/user/aszlig/services/i3/default.nix
@@ -1,4 +1,4 @@
-{ pkgs, tests, lib, config, ... }:
+{ pkgs, lib, config, ... }:
 
 with lib;
 
@@ -106,7 +106,7 @@ in
   config = mkIf cfg.enable {
     vuizvui.user.aszlig.services.i3.workspaces = defaultWorkspaces;
 
-    vuizvui.requiresTests = [ tests.vuizvui.aszlig.i3 ];
+    vuizvui.requiresTests = [ ["vuizvui" "aszlig" "i3"] ];
 
     services.xserver.windowManager = {
       default = "i3";
diff --git a/release.nix b/release.nix
index 2d5d9641..fc72ee2b 100644
--- a/release.nix
+++ b/release.nix
@@ -62,21 +62,15 @@ in with pkgsUpstream.lib; with builtins; {
   in mapAttrsRecursiveCond (m: !(m ? iso)) (const buildIso) allMachines;
 
   tests = let
+    machineList = collect (m: m ? build) allMachines;
     allTests = import ./lib/get-tests.nix {
       inherit system nixpkgs;
     };
-    machineList = collect (m: m ? build) allMachines;
-    activatedTests = concatMap (machine:
+    activatedTests = unique (concatMap (machine:
       machine.build.config.vuizvui.requiresTests
-    ) [ (head machineList) ];
-    cmpTest = a: b:
-      if a ? driver
-      then a.driver.testScript == b.driver.testScript && a.name == b.name
-      else a.drvPath == b.drvPath;
-    hasTest = test: any (cmpTest test) activatedTests;
-    includeTest = test: optionalAttrs (hasTest test) test;
-    cond = t: !((t.type or null) == "derivation" || t ? test);
-  in mapAttrsRecursiveCond cond (const includeTest) allTests;
+    ) machineList);
+    mkTest = path: setAttrByPath path (getAttrFromPath path allTests);
+  in fold recursiveUpdate {} (map mkTest activatedTests);
 
   pkgs = let
     releaseLib = import "${nixpkgs}/pkgs/top-level/release-lib.nix" {