ildkule/mysqld_exporter: use nix-sops template for config
Some checks are pending
Eval nix flake / evals (push) Waiting to run

This commit is contained in:
2025-03-16 21:09:12 +01:00
parent c6b7e7f555
commit b7fca76ea5
2 changed files with 21 additions and 16 deletions

View File

@@ -1,7 +1,22 @@
{ config, ... }: let
cfg = config.services.prometheus;
in {
sops.secrets."config/mysqld_exporter" = { };
sops = {
secrets."config/mysqld_exporter_password" = { };
templates."mysqld_exporter.conf" = {
restartUnits = [ "prometheus-mysqld-exporter.service" ];
content = let
inherit (config.sops) placeholder;
in ''
[client]
host = bicep.pvv.ntnu.no
port = 3306
user = prometheus_mysqld_exporter
password = ${placeholder."config/mysqld_exporter_password"}
'';
};
};
services.prometheus = {
scrapeConfigs = [{
@@ -19,7 +34,7 @@ in {
exporters.mysqld = {
enable = true;
configFile = config.sops.secrets."config/mysqld_exporter".path;
configFile = config.sops.templates."mysqld_exporter.conf".path;
};
};
}