@cryptotaxi247 / infra / commits / 45f47c04

mailserver: Allow forwardTo to be empty

Dionysis Grigoropoulos committed Jul 2, 2025 at 11:41 UTC 45f47c04b410d02a3eea81b33d451bb9735d2276
1 file changed +6
non-critical-infra/modules/mailserver/mailing-lists-options.nix
+6
@@ -42,6 +42,7 @@ in
42 options = {
43 forwardTo = lib.mkOption {
44 type = types.listOf (types.either types.str types.path);
45 + default = [ ];
46 description = ''
47 Either a plaintext email address, or a path to an email address
48 encrypted with `nix run .#encrypt-email address`
@@ -81,6 +82,11 @@ in
82 };
83
84 config = {
85 + assertions = lib.mapAttrsToList (name: mailingList: {
86 + assertion = mailingList.forwardTo != [ ] || mailingList.loginAccount != null;
87 + message = "Mailing list '${name}' must have either forwardTo addresses or a loginAccount configured";
88 + }) config.mailing-lists;
89 +
90 mailserver.loginAccounts = lib.pipe config.mailing-lists [
91 (lib.filterAttrs (_name: mailingList: mailingList.loginAccount != null))
92 (lib.mapAttrs (