2024-07-13 13:34:59 -04:00
|
|
|
# See https://wiki.nixos.org/wiki/Msmtp
|
2024-05-16 13:35:11 -04:00
|
|
|
{ config, lib, ... }:
|
2024-02-29 09:53:34 -05:00
|
|
|
|
|
|
|
let
|
2024-06-24 11:38:28 -04:00
|
|
|
cfg = config.aux.system.services.msmtp;
|
2024-02-29 09:53:34 -05:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 18:02:59 -04:00
|
|
|
options = {
|
2024-08-02 17:55:48 -04:00
|
|
|
aux.system.services.msmtp.enable = lib.mkEnableOption "Enables mail server";
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-02-29 09:53:34 -05:00
|
|
|
|
2024-08-02 17:55:48 -04:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-05-07 18:02:59 -04:00
|
|
|
programs.msmtp = {
|
|
|
|
enable = true;
|
2024-08-16 15:41:13 -04:00
|
|
|
defaults.aliases = "/etc/aliases";
|
2024-05-16 12:19:04 -04:00
|
|
|
accounts.default = {
|
2024-06-24 12:24:21 -04:00
|
|
|
host = config.secrets.services.msmtp.host;
|
2024-05-16 13:35:11 -04:00
|
|
|
user = config.secrets.services.msmtp.user;
|
|
|
|
password = config.secrets.services.msmtp.password;
|
2024-05-16 12:19:04 -04:00
|
|
|
auth = true;
|
|
|
|
tls = true;
|
|
|
|
tls_starttls = true;
|
|
|
|
port = 587;
|
2024-09-02 11:06:57 -04:00
|
|
|
from = "${config.networking.hostName}@${config.secrets.networking.domains.primary}";
|
2024-05-16 12:19:04 -04:00
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-08-16 15:41:13 -04:00
|
|
|
|
|
|
|
# Send all mail to my email address by default
|
|
|
|
environment.etc."aliases" = {
|
|
|
|
text = ''
|
|
|
|
default: ${config.secrets.users.aires.email}
|
|
|
|
'';
|
|
|
|
mode = "0644";
|
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
|
|
|
}
|