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

This commit is contained in:
Felix Buehler 2024-08-30 00:47:02 +02:00
parent 3b6ddc5927
commit f9825ae100

View File

@ -1,7 +1,4 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.services.prometheus.sachet;
configFile = pkgs.writeText "sachet.yml" (builtins.toJSON cfg.configuration);
@ -9,12 +6,12 @@ in
{
options = {
services.prometheus.sachet = {
enable = mkEnableOption "Sachet, an SMS alerting tool for the Prometheus Alertmanager";
enable = lib.mkEnableOption "Sachet, an SMS alerting tool for the Prometheus Alertmanager";
configuration = mkOption {
type = types.nullOr types.attrs;
configuration = lib.mkOption {
type = lib.types.nullOr lib.types.attrs;
default = null;
example = literalExpression ''
example = lib.literalExpression ''
{
providers = {
twilio = {
@ -37,16 +34,16 @@ in
'';
};
address = mkOption {
type = types.str;
address = lib.mkOption {
type = lib.types.str;
default = "localhost";
description = ''
The address Sachet will listen to.
'';
};
port = mkOption {
type = types.port;
port = lib.mkOption {
type = lib.types.port;
default = 9876;
description = ''
The port Sachet will listen to.
@ -56,8 +53,8 @@ in
};
};
config = mkIf cfg.enable {
assertions = singleton {
config = lib.mkIf cfg.enable {
assertions = lib.singleton {
assertion = cfg.configuration != null;
message = "Cannot enable Sachet without a configuration.";
};