From e6ed60548397627bf10f561f9438201dbba0a36e Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 21 Apr 2024 02:15:42 +0300 Subject: 2024-04-21 --- modules/nixos/alertmanager.nix | 88 ------------------------------------------ 1 file changed, 88 deletions(-) delete mode 100644 modules/nixos/alertmanager.nix (limited to 'modules/nixos/alertmanager.nix') diff --git a/modules/nixos/alertmanager.nix b/modules/nixos/alertmanager.nix deleted file mode 100644 index a3457bc..0000000 --- a/modules/nixos/alertmanager.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ - config, - inputs, - lib, - libNginx, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.alertmanager; -in -{ - imports = [ inputs.alertmanager-ntfy.nixosModules.default ]; - - options.nixfiles.modules.alertmanager = { - enable = mkEnableOption "Alertmanager"; - - port = mkOption { - description = "Port."; - type = with types; port; - default = 30112; - }; - - domain = mkOption { - description = "Domain name sans protocol scheme."; - type = with types; nullOr str; - default = "alertmanager.${config.networking.domain}"; - }; - }; - - config = mkIf cfg.enable { - nixfiles.modules = { - ntfy.enable = true; - nginx = { - enable = true; - upstreams.alertmanager.servers."127.0.0.1:${toString cfg.port}" = { }; - virtualHosts.${cfg.domain} = { - locations."/".proxyPass = "http://alertmanager"; - extraConfig = libNginx.config.internalOnly; - }; - }; - }; - - services = { - prometheus.alertmanager = { - enable = true; - - listenAddress = "127.0.0.1"; - inherit (cfg) port; - - extraFlags = [ - "--cluster.listen-address=\"\"" - "--web.external-url=https://${cfg.domain}" - ]; - - configuration = { - global = { - smtp_from = "alertmanager@${my.domain.shire}"; - smtp_smarthost = "${my.domain.shire}:584"; - }; - - route = { - receiver = my.username; - group_by = [ "alertname" ]; - }; - - receivers = [ - { - name = my.username; - webhook_configs = [ - { url = with config.services.alertmanager-ntfy; "http://${httpAddress}:${httpPort}"; } - ]; - } - ]; - }; - }; - }; - - services.alertmanager-ntfy = { - enable = true; - httpAddress = "127.0.0.1"; - httpPort = toString (config.nixfiles.modules.ntfy.port + 1); - ntfyTopic = "${config.services.ntfy-sh.settings.base-url}/alertmanager"; - ntfyPriority = "high"; - envFile = "/dev/null"; - }; - }; -} -- cgit v1.2.3