summaryrefslogtreecommitdiff
path: root/modules/nixos/ntfy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos/ntfy.nix')
-rw-r--r--modules/nixos/ntfy.nix17
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}";
};
};