1 { config, lib, pkgs, ... }:
6 cfg = config.services.prometheus.alertmanagerIrcRelay;
8 configFormat = pkgs.formats.yaml { };
9 configFile = configFormat.generate "alertmanager-irc-relay.yml" cfg.settings;
12 options.services.prometheus.alertmanagerIrcRelay = {
13 enable = mkEnableOption "Alertmanager IRC Relay";
15 package = mkPackageOption pkgs "alertmanager-irc-relay" { };
17 extraFlags = mkOption {
18 type = types.listOf types.str;
20 description = "Extra command line options to pass to alertmanager-irc-relay.";
24 type = configFormat.type;
25 example = literalExpression ''
27 http_host = "localhost";
30 irc_host = "irc.example.com";
32 irc_nickname = "myalertbot";
35 { name = "#mychannel"; }
40 Configuration for Alertmanager IRC Relay as a Nix attribute set.
41 For a reference, check out the
42 [example configuration](https://github.com/google/alertmanager-irc-relay#configuring-and-running-the-bot)
44 [source code](https://github.com/google/alertmanager-irc-relay/blob/master/config.go).
46 Note: The webhook's URL MUST point to the IRC channel where the message
47 should be posted. For `#mychannel` from the example, this would be
48 `http://localhost:8080/mychannel`.
53 config = mkIf cfg.enable {
54 systemd.services.alertmanager-irc-relay = {
55 description = "Alertmanager IRC Relay";
57 wantedBy = [ "multi-user.target" ];
58 after = [ "network-online.target" ];
62 ${cfg.package}/bin/alertmanager-irc-relay \
63 -config ${configFile} \
64 ${escapeShellArgs cfg.extraFlags}
68 NoNewPrivileges = true;
70 ProtectProc = "invisible";
71 ProtectSystem = "strict";
72 ProtectHome = "tmpfs";
75 PrivateDevices = true;
78 ProtectHostname = true;
80 ProtectKernelTunables = true;
81 ProtectKernelModules = true;
82 ProtectKernelLogs = true;
83 ProtectControlGroups = true;
85 RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
86 RestrictRealtime = true;
87 RestrictSUIDSGID = true;
101 meta.maintainers = [ maintainers.oxzi ];