about summary refs log tree commit diff
path: root/modules/core
diff options
context:
space:
mode:
authoraszlig <aszlig@nix.build>2018-04-29 14:29:36 +0200
committeraszlig <aszlig@nix.build>2018-04-29 14:30:42 +0200
commit98c906c9204e9f0769c742555a6b5913ee932ecc (patch)
tree56aaa25472a1ea1b31f5cd4aaa6ae5fcfff6e930 /modules/core
parent3ea85a699a65dbdd4f633d21e70be6859b0f3f8f (diff)
core/tests: Remove "with lib"
We want to make sure nix-instantiate --parse will catch errors very
early, because evaluation of the test definitions takes a ton of time.

Signed-off-by: aszlig <aszlig@nix.build>
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/tests.nix20
1 files changed, 10 insertions, 10 deletions
diff --git a/modules/core/tests.nix b/modules/core/tests.nix
index d1a4b898..f095d9b1 100644
--- a/modules/core/tests.nix
+++ b/modules/core/tests.nix
@@ -1,16 +1,16 @@
 { options, config, pkgs, lib, ... }:
 
-with lib;
-
 let
+  inherit (lib) any elem;
+
   whichNet = if config.networking.useNetworkd then "networkd" else "scripted";
 
   mkTest = attrs: if attrs.check then attrs.paths or [ attrs.path ] else [];
 
-  anyAttrs = pred: cfg: any id (mapAttrsToList (const pred) cfg);
+  anyAttrs = pred: cfg: any lib.id (lib.mapAttrsToList (lib.const pred) cfg);
   hasPackage = p: any (x: x.name == p.name) config.environment.systemPackages;
 
-  upstreamTests = concatMap mkTest [
+  upstreamTests = lib.concatMap mkTest [
     { check = config.security.acme.certs != {};
       path  = ["nixos" "acme"];
     }
@@ -441,9 +441,9 @@ let
     }
     { check = config.services.postgresql.enable;
       path  = let
-        filterPg = name: drv: hasPrefix "postgresql" name
+        filterPg = name: drv: lib.hasPrefix "postgresql" name
                            && drv == config.services.postgresql.package;
-        pgPackage = head (attrNames (filterAttrs filterPg pkgs));
+        pgPackage = lib.head (lib.attrNames (lib.filterAttrs filterPg pkgs));
       in ["nixos" "postgresql" pgPackage];
     }
     { check = config.services.powerdns.enable;
@@ -580,13 +580,13 @@ let
 
 in {
   options.vuizvui = {
-    requiresTests = mkOption {
-      type = types.listOf (types.listOf types.str);
+    requiresTests = lib.mkOption {
+      type = lib.types.listOf (lib.types.listOf lib.types.str);
       default = [];
       example = [ ["nixos" "nat" "firewall"] ["vuizvui" "foo"] ];
       description = ''
-        A list of attribute paths to the tests which need 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>.