Use sender and recipient variables for msmtp
This commit is contained in:
parent
92c427b79f
commit
2d59419197
|
@ -2,28 +2,48 @@
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
{
|
let
|
||||||
|
sender = "akasroua@disroot.org";
|
||||||
|
recipient = "akasroua+smart@disroot.org";
|
||||||
|
|
||||||
|
in {
|
||||||
# Notify when a disk starts going haywire
|
# Notify when a disk starts going haywire
|
||||||
services.smartd = {
|
services.smartd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
notifications.mail = {
|
notifications.mail = {
|
||||||
enable = true;
|
enable = true;
|
||||||
sender = "akasroua+smartd@disroot.org";
|
sender = sender;
|
||||||
recipient = "akasroua@disroot.org";
|
recipient = recipient;
|
||||||
mailer = "${msmtp}/bin/msmtp -t --read-envelope-from";
|
mailer = "${msmtp}/bin/msmtp -t --read-envelope-from";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Notify about zpool problems
|
||||||
|
services.zfs.zed = {
|
||||||
|
enableMail = false;
|
||||||
|
settings = {
|
||||||
|
ZED_EMAIL_ADDR = [ "root" ];
|
||||||
|
ZED_EMAIL_PROG = "${msmtp}/bin/msmtp";
|
||||||
|
ZED_EMAIL_OPTS = "-s '@SUBJECT@' @ADDRESS@";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# HACK Use an alias to use msmtp instead of the ZED mailer
|
||||||
|
environment.etc.aliases.text = ''
|
||||||
|
root: ${recipient}
|
||||||
|
'';
|
||||||
|
|
||||||
# Set up msmtp as notifier
|
# Set up msmtp as notifier
|
||||||
programs.msmtp = {
|
programs.msmtp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaults = {
|
defaults = {
|
||||||
|
auth = true;
|
||||||
|
aliases = "/etc/aliases";
|
||||||
port = 587;
|
port = 587;
|
||||||
tls = true;
|
tls = true;
|
||||||
};
|
};
|
||||||
accounts = {
|
accounts = {
|
||||||
default = {
|
default = {
|
||||||
auth = true;
|
|
||||||
host = "disroot.org";
|
host = "disroot.org";
|
||||||
user = "akasroua@disroot.org";
|
user = "akasroua@disroot.org";
|
||||||
passwordeval = "${coreutils}/bin/cat ${config.age.secrets.msmtp.path}";
|
passwordeval = "${coreutils}/bin/cat ${config.age.secrets.msmtp.path}";
|
||||||
|
|
Loading…
Reference in New Issue