diff options
Diffstat (limited to '')
-rw-r--r-- | modules/ntfy.nix | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/modules/ntfy.nix b/modules/ntfy.nix index e3de72e..422df2e 100644 --- a/modules/ntfy.nix +++ b/modules/ntfy.nix @@ -6,46 +6,45 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.ntfy; in { options.nixfiles.modules.ntfy = { - enable = mkEnableOption "ntfy"; + enable = lib.mkEnableOption "ntfy"; - port = mkOption { + port = lib.mkOption { description = "Port."; - type = types.port; + type = lib.types.port; default = 2586; }; - domain = mkOption { + domain = lib.mkOption { description = "Domain name sans protocol scheme."; - type = with types; str; + type = lib.types.str; default = "ntfy.${config.networking.domain}"; }; prometheus = { - enable = mkEnableOption "Prometheus exporter." // { + enable = lib.mkEnableOption "Prometheus exporter." // { default = true; }; - address = mkOption { + address = lib.mkOption { description = "Address."; - type = with types; str; + type = lib.types.str; default = this.wireguard.ipv4.address; }; - port = mkOption { + port = lib.mkOption { description = "Port."; - type = with types; port; + type = lib.types.port; default = 9289; }; }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { ark.files = [ config.services.ntfy-sh.settings.auth-file ]; nixfiles.modules.nginx = { @@ -72,19 +71,15 @@ in base-url = "https://${cfg.domain}"; behind-proxy = true; enable-metrics = cfg.prometheus.enable; - metrics-listen-http = - with cfg.prometheus; - optionalString cfg.prometheus.enable "${address}:${toString port}"; + metrics-listen-http = with cfg.prometheus; lib.optionalString enable "${address}:${toString port}"; }; }; - topology = with cfg; { - nodes.${this.hostname}.services.ntfy = { - name = "ntfy"; - icon = "${inputs.homelab-svg-assets}/assets/ntfy.svg"; - info = domain; - details.listen.text = config.services.ntfy-sh.settings.listen-http; - }; + topology.nodes.${this.hostname}.services.ntfy = { + name = "ntfy"; + icon = "${inputs.homelab-svg-assets}/assets/ntfy.svg"; + info = cfg.domain; + details.listen.text = config.services.ntfy-sh.settings.listen-http; }; }; } |