diff options
author | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
commit | 59180328cda59817d71cd58c8f48ead047375064 (patch) | |
tree | 2cdd7d1bfa309839ef624c19daf283f510aacf69 /modules/alertmanager.nix | |
parent | 2025-02-05 (diff) |
2025-02-17
Diffstat (limited to '')
-rw-r--r-- | modules/alertmanager.nix | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/modules/alertmanager.nix b/modules/alertmanager.nix index e5366e5..94c21b0 100644 --- a/modules/alertmanager.nix +++ b/modules/alertmanager.nix @@ -6,7 +6,6 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.alertmanager; in @@ -14,22 +13,22 @@ in imports = [ inputs.alertmanager-ntfy.nixosModules.default ]; options.nixfiles.modules.alertmanager = { - enable = mkEnableOption "Alertmanager"; + enable = lib.mkEnableOption "Alertmanager"; - port = mkOption { + port = lib.mkOption { description = "Port."; - type = with types; port; + type = lib.types.port; default = 30112; }; - domain = mkOption { + domain = lib.mkOption { description = "Domain name sans protocol scheme."; - type = with types; nullOr str; + type = with lib.types; nullOr str; default = "alertmanager.${config.networking.domain}"; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { nixfiles.modules = { ntfy.enable = true; nginx = { @@ -56,18 +55,18 @@ in configuration = { global = { - smtp_from = "alertmanager@${my.domain.shire}"; - smtp_smarthost = "${my.domain.shire}:584"; + smtp_from = "alertmanager@${lib.my.domain.shire}"; + smtp_smarthost = "${lib.my.domain.shire}:584"; }; route = { - receiver = my.username; + receiver = lib.my.username; group_by = [ "alertname" ]; }; receivers = [ { - name = my.username; + name = lib.my.username; webhook_configs = [ { url = with config.services.alertmanager-ntfy; "http://${httpAddress}:${httpPort}"; } ]; @@ -86,13 +85,11 @@ in envFile = "/dev/null"; }; - topology = with cfg; { - nodes.${this.hostname}.services.alertmanager = { - name = "Alertmanager"; - icon = "${inputs.homelab-svg-assets}/assets/prometheus.svg"; - info = domain; - details.listen.text = "127.0.0.1:${toString port}"; - }; + topology.nodes.${this.hostname}.services.alertmanager = { + name = "Alertmanager"; + icon = "${inputs.homelab-svg-assets}/assets/prometheus.svg"; + info = cfg.domain; + details.listen.text = "127.0.0.1:${toString cfg.port}"; }; }; } |