summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-02 22:46:50 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-02 23:13:38 +0200
commit9a80695caad3ae146b4232c6b295ce0fc75a6c19 (patch)
tree22062630c4b5800a132851f718742b9e43eae85c /flake.nix
parentfeat(hosts/server1): Activate the migrated services (diff)
downloadnixos-server-9a80695caad3ae146b4232c6b295ce0fc75a6c19.tar.gz
nixos-server-9a80695caad3ae146b4232c6b295ce0fc75a6c19.zip
test(tests): Init infrastructure
The modules still need to be imported one-by-one in `default.nix`
files because we have yet to rewrite this, but the new test
infrastructure might as well use the new `fileset` functions from `nixpkgs`.
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix40
1 files changed, 27 insertions, 13 deletions
diff --git a/flake.nix b/flake.nix
index f28d40b..cf39e80 100644
--- a/flake.nix
+++ b/flake.nix
@@ -86,24 +86,38 @@
   } @ attrs: let
     system = "x86_64-linux";
     pkgs = nixpkgs.legacyPackages.${system};
+    nixos-lib = import (nixpkgs + "/nixos/lib") {};
     pkgsUnstable = nixpkgs-unstable.legacyPackages.${system};
+
+    specialArgs =
+      attrs
+      // {
+        inherit pkgsUnstable nixpkgs-unstable nixos-lib extraModules;
+      };
+
+    extraModules = [
+      simple-nixos-mailserver.nixosModule
+      disko.nixosModules.default
+      impermanence.nixosModules.impermanence
+      agenix.nixosModules.default
+    ];
+
+    inherit (pkgs) lib;
+    tests = import ./tests.nix {inherit lib pkgs specialArgs;};
   in {
     nixosConfigurations."server1" = nixpkgs.lib.nixosSystem {
       system = "x86_64-linux";
-      specialArgs =
-        attrs
-        // {
-          inherit pkgsUnstable;
-        };
-      modules = [
-        ./modules/nixos
-        ./hosts/server1/configuration.nix
-        simple-nixos-mailserver.nixosModule
-        disko.nixosModules.default
-        impermanence.nixosModules.impermanence
-        agenix.nixosModules.default
-      ];
+      inherit specialArgs;
+      modules =
+        extraModules
+        ++ [
+          ./modules/nixos
+          ./hosts/server1/configuration.nix
+        ];
     };
+
+    checks."${system}" = tests;
+
     devShells."${system}" = {
       default = pkgs.mkShell {
         packages = with pkgs; [