nixos/services.prometheus.alertmanagerIrcRelay: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-30 00:47:00 +02:00
parent 500c84cedd
commit c617a4cb83

View File

@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.prometheus.alertmanagerIrcRelay;
@ -10,19 +7,19 @@ let
in
{
options.services.prometheus.alertmanagerIrcRelay = {
enable = mkEnableOption "Alertmanager IRC Relay";
enable = lib.mkEnableOption "Alertmanager IRC Relay";
package = mkPackageOption pkgs "alertmanager-irc-relay" { };
package = lib.mkPackageOption pkgs "alertmanager-irc-relay" { };
extraFlags = mkOption {
type = types.listOf types.str;
extraFlags = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
description = "Extra command line options to pass to alertmanager-irc-relay.";
};
settings = mkOption {
settings = lib.mkOption {
type = configFormat.type;
example = literalExpression ''
example = lib.literalExpression ''
{
http_host = "localhost";
http_port = 8000;
@ -50,7 +47,7 @@ in
};
};
config = mkIf cfg.enable {
config = lib.mkIf cfg.enable {
systemd.services.alertmanager-irc-relay = {
description = "Alertmanager IRC Relay";
@ -61,7 +58,7 @@ in
ExecStart = ''
${cfg.package}/bin/alertmanager-irc-relay \
-config ${configFile} \
${escapeShellArgs cfg.extraFlags}
${lib.escapeShellArgs cfg.extraFlags}
'';
DynamicUser = true;
@ -98,5 +95,5 @@ in
};
};
meta.maintainers = [ maintainers.oxzi ];
meta.maintainers = [ lib.maintainers.oxzi ];
}