732ed7081d
Some checks are pending
Check meta / check_meta (push) Successful in 22s
Check meta / check_dns (push) Successful in 42s
build configuration / build_vault01 (pull_request) Successful in 1m7s
build configuration / build_compute01 (push) Waiting to run
build configuration / build_storage01 (push) Waiting to run
build configuration / build_vault01 (push) Waiting to run
build configuration / build_web01 (push) Waiting to run
build configuration / build_web02 (push) Waiting to run
build configuration / build_rescue01 (push) Waiting to run
lint / check (push) Waiting to run
build configuration / build_storage01 (pull_request) Successful in 1m20s
build configuration / build_web02 (pull_request) Successful in 55s
build configuration / build_compute01 (pull_request) Successful in 1m28s
build configuration / build_rescue01 (pull_request) Successful in 1m3s
build configuration / build_web01 (pull_request) Successful in 2m15s
46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
|
|
options.dgn-notify = {
|
|
enable = lib.mkEnableOption "DGNum email notification cli" // {
|
|
default = true;
|
|
};
|
|
};
|
|
config = lib.mkIf config.dgn-notify.enable {
|
|
programs.msmtp = {
|
|
enable = true;
|
|
setSendmail = false;
|
|
accounts.default = {
|
|
tls = true;
|
|
tls_starttls = false;
|
|
port = 465;
|
|
auth = true;
|
|
host = "kurisu.lahfa.xyz";
|
|
from = "noreply@infra.dgnum.eu";
|
|
user = "web-services@infra.dgnum.eu";
|
|
passwordeval = "cat ${config.age.secrets.mail.path}";
|
|
};
|
|
};
|
|
services.systemd-notify = {
|
|
enable = true;
|
|
command = builtins.toString (
|
|
pkgs.writeShellScript "sendmail" ''
|
|
${pkgs.msmtp}/bin/sendmail -i -t <<ERRMAIL
|
|
To: admins+monitoring@dgnum.eu
|
|
Subject: [$HOSTNAME] Systemd failure: $1
|
|
Content-Transfer-Encoding: 8bit
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
$(systemctl status --full "$1")
|
|
ERRMAIL
|
|
''
|
|
);
|
|
};
|
|
age-secrets.sources = [ ./. ];
|
|
};
|
|
}
|