From de58ab8507eca2ab5373967ccdd1bc40c85e3176 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Mon, 15 Jan 2024 10:47:31 +0300 Subject: [PATCH] Add deleteDatasources so we dont end up having duplicates --- hosts/cube/grafana.nix | 2 ++ hosts/cube/prometheus.nix | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hosts/cube/grafana.nix b/hosts/cube/grafana.nix index 4f7dfa2..a6194e7 100644 --- a/hosts/cube/grafana.nix +++ b/hosts/cube/grafana.nix @@ -30,6 +30,8 @@ in serverSystemConfiguration { settings.security = { admin_email = "metrics@${domain}"; admin_password = "$__file{${config.age.secrets."cube/passowrd.grafana".path}}"; + + disable_initial_admin_creation = true; # Just in case. }; }; diff --git a/hosts/cube/prometheus.nix b/hosts/cube/prometheus.nix index 76f46a8..c510f5e 100644 --- a/hosts/cube/prometheus.nix +++ b/hosts/cube/prometheus.nix @@ -1,11 +1,17 @@ { config, ulib, ... }: with ulib; serverSystemConfiguration { - services.grafana.provision.datasources.settings.datasources = [{ - name = "Prometheus"; - type = "prometheus"; - url = "http://[::]:${toString config.services.prometheus.port}"; - }]; + services.grafana.provision.datasources.settings = { + datasources = [{ + name = "Prometheus"; + type = "prometheus"; + url = "http://[::]:${toString config.services.prometheus.port}"; + }]; + + deleteDatasources = [{ + name = "Prometheus"; + }]; + }; services.prometheus = enabled { port = 9000;