diff --git a/modules/clan/prometheus/default.nix b/modules/clan/prometheus/default.nix index 9a9980c..f3889d6 100644 --- a/modules/clan/prometheus/default.nix +++ b/modules/clan/prometheus/default.nix @@ -45,7 +45,47 @@ type = with lib.types; str; description = "Matrix user for the bot"; }; - matrixRooms = options.services.matrix-alertmanager.matrixRooms; + matrixRooms = lib.mkOption { + type = lib.types.listOf ( + lib.types.submodule { + options = { + receivers = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = "List of receivers for this room"; + }; + roomId = lib.mkOption { + type = lib.types.str; + description = "Matrix room ID"; + apply = + x: + assert lib.assertMsg (lib.hasPrefix "!" x) "Matrix room ID must start with a '!'. Got: ${x}"; + x; + }; + }; + } + ); + description = '' + Combination of Alertmanager receiver(s) and rooms for the bot to join. + Each Alertmanager receiver can be mapped to post to a matrix room. + + Note, you must use a room ID and not a room alias/name. Room IDs start + with a "!". + ''; + example = [ + { + receivers = [ + "receiver1" + "receiver2" + ]; + roomId = "!roomid@example.com"; + } + { + receivers = [ "receiver3" ]; + roomId = "!differentroomid@example.com"; + } + ]; + }; + }; }; }; @@ -170,7 +210,7 @@ ''; } ] - ++ settings.extraRules; + ++ settings.extra_rules; } ]; })