From c81dc5a13b469c511fac6fa2390b70422d1b4da5 Mon Sep 17 00:00:00 2001 From: azahi Date: Wed, 12 Mar 2025 20:17:13 +0300 Subject: 2025-03-12 --- modules/ntfy.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'modules/ntfy.nix') diff --git a/modules/ntfy.nix b/modules/ntfy.nix index 422df2e..7145bbf 100644 --- a/modules/ntfy.nix +++ b/modules/ntfy.nix @@ -33,7 +33,7 @@ in address = lib.mkOption { description = "Address."; type = lib.types.str; - default = this.wireguard.ipv4.address; + default = "127.0.0.1"; }; port = lib.mkOption { @@ -75,6 +75,22 @@ in }; }; + environment.etc."alloy/ntfy.alloy".text = lib.optionalString cfg.prometheus.enable '' + prometheus.scrape "ntfy" { + targets = [ + { + __address__ = "127.0.0.1:${toString cfg.prometheus.port}", + instance = "${config.networking.hostName}", + }, + ] + forward_to = [prometheus.relabel.default.receiver] + } + ''; + + systemd.services.alloy.reloadTriggers = lib.optionals cfg.prometheus.enable [ + config.environment.etc."alloy/ntfy.alloy".source + ]; + topology.nodes.${this.hostname}.services.ntfy = { name = "ntfy"; icon = "${inputs.homelab-svg-assets}/assets/ntfy.svg"; -- cgit 1.4.1