From fc019d789523ce5f89436b8dbc458cf3b79abf43 Mon Sep 17 00:00:00 2001 From: aristote Date: Tue, 29 Jul 2025 15:25:11 +0200 Subject: reformat everything with nixfmt --- modules/nixos/personal/monitoring.nix | 57 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 24 deletions(-) (limited to 'modules/nixos/personal/monitoring.nix') diff --git a/modules/nixos/personal/monitoring.nix b/modules/nixos/personal/monitoring.nix index 01fe201..e5797fb 100644 --- a/modules/nixos/personal/monitoring.nix +++ b/modules/nixos/personal/monitoring.nix @@ -3,23 +3,30 @@ lib, pkgs, ... -}: let +}: +let cfg = config.personal.monitoring; -in { +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"; - })); + 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"; + } + ) + ); }; }; @@ -42,18 +49,20 @@ in { description = "Send the status of the %i service as an e-mail."; serviceConfig.type = "oneshot"; scriptArgs = "%i"; - script = let - netCfg = config.networking; - host = "${builtins.toString netCfg.hostName}.${builtins.toString netCfg.domain}"; - in '' - service="$1" - echo \ - "Subject: ${host}: service $service failed - Service $soervice failed on ${host}, with the following log: + script = + let + netCfg = config.networking; + host = "${builtins.toString netCfg.hostName}.${builtins.toString netCfg.domain}"; + in + '' + service="$1" + echo \ + "Subject: ${host}: service $service failed + Service $soervice failed on ${host}, with the following log: - $(journalctl --no-pager --unit $service --since -1h) - " | ${pkgs.msmtp}/bin/msmtp quentin@aristote.fr - ''; + $(journalctl --no-pager --unit $service --since -1h) + " | ${pkgs.msmtp}/bin/msmtp quentin@aristote.fr + ''; }; }; } -- cgit v1.2.3