configuration/packages/systemd-alert.nix

14 lines
367 B
Nix
Raw Normal View History

2023-01-13 19:19:41 +00:00
{ pkgs, ... }:
{
systemd.services."alert@" = {
description = "Alert of failed %I";
serviceConfig.SyslogIdentifier = "%p";
serviceConfig.Type = "oneshot";
serviceConfig.ExecStart = with pkgs; ''
${bash}/bin/bash -c "${system-sendmail}/bin/sendmail -i root \
<<< $'Subject: %I failed\n\n'\"$(systemctl --full status %I)\""
'';
};
}