about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/get-tests.nix18
-rw-r--r--modules/profiles/common.nix15
2 files changed, 20 insertions, 13 deletions
diff --git a/lib/get-tests.nix b/lib/get-tests.nix
new file mode 100644
index 00000000..22d85b12
--- /dev/null
+++ b/lib/get-tests.nix
@@ -0,0 +1,18 @@
+{ system ? builtins.currentSystem, nixpkgs ? import ../nixpkgs-path.nix }:
+
+with import "${nixpkgs}/lib";
+
+{
+  nixos = let
+    upstreamTests = (import "${nixpkgs}/nixos/release.nix" {
+      inherit nixpkgs;
+    }).tests;
+    isTestOrSystems = attr: attr ? test || attr ? ${system};
+    cond = attr: !isTestOrSystems attr;
+    reduce = attr: if attr ? test then attr else attr.${system};
+  in mapAttrsRecursiveCond cond (path: reduce) upstreamTests;
+
+  vuizvui = import ../tests {
+    inherit system;
+  };
+}
diff --git a/modules/profiles/common.nix b/modules/profiles/common.nix
index b7fad147..58d6c27b 100644
--- a/modules/profiles/common.nix
+++ b/modules/profiles/common.nix
@@ -94,19 +94,8 @@ with lib;
       ] ++ optional config.vuizvui.enableGlobalNixpkgsConfig nixpkgsConfig;
     in mkIf config.vuizvui.modifyNixPath (mkOverride 90 nixPath);
 
-    _module.args.tests = {
-      nixos = let
-        upstreamTests = (import "${nixpkgs}/nixos/release.nix" {
-          inherit nixpkgs;
-        }).tests;
-        isTestOrSystems = attr: attr ? test || attr ? ${system};
-        cond = attr: !isTestOrSystems attr;
-        reduce = attr: if attr ? test then attr else attr.${system};
-      in mapAttrsRecursiveCond cond (path: reduce) upstreamTests;
-
-      vuizvui = import ../../tests {
-        inherit system;
-      };
+    _module.args.tests = import ../../lib/get-tests.nix {
+      inherit nixpkgs system;
     };
   };
 }