nixos/prometheus-exporters: refactor imports, replace 'with lib;'
Pass through 'options' to exporter definitions and replace 'with lib;' by explicit function imports.
This commit is contained in:
parent
01ee2ee2ba
commit
774221191d
|
@ -1,8 +1,10 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, options, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib) concatStrings foldl foldl' genAttrs literalExample maintainers
|
||||||
|
mapAttrsToList mkDefault mkEnableOption mkIf mkMerge mkOption
|
||||||
|
optional types;
|
||||||
|
|
||||||
cfg = config.services.prometheus.exporters;
|
cfg = config.services.prometheus.exporters;
|
||||||
|
|
||||||
# each attribute in `exporterOpts` is expected to have specified:
|
# each attribute in `exporterOpts` is expected to have specified:
|
||||||
|
@ -17,25 +19,28 @@ let
|
||||||
# Note that `extraOpts` is optional, but a script for the exporter's
|
# Note that `extraOpts` is optional, but a script for the exporter's
|
||||||
# systemd service must be provided by specifying either
|
# systemd service must be provided by specifying either
|
||||||
# `serviceOpts.script` or `serviceOpts.serviceConfig.ExecStart`
|
# `serviceOpts.script` or `serviceOpts.serviceConfig.ExecStart`
|
||||||
exporterOpts = {
|
|
||||||
blackbox = import ./exporters/blackbox.nix { inherit config lib pkgs; };
|
exporterOpts = genAttrs [
|
||||||
collectd = import ./exporters/collectd.nix { inherit config lib pkgs; };
|
"bind"
|
||||||
dnsmasq = import ./exporters/dnsmasq.nix { inherit config lib pkgs; };
|
"blackbox"
|
||||||
dovecot = import ./exporters/dovecot.nix { inherit config lib pkgs; };
|
"collectd"
|
||||||
fritzbox = import ./exporters/fritzbox.nix { inherit config lib pkgs; };
|
"dnsmasq"
|
||||||
json = import ./exporters/json.nix { inherit config lib pkgs; };
|
"dovecot"
|
||||||
minio = import ./exporters/minio.nix { inherit config lib pkgs; };
|
"fritzbox"
|
||||||
nginx = import ./exporters/nginx.nix { inherit config lib pkgs; };
|
"json"
|
||||||
node = import ./exporters/node.nix { inherit config lib pkgs; };
|
"minio"
|
||||||
postfix = import ./exporters/postfix.nix { inherit config lib pkgs; };
|
"nginx"
|
||||||
snmp = import ./exporters/snmp.nix { inherit config lib pkgs; };
|
"node"
|
||||||
surfboard = import ./exporters/surfboard.nix { inherit config lib pkgs; };
|
"postfix"
|
||||||
tor = import ./exporters/tor.nix { inherit config lib pkgs; };
|
"snmp"
|
||||||
unifi = import ./exporters/unifi.nix { inherit config lib pkgs; };
|
"surfboard"
|
||||||
varnish = import ./exporters/varnish.nix { inherit config lib pkgs; };
|
"tor"
|
||||||
bind = import ./exporters/bind.nix { inherit config lib pkgs; };
|
"unifi"
|
||||||
wireguard = import ./exporters/wireguard.nix { inherit config lib pkgs; };
|
"varnish"
|
||||||
};
|
"wireguard"
|
||||||
|
] (name:
|
||||||
|
import (./. + "/exporters/${name}.nix") { inherit config lib pkgs options; }
|
||||||
|
);
|
||||||
|
|
||||||
mkExporterOpts = ({ name, port }: {
|
mkExporterOpts = ({ name, port }: {
|
||||||
enable = mkEnableOption "the prometheus ${name} exporter";
|
enable = mkEnableOption "the prometheus ${name} exporter";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs }:
|
{ config, lib, pkgs, options }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue