diff --git a/hosts/nixos/porthos/services.nix b/hosts/nixos/porthos/services.nix index c3ffa39..c872160 100644 --- a/hosts/nixos/porthos/services.nix +++ b/hosts/nixos/porthos/services.nix @@ -41,7 +41,7 @@ in enable = true; mail = { enable = true; - host = "smtp.migadu.com:465"; + host = "smtp.migadu.com"; user = lib.my.mkMailAddress "gitea" "belanyi.fr"; passwordFile = secrets."gitea/mail-password".path; }; diff --git a/modules/nixos/services/gitea/default.nix b/modules/nixos/services/gitea/default.nix index e7f39a5..6185a22 100644 --- a/modules/nixos/services/gitea/default.nix +++ b/modules/nixos/services/gitea/default.nix @@ -18,9 +18,15 @@ in }; host = mkOption { type = types.str; - example = "smtp.example.com:465"; + example = "smtp.example.com"; description = "Host for the mail account"; }; + port = mkOption { + type = types.port; + default = 465; + example = 587; + description = "Port for the mail account"; + }; user = mkOption { type = types.str; example = "gitea@example.com"; @@ -31,17 +37,11 @@ in example = "/run/secrets/gitea-mail-password.txt"; description = "Password for the mail account"; }; - type = mkOption { + protocol = mkOption { type = types.str; - default = "smtp"; + default = "smtps"; example = "smtp"; - description = "Password for the mail account"; - }; - tls = mkOption { - type = types.bool; - default = true; - example = false; - description = "Use TLS for connection"; + description = "Protocol for connection"; }; }; }; @@ -86,11 +86,11 @@ in mailer = lib.mkIf cfg.mail.enable { ENABLED = true; - HOST = cfg.mail.host; + SMTP_ADDR = cfg.mail.host; + SMTP_PORT = cfg.mail.port; FROM = cfg.mail.user; USER = cfg.mail.user; - MAILER_TYPE = cfg.mail.type; - IS_TLS_ENABLED = cfg.mail.tls; + PROTOCOL = cfg.mail.protocol; }; service = {