From 69caedcc4240f1a70d28cec6bf2c67d0f2ade8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 18 Nov 2020 21:29:12 +0100 Subject: [PATCH 1/3] nixos/telegraf: null value for environmentFiles is invalid it's also not needed given that empty list covers all use cases. --- nixos/modules/services/monitoring/telegraf.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/telegraf.nix b/nixos/modules/services/monitoring/telegraf.nix index 1fc17ec72da..4bfede2e37b 100644 --- a/nixos/modules/services/monitoring/telegraf.nix +++ b/nixos/modules/services/monitoring/telegraf.nix @@ -21,7 +21,7 @@ in { }; environmentFiles = mkOption { - type = types.nullOr (types.listOf types.path); + type = types.listOf types.path; default = []; example = "/run/keys/telegraf.env"; description = '' From 0f84e08fcde535c4513b038220f57cb73924f85d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 18 Nov 2020 21:30:04 +0100 Subject: [PATCH 2/3] nixos/telegraf: make example a bit more compact --- nixos/modules/services/monitoring/telegraf.nix | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/nixos/modules/services/monitoring/telegraf.nix b/nixos/modules/services/monitoring/telegraf.nix index 4bfede2e37b..b341a9005c2 100644 --- a/nixos/modules/services/monitoring/telegraf.nix +++ b/nixos/modules/services/monitoring/telegraf.nix @@ -38,17 +38,13 @@ in { description = "Extra configuration options for telegraf"; type = settingsFormat.type; example = { - outputs = { - influxdb = { - urls = ["http://localhost:8086"]; - database = "telegraf"; - }; + outputs.influxdb = { + urls = ["http://localhost:8086"]; + database = "telegraf"; }; - inputs = { - statsd = { - service_address = ":8125"; - delete_timings = true; - }; + inputs.statsd = { + service_address = ":8125"; + delete_timings = true; }; }; }; From 58bf9ed18b74b7981dbbe4199937019ef61b1a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 18 Nov 2020 21:30:29 +0100 Subject: [PATCH 3/3] nixos/telegraf: fix test --- nixos/tests/telegraf.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/tests/telegraf.nix b/nixos/tests/telegraf.nix index 938bbd518b5..7f4b3675258 100644 --- a/nixos/tests/telegraf.nix +++ b/nixos/tests/telegraf.nix @@ -6,9 +6,9 @@ import ./make-test-python.nix ({ pkgs, ...} : { machine = { ... }: { services.telegraf.enable = true; - services.telegraf.environmentFiles = [pkgs.writeText "secrets" '' + services.telegraf.environmentFiles = [(pkgs.writeText "secrets" '' SECRET=example - '']; + '')]; services.telegraf.extraConfig = { agent.interval = "1s"; agent.flush_interval = "1s";