summary refs log tree commit diff
path: root/nixos/modules/services/monitoring
diff options
context:
space:
mode:
authorGeorg Haas <hax404foogit@hax404.de>2021-04-29 23:30:36 +0200
committerGeorg Haas <hax404foogit@hax404.de>2021-05-19 01:08:38 +0200
commit03c092579a32d05de1ecc46b8307e5da06ed57b6 (patch)
tree90a235c67abf899f93fb3c5570ba74e967a5f277 /nixos/modules/services/monitoring
parent41f448f2fcdd79f5478caaab05b0461ab359e1d5 (diff)
downloadnixpkgs-03c092579a32d05de1ecc46b8307e5da06ed57b6.tar
nixpkgs-03c092579a32d05de1ecc46b8307e5da06ed57b6.tar.gz
nixpkgs-03c092579a32d05de1ecc46b8307e5da06ed57b6.tar.bz2
nixpkgs-03c092579a32d05de1ecc46b8307e5da06ed57b6.tar.lz
nixpkgs-03c092579a32d05de1ecc46b8307e5da06ed57b6.tar.xz
nixpkgs-03c092579a32d05de1ecc46b8307e5da06ed57b6.tar.zst
nixpkgs-03c092579a32d05de1ecc46b8307e5da06ed57b6.zip
prometheus-xmpp-alerts: apply RFC 42
Diffstat (limited to 'nixos/modules/services/monitoring')
-rw-r--r--nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix26
1 files changed, 17 insertions, 9 deletions
diff --git a/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix b/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix
index 44b15cb2034..980c93c9c47 100644
--- a/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix
+++ b/nixos/modules/services/monitoring/prometheus/xmpp-alerts.nix
@@ -4,21 +4,29 @@ with lib;
 
 let
   cfg = config.services.prometheus.xmpp-alerts;
-
-  configFile = pkgs.writeText "prometheus-xmpp-alerts.yml" (builtins.toJSON cfg.configuration);
-
+  settingsFormat = pkgs.formats.yaml {};
+  configFile = settingsFormat.generate "prometheus-xmpp-alerts.yml" cfg.settings;
 in
-
 {
-  options.services.prometheus.xmpp-alerts = {
+  imports = [
+    (mkRenamedOptionModule
+      [ "services" "prometheus" "xmpp-alerts" "configuration" ]
+      [ "services" "prometheus" "xmpp-alerts" "settings" ])
+  ];
 
+  options.services.prometheus.xmpp-alerts = {
     enable = mkEnableOption "XMPP Web hook service for Alertmanager";
 
-    configuration = mkOption {
-      type = types.attrs;
-      description = "Configuration as attribute set which will be converted to YAML";
-    };
+    settings = mkOption {
+      type = settingsFormat.type;
+      default = {};
 
+      description = ''
+        Configuration for prometheus xmpp-alerts, see
+        <link xlink:href="https://github.com/jelmer/prometheus-xmpp-alerts/blob/master/xmpp-alerts.yml.example"/>
+        for supported values.
+      '';
+    };
   };
 
   config = mkIf cfg.enable {