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

This commit is contained in:
Felix Buehler 2024-08-27 20:43:33 +02:00
parent 28072b63dd
commit 14dad27e70

View file

@ -83,9 +83,6 @@ example:
```nix ```nix
# nixpkgs/nixos/modules/services/prometheus/exporters/postfix.nix # nixpkgs/nixos/modules/services/prometheus/exporters/postfix.nix
{ config, lib, pkgs, options }: { config, lib, pkgs, options }:
with lib;
let let
# for convenience we define cfg here # for convenience we define cfg here
cfg = config.services.prometheus.exporters.postfix; cfg = config.services.prometheus.exporters.postfix;
@ -97,15 +94,15 @@ example:
# (and optional overrides for default options). # (and optional overrides for default options).
# Note that this attribute is optional. # Note that this attribute is optional.
extraOpts = { extraOpts = {
telemetryPath = mkOption { telemetryPath = lib.mkOption {
type = types.str; type = lib.types.str;
default = "/metrics"; default = "/metrics";
description = '' description = ''
Path under which to expose metrics. Path under which to expose metrics.
''; '';
}; };
logfilePath = mkOption { logfilePath = lib.mkOption {
type = types.path; type = lib.types.path;
default = /var/log/postfix_exporter_input.log; default = /var/log/postfix_exporter_input.log;
example = /var/log/mail.log; example = /var/log/mail.log;
description = '' description = ''
@ -113,8 +110,8 @@ example:
This file will be truncated by this exporter! This file will be truncated by this exporter!
''; '';
}; };
showqPath = mkOption { showqPath = lib.mkOption {
type = types.path; type = lib.types.path;
default = /var/spool/postfix/public/showq; default = /var/spool/postfix/public/showq;
example = /var/lib/postfix/queue/public/showq; example = /var/lib/postfix/queue/public/showq;
description = '' description = ''
@ -136,7 +133,7 @@ example:
${pkgs.prometheus-postfix-exporter}/bin/postfix_exporter \ ${pkgs.prometheus-postfix-exporter}/bin/postfix_exporter \
--web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \
--web.telemetry-path ${cfg.telemetryPath} \ --web.telemetry-path ${cfg.telemetryPath} \
${concatStringsSep " \\\n " cfg.extraFlags} ${lib.concatStringsSep " \\\n " cfg.extraFlags}
''; '';
}; };
}; };
@ -156,8 +153,6 @@ information about the change to the exporter definition similar to
```nix ```nix
{ config, lib, pkgs, options }: { config, lib, pkgs, options }:
with lib;
let let
cfg = config.services.prometheus.exporters.nginx; cfg = config.services.prometheus.exporters.nginx;
in in
@ -173,10 +168,10 @@ in
}; };
imports = [ imports = [
# 'services.prometheus.exporters.nginx.telemetryEndpoint' -> 'services.prometheus.exporters.nginx.telemetryPath' # 'services.prometheus.exporters.nginx.telemetryEndpoint' -> 'services.prometheus.exporters.nginx.telemetryPath'
(mkRenamedOptionModule [ "telemetryEndpoint" ] [ "telemetryPath" ]) (lib.mkRenamedOptionModule [ "telemetryEndpoint" ] [ "telemetryPath" ])
# removed option 'services.prometheus.exporters.nginx.insecure' # removed option 'services.prometheus.exporters.nginx.insecure'
(mkRemovedOptionModule [ "insecure" ] '' (lib.mkRemovedOptionModule [ "insecure" ] ''
This option was replaced by 'prometheus.exporters.nginx.sslVerify' which defaults to true. This option was replaced by 'prometheus.exporters.nginx.sslVerify' which defaults to true.
'') '')
({ options.warnings = options.warnings; }) ({ options.warnings = options.warnings; })