2024-04-20 13:42:06 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2023-07-29 03:28:08 +00:00
|
|
|
|
|
|
|
config = lib.mkIf (config.mail.enable || config.server) {
|
|
|
|
|
|
|
|
home-manager.users.${config.user} = {
|
|
|
|
|
|
|
|
programs.msmtp.enable = true;
|
2023-07-29 19:20:14 +00:00
|
|
|
|
|
|
|
# The system user for sending automatic notifications
|
2023-07-29 03:28:08 +00:00
|
|
|
accounts.email.accounts.system =
|
2024-04-20 13:42:06 +00:00
|
|
|
let
|
|
|
|
address = "system@${config.mail.server}";
|
|
|
|
in
|
|
|
|
{
|
2023-07-29 03:28:08 +00:00
|
|
|
userName = address;
|
|
|
|
realName = "NixOS System";
|
2023-07-29 19:20:14 +00:00
|
|
|
primary = !config.mail.enable; # Only primary if mail not enabled
|
2023-07-29 03:28:08 +00:00
|
|
|
inherit address;
|
2024-04-20 13:42:06 +00:00
|
|
|
passwordCommand = "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${pkgs.writeText "mailpass-system.age" (builtins.readFile ../../../private/mailpass-system.age)}";
|
2023-07-29 03:28:08 +00:00
|
|
|
msmtp.enable = true;
|
|
|
|
smtp = {
|
|
|
|
host = config.mail.smtpHost;
|
|
|
|
port = 465;
|
|
|
|
tls.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|