overlay/modules/matrix-alertmanager-receiver.nix
2024-07-10 00:06:00 +02:00

38 lines
1,003 B
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.services.matrix-alertmanager-receiver;
in
{
options.services.matrix-alertmanager-receiver = {
enable = lib.mkEnableOption "matrix-alertmanager-receiver, a Matrix bridge for Alertmanager webhooks";
configFile = lib.mkOption {
type = lib.types.path;
default = "";
example = "/run/secrets/matrix-alertmanager-receiver.toml";
description = ''
The TOML config file
'';
};
};
config = lib.mkIf cfg.enable {
systemd.services.matrix-alertmanager-receiver = {
description = "Matrix bridge for Alertmanager webhooks";
after = [
"network.target"
"network-online.target"
];
wantedBy = [
"multi-user.target"
];
serviceConfig = {
DynamicUser = true;
User = "matrix-alertmanager-receiver";
ExecStart = "${pkgs.matrix-alertmanager-receiver}/bin/matrix-alertmanager-receiver -config ${cfg.configFile}";
};
};
};
}