feat(systems): enable email notifications on failure
- Added `emailOnFailure.enable` option to metacfg with a default of `false`. - Enabled email notifications on failure for SGX and MX systems. - Enhanced `systemd-email-notify` module to support the new configuration.
This commit is contained in:
parent
57c8f86fde
commit
5b0cab98d5
3 changed files with 10 additions and 3 deletions
|
|
@ -4,10 +4,11 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
with lib.metacfg;
|
||||||
let
|
let
|
||||||
|
cfg = config.metacfg.emailOnFailure;
|
||||||
|
|
||||||
checkConditions = pkgs.writeScript "checkConditions" ''
|
checkConditions = pkgs.writeScript "checkConditions" ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
STATUS=$(systemctl status --full "$1")
|
STATUS=$(systemctl status --full "$1")
|
||||||
|
|
@ -34,6 +35,10 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
metacfg.emailOnFailure = with types; {
|
||||||
|
enable = mkBoolOpt false "Whether or not to send mails on failure.";
|
||||||
|
};
|
||||||
|
|
||||||
systemd.email-notify.mailTo = mkOption {
|
systemd.email-notify.mailTo = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "admin";
|
default = "admin";
|
||||||
|
|
@ -55,7 +60,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = mkIf cfg.enable {
|
||||||
systemd.services."email@" = {
|
systemd.services."email@" = {
|
||||||
description = "Sends a status mail via sendmail on service failures.";
|
description = "Sends a status mail via sendmail on service failures.";
|
||||||
onFailure = mkForce [ ];
|
onFailure = mkForce [ ];
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
metacfg = {
|
metacfg = {
|
||||||
|
emailOnFailure.enable = true;
|
||||||
base.enable = true;
|
base.enable = true;
|
||||||
nix.enable = true;
|
nix.enable = true;
|
||||||
podman.enable = true;
|
podman.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
metacfg = {
|
metacfg = {
|
||||||
|
emailOnFailure.enable = true;
|
||||||
base.enable = true;
|
base.enable = true;
|
||||||
gui.enable = true;
|
gui.enable = true;
|
||||||
nix-ld.enable = true;
|
nix-ld.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue