diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-04-21 02:15:42 +0300 |
commit | e6ed60548397627bf10f561f9438201dbba0a36e (patch) | |
tree | f9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/nixos/ntfy.nix | |
parent | 9ac64328603d44bd272175942d3ea3eaadcabd04 (diff) |
2024-04-21
Diffstat (limited to 'modules/nixos/ntfy.nix')
-rw-r--r-- | modules/nixos/ntfy.nix | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/modules/nixos/ntfy.nix b/modules/nixos/ntfy.nix deleted file mode 100644 index 5739855..0000000 --- a/modules/nixos/ntfy.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ - config, - lib, - libNginx, - this, - ... -}: -with lib; -let - cfg = config.nixfiles.modules.ntfy; -in -{ - options.nixfiles.modules.ntfy = { - enable = mkEnableOption "ntfy"; - - port = mkOption { - description = "Port."; - type = types.port; - default = 2586; - }; - - domain = mkOption { - description = "Domain name sans protocol scheme."; - type = with types; str; - default = "ntfy.${config.networking.domain}"; - }; - - prometheus = { - enable = mkEnableOption "Prometheus exporter." // { - default = true; - }; - - address = mkOption { - description = "Address."; - type = with types; str; - default = this.wireguard.ipv4.address; - }; - - port = mkOption { - description = "Port."; - type = with types; port; - default = 9289; - }; - }; - }; - - config = mkIf cfg.enable { - ark.files = [ config.services.ntfy-sh.settings.auth-file ]; - - nixfiles.modules.nginx = { - enable = true; - upstreams.ntfy.servers.${config.services.ntfy-sh.settings.listen-http} = { }; - virtualHosts.${cfg.domain} = { - locations = { - "/" = { - proxyPass = "http://ntfy"; - proxyWebsockets = true; - }; - "/metrics".extraConfig = '' - deny all; - ''; - }; - extraConfig = libNginx.config.internalOnly; - }; - }; - - services.ntfy-sh = { - enable = true; - settings = { - listen-http = "127.0.0.1:${toString cfg.port}"; - 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}"; - }; - }; - }; -} |