summary refs log tree commit diff stats
path: root/flake.nix
diff options
context:
space:
mode:
authorsils <sils@sils.li>2023-03-07 19:40:49 +0100
committersils <sils@sils.li>2023-03-07 19:48:12 +0100
commit820efecae8c72ee3f9c6f4981d43ce19fe660dc3 (patch)
tree9ca75dc7baebad7cf9eab78b28072d18ebaed311 /flake.nix
parentFeat: Add Website (diff)
downloadnixos-server-820efecae8c72ee3f9c6f4981d43ce19fe660dc3.tar.gz
nixos-server-820efecae8c72ee3f9c6f4981d43ce19fe660dc3.zip
Feat: Add mailserver
Diffstat (limited to '')
-rw-r--r--flake.nix34
1 files changed, 33 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 9df3c84..e087f96 100644
--- a/flake.nix
+++ b/flake.nix
@@ -4,17 +4,49 @@
 
   inputs = {
     nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11-small";
+    simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-22.11";
   };
 
   outputs = {
     self,
     nixpkgs,
+    simple-nixos-mailserver,
     ...
   } @ attrs: {
     nixosConfigurations."server1" = nixpkgs.lib.nixosSystem {
       system = "x86_64-linux";
       specialArgs = attrs;
-      modules = [./hosts/server1/configuration.nix];
+      modules = [
+        ./hosts/server1/configuration.nix
+        simple-nixos-mailserver.nixosModule
+        {
+          mailserver = {
+            enable = true;
+            fqdn = "server1.vhack.eu";
+            domains = ["vhack.eu"];
+
+            mailDirectory = "/srv/mail/vmail";
+            dkimKeyDirectory = "/srv/mail/dkim";
+            backup.snapshotRoot = "/srv/mail/backup";
+
+            loginAccounts = {
+              "sils@vhack.eu" = {
+                hashedPasswordFile = "/srv/mail/.secrets/silsmailpswd";
+              };
+            };
+
+            extraVirtualAliases = {
+              "abuse@vhack.eu" = ["sils@vhack.eu"];
+              "postmaster@vhack.eu" = ["sils@vhack.eu"];
+            };
+
+            sieveDirectory = "/srv/mail/sieve";
+            keyFile = "/var/lib/acme/server1.vhack.eu/key.pem";
+            certificateScheme = 1;
+            certificateFile = "/var/lib/acme/server1.vhack.eu/fullchain.pem";
+          };
+        }
+      ];
     };
   };
 }