about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-23 10:29:58 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-23 10:29:58 +0100
commit9be782798f5a853d28d3822716c8b74d518338c2 (patch)
tree5dfcfa9ef7b885bfda136bcb2c7388d3c46d4890
parenttests({tests,modules}): Couple via a co-import (diff)
downloadnixos-config-9be782798f5a853d28d3822716c8b74d518338c2.tar.gz
nixos-config-9be782798f5a853d28d3822716c8b74d518338c2.zip
tests(flake): Hook up to the flake's check and package attributes
-rw-r--r--flake.nix4
-rw-r--r--flake/default.nix36
-rw-r--r--flake/packages/default.nix3
-rw-r--r--tests/README.md3
4 files changed, 32 insertions, 14 deletions
diff --git a/flake.nix b/flake.nix
index 399e0577..4e97cddf 100644
--- a/flake.nix
+++ b/flake.nix
@@ -307,13 +307,13 @@
         self
         pkgs
         pkgsStable
+        nixLib
         myPkgs
         system
         sysLib
         nixpkgs_as_input
         nixpkgs_open_prs
         # modules
-        
         home-manager
         nixVim
         nixos-generators
@@ -325,12 +325,10 @@
         lanzaboote
         nix-index-database
         # external dependencies
-        
         treefmt-nix
         user_js
         templates
         # my binaries
-        
         shell_library
         river_init_lesser
         ;
diff --git a/flake/default.nix b/flake/default.nix
index f158478b..222b18ac 100644
--- a/flake/default.nix
+++ b/flake/default.nix
@@ -3,6 +3,7 @@
   self,
   pkgs,
   pkgsStable,
+  nixLib,
   myPkgs,
   system,
   sysLib,
@@ -38,12 +39,10 @@
       nixpkgs_as_input
       nixpkgs_open_prs
       # my things
-      
       shell_library
       sysLib
       templates
       # modules
-      
       home-manager
       nixVim
       nixos-generators
@@ -55,22 +54,37 @@
       lanzaboote
       nix-index-database
       # bins
-      
       river_init_lesser
       # external
-      
       user_js
       ;
   };
+
+  tests = import ../tests {
+    inherit pkgs nixpkgs_as_input myPkgs;
+    inherit (pkgs) lib;
+    extraModules = {
+      termfilechooser = "${nixpkgs_open_prs.nixpkgs-tfc}/nixos/modules/config/xdg/portals/termfilechooser.nix";
+
+      agenix = agenix.nixosModules.default;
+      disko = disko.nixosModules.default;
+      serverphone = serverphone.nixosModules.default;
+      inherit (home-manager.nixosModules) home-manager;
+      inherit (impermanence.nixosModules) impermanence;
+      inherit (lanzaboote.nixosModules) lanzaboote;
+    };
+  };
 in {
   inherit nixosConfigurations;
-  checks."${system}" = {
-    inherit
-      (self.packages."${system}")
-      nvim
-      ;
-    formatting = treefmtEval.config.build.check self;
-  };
+  checks."${system}" =
+    nixLib.maybeMerge {
+      inherit
+        (self.packages."${system}")
+        nvim
+        ;
+      formatting = treefmtEval.config.build.check self;
+    }
+    tests "flake checks";
 
   # legacyPackages."${system}" = pkgs;
 
diff --git a/flake/packages/default.nix b/flake/packages/default.nix
index 5b07b6f3..a8fc2d64 100644
--- a/flake/packages/default.nix
+++ b/flake/packages/default.nix
@@ -13,6 +13,8 @@
   inherit (pkgs) lib;
   output = import ../../bootstrap {inherit pkgs sysLib;};
 
+  run_test_description = pkgs.callPackage ../../tests/infrastructure/run.nix {};
+
   nvim =
     builtins.mapAttrs (
       name: value: let
@@ -88,6 +90,7 @@ in
     #   format = "iso";
     # };
     nvim = nvim.tiamat;
+    inherit run_test_description;
   }
   // output
   // output_neovim
diff --git a/tests/README.md b/tests/README.md
index fe93dc96..c7e1bb93 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -58,6 +58,9 @@ where `COMMAND` is one of the commands listed in [Commands](#### Commands)
 The `ARGS` are the verbatim content from the space after the `COMMAND`
 to the end of line character.
 
+You can run the description file, similarly as in the tests via the `run_test_description`
+package exported by the flake.
+
 #### Commands
 ##### `Type`
 Send the `ARGS` to the application. This interprets `ARGS` as specified