diff options
Diffstat (limited to 'modules/nixos')
| -rw-r--r-- | modules/nixos/personal/monitoring.nix | 33 | ||||
| -rw-r--r-- | modules/nixos/personal/system.nix | 2 |
2 files changed, 20 insertions, 15 deletions
diff --git a/modules/nixos/personal/monitoring.nix b/modules/nixos/personal/monitoring.nix index e054c51..01fe201 100644 --- a/modules/nixos/personal/monitoring.nix +++ b/modules/nixos/personal/monitoring.nix @@ -3,22 +3,27 @@ lib, pkgs, ... -}: { - options.systemd.services = lib.mkOption { - type = with lib.types; - attrsOf (submodule ({ - name, - config, - lib, - ... - }: { - options.personal.monitor = - lib.mkEnableOption "e-mail monitoring for the ${name} seervice"; - config.onFailure = lib.optional config.personal.monitor "notify@%i.service"; - })); +}: let + cfg = config.personal.monitoring; +in { + options = { + personal.monitoring.enable = lib.mkEnableOption "e-mail monitoring of systemd services"; + systemd.services = lib.mkOption { + type = with lib.types; + attrsOf (submodule ({ + name, + config, + lib, + ... + }: { + options.personal.monitor = + lib.mkEnableOption "e-mail monitoring for the ${name} seervice"; + config.onFailure = lib.optional config.personal.monitor "notify@%i.service"; + })); + }; }; - config = { + config = lib.mkIf cfg.enable { programs.msmtp = { enable = true; accounts.default = { diff --git a/modules/nixos/personal/system.nix b/modules/nixos/personal/system.nix index 51f3351..4ed6fb2 100644 --- a/modules/nixos/personal/system.nix +++ b/modules/nixos/personal/system.nix @@ -70,7 +70,7 @@ in { StartLimitIntervalSec = 300; StartLimitBurst = 5; }; - serviceConfig = { + serviceConfig = lib.mkIf (!config.personal.monitoring.enable) { Restart = "on-abort"; RestartSec = 30; }; |
