diff options
author | Naïm Favier <n@monade.li> | 2021-10-03 18:06:03 +0200 |
---|---|---|
committer | Naïm Favier <n@monade.li> | 2021-10-04 12:47:20 +0200 |
commit | 2ddc335e6f32b875e14ad9610101325b306a0add (patch) | |
tree | 2a4591c137cb363a6ec09f529d587a10aa7a0bc7 /nixos/modules/services/monitoring | |
parent | 330b1e08b8df4e1f0100a0a7810ec3157749e5ee (diff) | |
download | nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.gz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.bz2 nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.lz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.xz nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.tar.zst nixpkgs-2ddc335e6f32b875e14ad9610101325b306a0add.zip |
nixos/doc: clean up defaults and examples
Diffstat (limited to 'nixos/modules/services/monitoring')
41 files changed, 101 insertions, 111 deletions
diff --git a/nixos/modules/services/monitoring/alerta.nix b/nixos/modules/services/monitoring/alerta.nix index 7c6eff713cb..c4ce23361e9 100644 --- a/nixos/modules/services/monitoring/alerta.nix +++ b/nixos/modules/services/monitoring/alerta.nix @@ -32,7 +32,6 @@ in bind = mkOption { type = types.str; default = "0.0.0.0"; - example = literalExample "0.0.0.0"; description = "Address to bind to. The default is to bind to all addresses"; }; @@ -46,21 +45,18 @@ in type = types.str; description = "URL of the MongoDB or PostgreSQL database to connect to"; default = "mongodb://localhost"; - example = "mongodb://localhost"; }; databaseName = mkOption { type = types.str; description = "Name of the database instance to connect to"; default = "monitoring"; - example = "monitoring"; }; corsOrigins = mkOption { type = types.listOf types.str; description = "List of URLs that can access the API for Cross-Origin Resource Sharing (CORS)"; example = [ "http://localhost" "http://localhost:5000" ]; - default = [ "http://localhost" "http://localhost:5000" ]; }; authenticationRequired = mkOption { diff --git a/nixos/modules/services/monitoring/arbtt.nix b/nixos/modules/services/monitoring/arbtt.nix index b41a3c7b501..94eead220ae 100644 --- a/nixos/modules/services/monitoring/arbtt.nix +++ b/nixos/modules/services/monitoring/arbtt.nix @@ -18,8 +18,7 @@ in { package = mkOption { type = types.package; default = pkgs.haskellPackages.arbtt; - defaultText = "pkgs.haskellPackages.arbtt"; - example = literalExample "pkgs.haskellPackages.arbtt"; + defaultText = literalExpression "pkgs.haskellPackages.arbtt"; description = '' The package to use for the arbtt binaries. ''; diff --git a/nixos/modules/services/monitoring/bosun.nix b/nixos/modules/services/monitoring/bosun.nix index 04e9da1c81a..4b278b9c200 100644 --- a/nixos/modules/services/monitoring/bosun.nix +++ b/nixos/modules/services/monitoring/bosun.nix @@ -33,8 +33,7 @@ in { package = mkOption { type = types.package; default = pkgs.bosun; - defaultText = "pkgs.bosun"; - example = literalExample "pkgs.bosun"; + defaultText = literalExpression "pkgs.bosun"; description = '' bosun binary to use. ''; diff --git a/nixos/modules/services/monitoring/collectd.nix b/nixos/modules/services/monitoring/collectd.nix index ef3663c62e0..ad0cf4735ad 100644 --- a/nixos/modules/services/monitoring/collectd.nix +++ b/nixos/modules/services/monitoring/collectd.nix @@ -45,7 +45,7 @@ in { package = mkOption { default = pkgs.collectd; - defaultText = "pkgs.collectd"; + defaultText = literalExpression "pkgs.collectd"; description = '' Which collectd package to use. ''; diff --git a/nixos/modules/services/monitoring/datadog-agent.nix b/nixos/modules/services/monitoring/datadog-agent.nix index ea9eca18090..6d9d1ef973a 100644 --- a/nixos/modules/services/monitoring/datadog-agent.nix +++ b/nixos/modules/services/monitoring/datadog-agent.nix @@ -59,7 +59,7 @@ in { package = mkOption { default = pkgs.datadog-agent; - defaultText = "pkgs.datadog-agent"; + defaultText = literalExpression "pkgs.datadog-agent"; description = '' Which DataDog v7 agent package to use. Note that the provided package is expected to have an overridable `pythonPackages`-attribute @@ -135,9 +135,11 @@ in { package set must be provided. ''; - example = { - ntp = (pythonPackages: [ pythonPackages.ntplib ]); - }; + example = literalExpression '' + { + ntp = pythonPackages: [ pythonPackages.ntplib ]; + } + ''; }; extraConfig = mkOption { diff --git a/nixos/modules/services/monitoring/grafana-reporter.nix b/nixos/modules/services/monitoring/grafana-reporter.nix index 893c15d568b..e40d78f538f 100644 --- a/nixos/modules/services/monitoring/grafana-reporter.nix +++ b/nixos/modules/services/monitoring/grafana-reporter.nix @@ -41,8 +41,9 @@ in { templateDir = mkOption { description = "Optional template directory to use custom tex templates"; - default = "${pkgs.grafana_reporter}"; - type = types.str; + default = pkgs.grafana_reporter; + defaultText = literalExpression "pkgs.grafana_reporter"; + type = types.either types.str types.path; }; }; diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix index d46e38e82af..9b21dc78b19 100644 --- a/nixos/modules/services/monitoring/grafana.nix +++ b/nixos/modules/services/monitoring/grafana.nix @@ -330,13 +330,14 @@ in { staticRootPath = mkOption { description = "Root path for static assets."; default = "${cfg.package}/share/grafana/public"; + defaultText = literalExpression ''"''${package}/share/grafana/public"''; type = types.str; }; package = mkOption { description = "Package to use."; default = pkgs.grafana; - defaultText = "pkgs.grafana"; + defaultText = literalExpression "pkgs.grafana"; type = types.package; }; @@ -344,7 +345,7 @@ in { type = with types; nullOr (listOf path); default = null; description = "If non-null, then a list of packages containing Grafana plugins to install. If set, plugins cannot be manually installed."; - example = literalExample "with pkgs.grafanaPlugins; [ grafana-piechart-panel ]"; + example = literalExpression "with pkgs.grafanaPlugins; [ grafana-piechart-panel ]"; # Make sure each plugin is added only once; otherwise building # the link farm fails, since the same path is added multiple # times. diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 502afce5233..4690a252c92 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -132,7 +132,7 @@ in { finders = mkOption { description = "List of finder plugins to load."; default = []; - example = literalExample "[ pkgs.python3Packages.influxgraph ]"; + example = literalExpression "[ pkgs.python3Packages.influxgraph ]"; type = types.listOf types.package; }; @@ -160,7 +160,7 @@ in { package = mkOption { description = "Package to use for graphite api."; default = pkgs.python3Packages.graphite_api; - defaultText = "pkgs.python3Packages.graphite_api"; + defaultText = literalExpression "pkgs.python3Packages.graphite_api"; type = types.package; }; @@ -335,7 +335,7 @@ in { <link xlink:href='https://github.com/scobal/seyren#config' /> ''; type = types.attrsOf types.str; - example = literalExample '' + example = literalExpression '' { GRAPHITE_USERNAME = "user"; GRAPHITE_PASSWORD = "pass"; diff --git a/nixos/modules/services/monitoring/heapster.nix b/nixos/modules/services/monitoring/heapster.nix index 1bf7203d682..44f53e1890a 100644 --- a/nixos/modules/services/monitoring/heapster.nix +++ b/nixos/modules/services/monitoring/heapster.nix @@ -33,7 +33,7 @@ in { package = mkOption { description = "Package to use by heapster"; default = pkgs.heapster; - defaultText = "pkgs.heapster"; + defaultText = literalExpression "pkgs.heapster"; type = types.package; }; }; diff --git a/nixos/modules/services/monitoring/incron.nix b/nixos/modules/services/monitoring/incron.nix index 255e1d9e30b..2681c35d6a0 100644 --- a/nixos/modules/services/monitoring/incron.nix +++ b/nixos/modules/services/monitoring/incron.nix @@ -56,7 +56,7 @@ in extraPackages = mkOption { type = types.listOf types.package; default = []; - example = literalExample "[ pkgs.rsync ]"; + example = literalExpression "[ pkgs.rsync ]"; description = "Extra packages available to the system incrontab."; }; diff --git a/nixos/modules/services/monitoring/kapacitor.nix b/nixos/modules/services/monitoring/kapacitor.nix index 9b4ff3c5612..5f2233d747f 100644 --- a/nixos/modules/services/monitoring/kapacitor.nix +++ b/nixos/modules/services/monitoring/kapacitor.nix @@ -62,7 +62,6 @@ in dataDir = mkOption { type = types.path; example = "/var/lib/kapacitor"; - default = "/var/lib/kapacitor"; description = "Location where Kapacitor stores its state"; }; @@ -75,7 +74,7 @@ in bind = mkOption { type = types.str; default = ""; - example = literalExample "0.0.0.0"; + example = "0.0.0.0"; description = "Address to bind to. The default is to bind to all addresses"; }; @@ -101,7 +100,6 @@ in type = types.str; description = "Specifies how often to snapshot the task state (in InfluxDB time units)"; default = "1m0s"; - example = "1m0s"; }; loadDirectory = mkOption { @@ -136,7 +134,6 @@ in url = mkOption { description = "The URL to the Alerta REST API"; default = "http://localhost:5000"; - example = "http://localhost:5000"; type = types.str; }; diff --git a/nixos/modules/services/monitoring/loki.nix b/nixos/modules/services/monitoring/loki.nix index 51cabaa274a..ebac70c30c2 100644 --- a/nixos/modules/services/monitoring/loki.nix +++ b/nixos/modules/services/monitoring/loki.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: let - inherit (lib) escapeShellArgs literalExample mkEnableOption mkIf mkOption types; + inherit (lib) escapeShellArgs mkEnableOption mkIf mkOption types; cfg = config.services.loki; @@ -57,7 +57,7 @@ in { extraFlags = mkOption { type = types.listOf types.str; default = []; - example = literalExample [ "--server.http-listen-port=3101" ]; + example = [ "--server.http-listen-port=3101" ]; description = '' Specify a list of additional command line flags, which get escaped and are then passed to Loki. diff --git a/nixos/modules/services/monitoring/mackerel-agent.nix b/nixos/modules/services/monitoring/mackerel-agent.nix index 7046de9d403..aeb6247abd8 100644 --- a/nixos/modules/services/monitoring/mackerel-agent.nix +++ b/nixos/modules/services/monitoring/mackerel-agent.nix @@ -19,7 +19,6 @@ in { apiKeyFile = mkOption { type = types.path; - default = ""; example = "/run/keys/mackerel-api-key"; description = '' Path to file containing the Mackerel API key. The file should contain a diff --git a/nixos/modules/services/monitoring/metricbeat.nix b/nixos/modules/services/monitoring/metricbeat.nix index b285559eaa9..e75039daa10 100644 --- a/nixos/modules/services/monitoring/metricbeat.nix +++ b/nixos/modules/services/monitoring/metricbeat.nix @@ -3,7 +3,7 @@ let inherit (lib) attrValues - literalExample + literalExpression mkEnableOption mkIf mkOption @@ -24,8 +24,8 @@ in package = mkOption { type = types.package; default = pkgs.metricbeat; - defaultText = literalExample "pkgs.metricbeat"; - example = literalExample "pkgs.metricbeat7"; + defaultText = literalExpression "pkgs.metricbeat"; + example = literalExpression "pkgs.metricbeat7"; description = '' The metricbeat package to use ''; @@ -51,7 +51,6 @@ in module = mkOption { type = types.str; default = name; - defaultText = literalExample ''<name>''; description = '' The name of the module. diff --git a/nixos/modules/services/monitoring/munin.nix b/nixos/modules/services/monitoring/munin.nix index 1ebf7ee6a76..4fddb1e37e2 100644 --- a/nixos/modules/services/monitoring/munin.nix +++ b/nixos/modules/services/monitoring/munin.nix @@ -189,7 +189,7 @@ in <literal>/bin</literal>, <literal>/usr/bin</literal>, <literal>/sbin</literal>, and <literal>/usr/sbin</literal>. ''; - example = literalExample '' + example = literalExpression '' { zfs_usage_bigpool = /src/munin-contrib/plugins/zfs/zfs_usage_; zfs_usage_smallpool = /src/munin-contrib/plugins/zfs/zfs_usage_; @@ -220,7 +220,7 @@ in <literal>/bin</literal>, <literal>/usr/bin</literal>, <literal>/sbin</literal>, and <literal>/usr/sbin</literal>. ''; - example = literalExample '' + example = literalExpression '' [ /src/munin-contrib/plugins/zfs /src/munin-contrib/plugins/ssh @@ -285,9 +285,11 @@ in host for cron to succeed. See <link xlink:href='http://guide.munin-monitoring.org/en/latest/reference/munin.conf.html' /> ''; - example = '' - [''${config.networking.hostName}] - address localhost + example = literalExpression '' + ''' + [''${config.networking.hostName}] + address localhost + ''' ''; }; diff --git a/nixos/modules/services/monitoring/nagios.nix b/nixos/modules/services/monitoring/nagios.nix index 280a9a001b5..83020d52fc8 100644 --- a/nixos/modules/services/monitoring/nagios.nix +++ b/nixos/modules/services/monitoring/nagios.nix @@ -97,13 +97,13 @@ in network that you want Nagios to monitor. "; type = types.listOf types.path; - example = literalExample "[ ./objects.cfg ]"; + example = literalExpression "[ ./objects.cfg ]"; }; plugins = mkOption { type = types.listOf types.package; default = with pkgs; [ monitoring-plugins ssmtp mailutils ]; - defaultText = "[pkgs.monitoring-plugins pkgs.ssmtp pkgs.mailutils]"; + defaultText = literalExpression "[pkgs.monitoring-plugins pkgs.ssmtp pkgs.mailutils]"; description = " Packages to be added to the Nagios <envar>PATH</envar>. Typically used to add plugins, but can be anything. @@ -137,7 +137,7 @@ in cgiConfigFile = mkOption { type = types.package; default = nagiosCGICfgFile; - defaultText = "nagiosCGICfgFile"; + defaultText = literalExpression "nagiosCGICfgFile"; description = " Derivation for the configuration file of Nagios CGI scripts that can be used in web servers for running the Nagios web interface. @@ -155,7 +155,7 @@ in virtualHost = mkOption { type = types.submodule (import ../web-servers/apache-httpd/vhost-options.nix); - example = literalExample '' + example = literalExpression '' { hostName = "example.org"; adminAddr = "webmaster@example.org"; enableSSL = true; diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix index 3ea84ca815f..00bdd9fcda0 100644 --- a/nixos/modules/services/monitoring/netdata.nix +++ b/nixos/modules/services/monitoring/netdata.nix @@ -45,7 +45,7 @@ in { package = mkOption { type = types.package; default = pkgs.netdata; - defaultText = "pkgs.netdata"; + defaultText = literalExpression "pkgs.netdata"; description = "Netdata package to use."; }; @@ -84,8 +84,8 @@ in { extraPackages = mkOption { type = types.functionTo (types.listOf types.package); default = ps: []; - defaultText = "ps: []"; - example = literalExample '' + defaultText = literalExpression "ps: []"; + example = literalExpression '' ps: [ ps.psycopg2 ps.docker @@ -102,7 +102,7 @@ in { extraPluginPaths = mkOption { type = types.listOf types.path; default = [ ]; - example = literalExample '' + example = literalExpression '' [ "/path/to/plugins.d" ] ''; description = '' @@ -121,7 +121,7 @@ in { type = types.attrsOf types.attrs; default = {}; description = "netdata.conf configuration as nix attributes. cannot be combined with configText."; - example = literalExample '' + example = literalExpression '' global = { "debug log" = "syslog"; "access log" = "syslog"; diff --git a/nixos/modules/services/monitoring/parsedmarc.nix b/nixos/modules/services/monitoring/parsedmarc.nix index e6a72dea026..eeee04b4400 100644 --- a/nixos/modules/services/monitoring/parsedmarc.nix +++ b/nixos/modules/services/monitoring/parsedmarc.nix @@ -39,7 +39,7 @@ in hostname = lib.mkOption { type = lib.types.str; default = config.networking.fqdn; - defaultText = "config.networking.fqdn"; + defaultText = lib.literalExpression "config.networking.fqdn"; example = "monitoring.example.com"; description = '' The hostname to use when configuring Postfix. diff --git a/nixos/modules/services/monitoring/prometheus/alertmanager.nix b/nixos/modules/services/monitoring/prometheus/alertmanager.nix index 1b02ebf3704..1f396634ae0 100644 --- a/nixos/modules/services/monitoring/prometheus/alertmanager.nix +++ b/nixos/modules/services/monitoring/prometheus/alertmanager.nix @@ -45,7 +45,7 @@ in { package = mkOption { type = types.package; default = pkgs.prometheus-alertmanager; - defaultText = "pkgs.alertmanager"; + defaultText = literalExpression "pkgs.alertmanager"; description = '' Package that should be used for alertmanager. ''; diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix index 1161d18ab14..d2b37cf688b 100644 --- a/nixos/modules/services/monitoring/prometheus/default.nix +++ b/nixos/modules/services/monitoring/prometheus/default.nix @@ -692,7 +692,7 @@ in { package = mkOption { type = types.package; default = pkgs.prometheus; - defaultText = "pkgs.prometheus"; + defaultText = literalExpression "pkgs.prometheus"; description = '' The prometheus package that should be used. ''; @@ -833,7 +833,7 @@ in { alertmanagers = mkOption { type = types.listOf types.attrs; - example = literalExample '' + example = literalExpression '' [ { scheme = "https"; path_prefix = "/alertmanager"; diff --git a/nixos/modules/services/monitoring/prometheus/exporters.nix b/nixos/modules/services/monitoring/prometheus/exporters.nix index 83de9a3f5eb..99dfea6daa7 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, options, ... }: let - inherit (lib) concatStrings foldl foldl' genAttrs literalExample maintainers + inherit (lib) concatStrings foldl foldl' genAttrs literalExpression maintainers mapAttrsToList mkDefault mkEnableOption mkIf mkMerge mkOption optional types mkOptionDefault flip attrNames; @@ -109,7 +109,7 @@ let firewallFilter = mkOption { type = types.nullOr types.str; default = null; - example = literalExample '' + example = literalExpression '' "-i eth0 -p tcp -m tcp --dport ${toString port}" ''; description = '' @@ -204,7 +204,7 @@ in }; description = "Prometheus exporter configuration"; default = {}; - example = literalExample '' + example = literalExpression '' { node = { enable = true; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix b/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix index 7557480ac06..e9be39608fc 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/buildkite-agent.nix @@ -36,7 +36,7 @@ in queues = mkOption { type = with types; nullOr (listOf str); default = null; - example = literalExample ''[ "my-queue1" "my-queue2" ]''; + example = literalExpression ''[ "my-queue1" "my-queue2" ]''; description = '' Which specific queues to process. ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/flow.nix b/nixos/modules/services/monitoring/prometheus/exporters/flow.nix index 6a35f46308f..b85e5461f21 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/flow.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/flow.nix @@ -9,7 +9,7 @@ in { extraOpts = { brokers = mkOption { type = types.listOf types.str; - example = literalExample ''[ "kafka.example.org:19092" ]''; + example = literalExpression ''[ "kafka.example.org:19092" ]''; description = "List of Kafka brokers to connect to."; }; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/kea.nix b/nixos/modules/services/monitoring/prometheus/exporters/kea.nix index 9677281f877..0571325c5d9 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/kea.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/kea.nix @@ -13,7 +13,7 @@ in { extraOpts = { controlSocketPaths = mkOption { type = types.listOf types.str; - example = literalExample '' + example = literalExpression '' [ "/run/kea/kea-dhcp4.socket" "/run/kea/kea-dhcp6.socket" diff --git a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix index 46c28fe0a57..2acaac293b6 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/knot.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/knot.nix @@ -10,7 +10,7 @@ in { knotLibraryPath = mkOption { type = types.str; default = "${pkgs.knot-dns.out}/lib/libknot.so"; - defaultText = "\${pkgs.knot-dns}/lib/libknot.so"; + defaultText = literalExpression ''"''${pkgs.knot-dns.out}/lib/libknot.so"''; description = '' Path to the library of <package>knot-dns</package>. ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix index 7e196149fbb..956bd96aa45 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix @@ -100,7 +100,7 @@ let servers = mkOption { type = types.listOf (types.submodule serverOptions); default = []; - example = literalExample '' + example = literalExpression '' [ { name = "testserver"; server = "smtp.domain.tld"; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix b/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix index 62c2cc56847..8f9536b702a 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/mikrotik.nix @@ -15,7 +15,7 @@ in Path to a mikrotik exporter configuration file. Mutually exclusive with <option>configuration</option> option. ''; - example = literalExample "./mikrotik.yml"; + example = literalExpression "./mikrotik.yml"; }; configuration = mkOption { @@ -28,7 +28,7 @@ in See <link xlink:href="https://github.com/nshttpd/mikrotik-exporter/blob/master/README.md"/> for the description of the configuration file format. ''; - example = literalExample '' + example = literalExpression '' { devices = [ { diff --git a/nixos/modules/services/monitoring/prometheus/exporters/node.nix b/nixos/modules/services/monitoring/prometheus/exporters/node.nix index adc2abe0b91..ed594460d95 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/node.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/node.nix @@ -11,7 +11,7 @@ in enabledCollectors = mkOption { type = types.listOf types.str; default = []; - example = ''[ "systemd" ]''; + example = [ "systemd" ]; description = '' Collectors to enable. The collectors listed here are enabled in addition to the default ones. ''; @@ -19,7 +19,7 @@ in disabledCollectors = mkOption { type = types.listOf types.str; default = []; - example = ''[ "timex" ]''; + example = [ "timex" ]; description = '' Collectors to disable which are enabled by default. ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix b/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix index 21c2e5eab4c..4bc27ebc32f 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/pihole.nix @@ -42,8 +42,8 @@ in }; piholePort = mkOption { type = types.port; - default = "80"; - example = "443"; + default = 80; + example = 443; description = '' The port pihole webinterface is reachable on ''; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/process.nix b/nixos/modules/services/monitoring/prometheus/exporters/process.nix index e3b3d18367f..1e9c402fb55 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/process.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/process.nix @@ -11,14 +11,12 @@ in extraOpts = { settings.process_names = mkOption { type = types.listOf types.anything; - default = {}; - example = literalExample '' - { - process_names = [ - # Remove nix store path from process name - { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ]; } - ]; - } + default = []; + example = literalExpression '' + [ + # Remove nix store path from process name + { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ]; } + ] ''; description = '' All settings expressed as an Nix attrset. diff --git a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix index 994670a376e..ed985751e42 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/rspamd.nix @@ -62,8 +62,8 @@ in default = { host = config.networking.hostName; }; - defaultText = "{ host = config.networking.hostName; }"; - example = literalExample '' + defaultText = literalExpression "{ host = config.networking.hostName; }"; + example = literalExpression '' { host = config.networking.hostName; custom_label = "some_value"; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/script.nix b/nixos/modules/services/monitoring/prometheus/exporters/script.nix index 104ab859f2e..a805a0ad335 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/script.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/script.nix @@ -30,7 +30,7 @@ in }; }; }); - example = literalExample '' + example = literalExpression '' { scripts = [ { name = "sleep"; script = "sleep 5"; } diff --git a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix index 01276366e97..de42663e67f 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/snmp.nix @@ -14,7 +14,7 @@ in description = '' Path to a snmp exporter configuration file. Mutually exclusive with 'configuration' option. ''; - example = "./snmp.yml"; + example = literalExpression "./snmp.yml"; }; configuration = mkOption { @@ -23,16 +23,14 @@ in description = '' Snmp exporter configuration as nix attribute set. Mutually exclusive with 'configurationPath' option. ''; - example = '' - { - "default" = { - "version" = 2; - "auth" = { - "community" = "public"; - }; + example = { + "default" = { + "version" = 2; + "auth" = { + "community" = "public"; }; }; - ''; + }; }; logFormat = mkOption { diff --git a/nixos/modules/services/monitoring/prometheus/pushgateway.nix b/nixos/modules/services/monitoring/prometheus/pushgateway.nix index f8fcc3eb97e..01b99376243 100644 --- a/nixos/modules/services/monitoring/prometheus/pushgateway.nix +++ b/nixos/modules/services/monitoring/prometheus/pushgateway.nix @@ -26,7 +26,7 @@ in { package = mkOption { type = types.package; default = pkgs.prometheus-pushgateway; - defaultText = "pkgs.prometheus-pushgateway"; + defaultText = literalExpression "pkgs.prometheus-pushgateway"; description = '' Package that should be used for the prometheus pushgateway. ''; diff --git a/nixos/modules/services/monitoring/scollector.nix b/nixos/modules/services/monitoring/scollector.nix index ef535585e9b..6a6fe110f94 100644 --- a/nixos/modules/services/monitoring/scollector.nix +++ b/nixos/modules/services/monitoring/scollector.nix @@ -43,8 +43,7 @@ in { package = mkOption { type = types.package; default = pkgs.scollector; - defaultText = "pkgs.scollector"; - example = literalExample "pkgs.scollector"; + defaultText = literalExpression "pkgs.scollector"; description = '' scollector binary to use. ''; @@ -78,7 +77,7 @@ in { collectors = mkOption { type = with types; attrsOf (listOf path); default = {}; - example = literalExample "{ \"0\" = [ \"\${postgresStats}/bin/collect-stats\" ]; }"; + example = literalExpression ''{ "0" = [ "''${postgresStats}/bin/collect-stats" ]; }''; description = '' An attribute set mapping the frequency of collection to a list of binaries that should be executed at that frequency. You can use "0" diff --git a/nixos/modules/services/monitoring/telegraf.nix b/nixos/modules/services/monitoring/telegraf.nix index 4046260c164..13aae58d0f3 100644 --- a/nixos/modules/services/monitoring/telegraf.nix +++ b/nixos/modules/services/monitoring/telegraf.nix @@ -15,7 +15,7 @@ in { package = mkOption { default = pkgs.telegraf; - defaultText = "pkgs.telegraf"; + defaultText = literalExpression "pkgs.telegraf"; description = "Which telegraf derivation to use"; type = types.package; }; @@ -23,7 +23,7 @@ in { environmentFiles = mkOption { type = types.listOf types.path; default = []; - example = "/run/keys/telegraf.env"; + example = [ "/run/keys/telegraf.env" ]; description = '' File to load as environment file. Environment variables from this file will be interpolated into the config file using envsubst with this diff --git a/nixos/modules/services/monitoring/thanos.nix b/nixos/modules/services/monitoring/thanos.nix index 96addf392bd..da626788d82 100644 --- a/nixos/modules/services/monitoring/thanos.nix +++ b/nixos/modules/services/monitoring/thanos.nix @@ -120,7 +120,7 @@ let type = with types; nullOr str; default = if cfg.tracing.config == null then null else toString (toYAML "tracing.yaml" cfg.tracing.config); - defaultText = '' + defaultText = literalExpression '' if config.services.thanos.<cmd>.tracing.config == null then null else toString (toYAML "tracing.yaml" config.services.thanos.<cmd>.tracing.config); ''; @@ -185,7 +185,7 @@ let type = with types; nullOr str; default = if cfg.objstore.config == null then null else toString (toYAML "objstore.yaml" cfg.objstore.config); - defaultText = '' + defaultText = literalExpression '' if config.services.thanos.<cmd>.objstore.config == null then null else toString (toYAML "objstore.yaml" config.services.thanos.<cmd>.objstore.config); ''; @@ -227,7 +227,7 @@ let option = mkOption { type = types.str; default = "/var/lib/${config.services.prometheus.stateDir}/data"; - defaultText = "/var/lib/\${config.services.prometheus.stateDir}/data"; + defaultText = literalExpression ''"/var/lib/''${config.services.prometheus.stateDir}/data"''; description = '' Data directory of TSDB. ''; @@ -656,7 +656,7 @@ in { package = mkOption { type = types.package; default = pkgs.thanos; - defaultText = "pkgs.thanos"; + defaultText = literalExpression "pkgs.thanos"; description = '' The thanos package that should be used. ''; diff --git a/nixos/modules/services/monitoring/unifi-poller.nix b/nixos/modules/services/monitoring/unifi-poller.nix index 208f5e4875b..81a7b408bcc 100644 --- a/nixos/modules/services/monitoring/unifi-poller.nix +++ b/nixos/modules/services/monitoring/unifi-poller.nix @@ -87,7 +87,7 @@ in { pass = mkOption { type = types.path; default = pkgs.writeText "unifi-poller-influxdb-default.password" "unifipoller"; - defaultText = "unifi-poller-influxdb-default.password"; + defaultText = literalExpression "unifi-poller-influxdb-default.password"; description = '' Path of a file containing the password for influxdb. This file needs to be readable by the unifi-poller user. @@ -130,7 +130,7 @@ in { pass = mkOption { type = types.path; default = pkgs.writeText "unifi-poller-unifi-default.password" "unifi"; - defaultText = "unifi-poller-unifi-default.password"; + defaultText = literalExpression "unifi-poller-unifi-default.password"; description = '' Path of a file containing the password for the unifi service user. This file needs to be readable by the unifi-poller user. diff --git a/nixos/modules/services/monitoring/zabbix-agent.nix b/nixos/modules/services/monitoring/zabbix-agent.nix index 7eb6449e384..c48b973f1ef 100644 --- a/nixos/modules/services/monitoring/zabbix-agent.nix +++ b/nixos/modules/services/monitoring/zabbix-agent.nix @@ -4,7 +4,7 @@ let cfg = config.services.zabbixAgent; inherit (lib) mkDefault mkEnableOption mkIf mkMerge mkOption; - inherit (lib) attrValues concatMapStringsSep literalExample optionalString types; + inherit (lib) attrValues concatMapStringsSep literalExpression optionalString types; inherit (lib.generators) toKeyValue; user = "zabbix-agent"; @@ -34,15 +34,15 @@ in package = mkOption { type = types.package; default = pkgs.zabbix.agent; - defaultText = "pkgs.zabbix.agent"; + defaultText = literalExpression "pkgs.zabbix.agent"; description = "The Zabbix package to use."; }; extraPackages = mkOption { type = types.listOf types.package; default = with pkgs; [ nettools ]; - defaultText = "[ nettools ]"; - example = "[ nettools mysql ]"; + defaultText = literalExpression "with pkgs; [ nettools ]"; + example = literalExpression "with pkgs; [ nettools mysql ]"; description = '' Packages to be added to the Zabbix <envar>PATH</envar>. Typically used to add executables for scripts, but can be anything. @@ -53,7 +53,7 @@ in type = types.attrsOf types.package; description = "A set of modules to load."; default = {}; - example = literalExample '' + example = literalExpression '' { "dummy.so" = pkgs.stdenv.mkDerivation { name = "zabbix-dummy-module-''${cfg.package.version}"; diff --git a/nixos/modules/services/monitoring/zabbix-proxy.nix b/nixos/modules/services/monitoring/zabbix-proxy.nix index 8c7a2970e9b..b5009f47f17 100644 --- a/nixos/modules/services/monitoring/zabbix-proxy.nix +++ b/nixos/modules/services/monitoring/zabbix-proxy.nix @@ -6,7 +6,7 @@ let mysql = config.services.mysql; inherit (lib) mkAfter mkDefault mkEnableOption mkIf mkMerge mkOption; - inherit (lib) attrValues concatMapStringsSep getName literalExample optional optionalAttrs optionalString types; + inherit (lib) attrValues concatMapStringsSep getName literalExpression optional optionalAttrs optionalString types; inherit (lib.generators) toKeyValue; user = "zabbix"; @@ -52,14 +52,14 @@ in if cfg.database.type == "mysql" then pkgs.zabbix.proxy-mysql else if cfg.database.type == "pgsql" then pkgs.zabbix.proxy-pgsql else pkgs.zabbix.proxy-sqlite; - defaultText = "pkgs.zabbix.proxy-pgsql"; + defaultText = literalExpression "pkgs.zabbix.proxy-pgsql"; description = "The Zabbix package to use."; }; extraPackages = mkOption { type = types.listOf types.package; default = with pkgs; [ nettools nmap traceroute ]; - defaultText = "[ nettools nmap traceroute ]"; + defaultText = literalExpression "[ nettools nmap traceroute ]"; description = '' Packages to be added to the Zabbix <envar>PATH</envar>. Typically used to add executables for scripts, but can be anything. @@ -70,7 +70,7 @@ in type = types.attrsOf types.package; description = "A set of modules to load."; default = {}; - example = literalExample '' + example = literalExpression '' { "dummy.so" = pkgs.stdenv.mkDerivation { name = "zabbix-dummy-module-''${cfg.package.version}"; @@ -109,7 +109,7 @@ in name = mkOption { type = types.str; default = if cfg.database.type == "sqlite" then "${stateDir}/zabbix.db" else "zabbix"; - defaultText = "zabbix"; + defaultText = literalExpression "zabbix"; description = "Database name."; }; diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix index c8658634ecb..9b0fd9dbff1 100644 --- a/nixos/modules/services/monitoring/zabbix-server.nix +++ b/nixos/modules/services/monitoring/zabbix-server.nix @@ -6,7 +6,7 @@ let mysql = config.services.mysql; inherit (lib) mkAfter mkDefault mkEnableOption mkIf mkMerge mkOption; - inherit (lib) attrValues concatMapStringsSep getName literalExample optional optionalAttrs optionalString types; + inherit (lib) attrValues concatMapStringsSep getName literalExpression optional optionalAttrs optionalString types; inherit (lib.generators) toKeyValue; user = "zabbix"; @@ -44,14 +44,14 @@ in package = mkOption { type = types.package; default = if cfg.database.type == "mysql" then pkgs.zabbix.server-mysql else pkgs.zabbix.server-pgsql; - defaultText = "pkgs.zabbix.server-pgsql"; + defaultText = literalExpression "pkgs.zabbix.server-pgsql"; description = "The Zabbix package to use."; }; extraPackages = mkOption { type = types.listOf types.package; default = with pkgs; [ nettools nmap traceroute ]; - defaultText = "[ nettools nmap traceroute ]"; + defaultText = literalExpression "[ nettools nmap traceroute ]"; description = '' Packages to be added to the Zabbix <envar>PATH</envar>. Typically used to add executables for scripts, but can be anything. @@ -62,7 +62,7 @@ in type = types.attrsOf types.package; description = "A set of modules to load."; default = {}; - example = literalExample '' + example = literalExpression '' { "dummy.so" = pkgs.stdenv.mkDerivation { name = "zabbix-dummy-module-''${cfg.package.version}"; |