diff options
Diffstat (limited to 'modules/ntfy.nix')
-rw-r--r-- | modules/ntfy.nix | 18 |
1 files changed, 17 insertions, 1 deletions
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"; |