diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-03-31 21:29:27 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-03-31 21:29:27 +0300 |
commit | 9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch) | |
tree | f28beec29deeea36038615a8fb98a810891940b5 /modules/nixos/ntfy.nix | |
parent | 2024-03-19 (diff) |
2024-03-31
Diffstat (limited to '')
-rw-r--r-- | modules/nixos/ntfy.nix | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/nixos/ntfy.nix b/modules/nixos/ntfy.nix index 037f84a..5739855 100644 --- a/modules/nixos/ntfy.nix +++ b/modules/nixos/ntfy.nix @@ -5,9 +5,11 @@ this, ... }: -with lib; let +with lib; +let cfg = config.nixfiles.modules.ntfy; -in { +in +{ options.nixfiles.modules.ntfy = { enable = mkEnableOption "ntfy"; @@ -24,7 +26,9 @@ in { }; prometheus = { - enable = mkEnableOption "Prometheus exporter." // {default = true;}; + enable = mkEnableOption "Prometheus exporter." // { + default = true; + }; address = mkOption { description = "Address."; @@ -41,11 +45,11 @@ in { }; config = mkIf cfg.enable { - ark.files = [config.services.ntfy-sh.settings.auth-file]; + ark.files = [ config.services.ntfy-sh.settings.auth-file ]; nixfiles.modules.nginx = { enable = true; - upstreams.ntfy.servers.${config.services.ntfy-sh.settings.listen-http} = {}; + upstreams.ntfy.servers.${config.services.ntfy-sh.settings.listen-http} = { }; virtualHosts.${cfg.domain} = { locations = { "/" = { @@ -67,7 +71,8 @@ in { base-url = "https://${cfg.domain}"; behind-proxy = true; enable-metrics = cfg.prometheus.enable; - metrics-listen-http = with cfg.prometheus; + metrics-listen-http = + with cfg.prometheus; optionalString cfg.prometheus.enable "${address}:${toString port}"; }; }; |