about summary refs log tree commit diff
path: root/lib/get-tests.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/get-tests.nix')
-rw-r--r--lib/get-tests.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/get-tests.nix b/lib/get-tests.nix
new file mode 100644
index 00000000..08fc9475
--- /dev/null
+++ b/lib/get-tests.nix
@@ -0,0 +1,22 @@
+{ system ? builtins.currentSystem
+, nixpkgs ? import ../nixpkgs-path.nix
+, vuizvuiTests ? ../tests
+}:
+
+with import "${nixpkgs}/lib";
+
+{
+  nixos = let
+    upstreamTests = (import "${nixpkgs}/nixos/release.nix" {
+      inherit nixpkgs;
+    }).tests;
+    isTestOrJob = attr: (attr.type or null) == "derivation" || attr ? test;
+    isTestOrSystems = attr: isTestOrJob attr || attr ? ${system};
+    cond = attr: !isTestOrSystems attr;
+    reduce = attr: if isTestOrJob attr then attr else attr.${system};
+  in mapAttrsRecursiveCond cond (path: reduce) upstreamTests;
+
+  vuizvui = import vuizvuiTests {
+    inherit system;
+  };
+}