about summary refs log tree commit diff stats
path: root/modules/by-name
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-04 20:14:45 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-03-09 13:44:29 +0100
commit1a82257636d92ce21ba3275d85955074a4091341 (patch)
tree27a9071a661e9e31bf01b959397cca59e30657d0 /modules/by-name
parentmodules/dns: Add service dependencies (diff)
downloadnixos-server-1a82257636d92ce21ba3275d85955074a4091341.zip
modules/stalwart-mail: Avoid hardcoding `vhack.eu` email address
Diffstat (limited to 'modules/by-name')
-rw-r--r--modules/by-name/st/stalwart-mail/module.nix19
-rw-r--r--modules/by-name/st/stalwart-mail/settings.nix4
2 files changed, 21 insertions, 2 deletions
diff --git a/modules/by-name/st/stalwart-mail/module.nix b/modules/by-name/st/stalwart-mail/module.nix
index 4595c21..76149c3 100644
--- a/modules/by-name/st/stalwart-mail/module.nix
+++ b/modules/by-name/st/stalwart-mail/module.nix
@@ -20,6 +20,18 @@ in {
 
     package = lib.mkPackageOption vhackPackages "stalwart-mail-free" {};
 
+    admin = lib.mkOption {
+      description = ''
+        Email address to advertise as administrator. This is the address, where dkim, spv
+        etc. refusal reports are sent to.
+
+        The format should be: `mailto:<name>@<domain>`
+      '';
+      type = lib.types.str;
+      example = "mailto:dmarc+rua@example.com";
+      default = "";
+    };
+
     fqdn = lib.mkOption {
       type = lib.types.str;
       example = "mail.foss-syndicate.org";
@@ -103,6 +115,13 @@ in {
   };
 
   config = lib.mkIf cfg.enable {
+    assertions = [
+      {
+        assertion = cfg.admin != "";
+        message = "You need to specify an admin address.";
+      }
+    ];
+
     services.stalwart-mail = {
       # NOTE(@bpeetz): We do not use the nixos service, as it comes with too much
       # bothersome default configuration and not really any useful config.
diff --git a/modules/by-name/st/stalwart-mail/settings.nix b/modules/by-name/st/stalwart-mail/settings.nix
index 0f382ee..06b5062 100644
--- a/modules/by-name/st/stalwart-mail/settings.nix
+++ b/modules/by-name/st/stalwart-mail/settings.nix
@@ -57,7 +57,7 @@ in {
         from-name = "'TLS Report'";
         from-address = "'noreply-tls@${cfg.fqdn}'";
         org-name = "'Foss Syndicate Mail Handling'";
-        contact-info = "'admin@vhack.eu'";
+        contact-info = "'${cfg.admin}'";
         send = "daily";
         max-size = 26214400; # 25 MiB
         sign = lib.mkIf (cfg.security != null) "['ed25519']";
@@ -67,7 +67,7 @@ in {
           from-name = "'DMARC Report'";
           from-address = "'noreply-dmarc@${cfg.fqdn}'";
           org-name = "'Foss Syndicate Mail Handling'";
-          contact-info = "'admin@vhack.eu'";
+          contact-info = "'${cfg.admin}'";
           send = "weekly";
           max-size = 26214400; # 25MiB
           sign = lib.mkIf (cfg.security != null) "['ed25519']";