@@ -4,21 +4,29 @@ with lib;
44
55let
66 cfg = config.services.prometheus.xmpp-alerts;
7−
8− configFile = pkgs.writeText "prometheus-xmpp-alerts.yml" (builtins.toJSON cfg.configuration);
9−
7+ settingsFormat = pkgs.formats.yaml {};
8+ configFile = settingsFormat.generate "prometheus-xmpp-alerts.yml" cfg.settings;
109in
11−
1210{
13− options.services.prometheus.xmpp-alerts = {
11+ imports = [
12+ (mkRenamedOptionModule
13+ [ "services" "prometheus" "xmpp-alerts" "configuration" ]
14+ [ "services" "prometheus" "xmpp-alerts" "settings" ])
15+ ];
1416
17+ options.services.prometheus.xmpp-alerts = {
1518 enable = mkEnableOption "XMPP Web hook service for Alertmanager";
1619
17− configuration = mkOption {
18− type = types.attrs;
19− description = "Configuration as attribute set which will be converted to YAML";
20− };
20+ settings = mkOption {
21+ type = settingsFormat.type;
22+ default = {};
2123
24+ description = ''
25+ Configuration for prometheus xmpp-alerts, see
26+ <link xlink:href="https://github.com/jelmer/prometheus-xmpp-alerts/blob/master/xmpp-alerts.yml.example"/>
27+ for supported values.
28+ '';
29+ };
2230 };
2331
2432 config = mkIf cfg.enable {