converted to flakes and implemented sops-nix for the telegraf token

This commit is contained in:
John Lancaster
2024-12-17 00:56:38 -06:00
parent 3e7762c10e
commit d0544a89ff
7 changed files with 287 additions and 13 deletions

View File

@@ -1,18 +1,22 @@
{ ... }:
{ config, ... }:
let
influxURL = "http://panoptes.john-stream.com:8086";
organization = "homelab";
bucket = "docker";
envFile = ./telegraf.env;
token = "${builtins.readFile config.sops.secrets."telegraf_influx_token".path}";
in
{
systemd.services.telegraf.serviceConfig = {
SupplementaryGroups = [ "docker" ];
sops.secrets."telegraf_influx_token" = { };
systemd.services.telegraf = {
environment = {
INFLUX_WRITE_TOKEN = token;
};
serviceConfig.SupplementaryGroups = [ "docker" ];
};
services.telegraf = {
enable = true;
environmentFiles = [ "${envFile}" ];
extraConfig = {
agent = {
interval = "10s";