summaryrefslogtreecommitdiff
path: root/nixos/shared
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-08-27 21:16:06 +0200
committerMartin Fischer <martin@push-f.com>2025-08-27 21:16:06 +0200
commitb36ce740dd228ffadac42f17c1181901f25bc5c5 (patch)
tree65fab2e0a26f000d8ebce870c8dd1d3105e5fae4 /nixos/shared
parent51194934f276d6df9835654175f8363fbeb4bdcf (diff)
deps: update prometheus-sql-exporter
Diffstat (limited to 'nixos/shared')
-rw-r--r--nixos/shared/prometheus-sql-exporter/default.nix2
-rw-r--r--nixos/shared/prometheus-sql-exporter/service.nix13
2 files changed, 12 insertions, 3 deletions
diff --git a/nixos/shared/prometheus-sql-exporter/default.nix b/nixos/shared/prometheus-sql-exporter/default.nix
index 4a08ff6..5d80a62 100644
--- a/nixos/shared/prometheus-sql-exporter/default.nix
+++ b/nixos/shared/prometheus-sql-exporter/default.nix
@@ -9,7 +9,7 @@ buildGoModule {
pname = "sql_exporter";
version = sources.prometheus-sql-exporter.version;
src = sources.prometheus-sql-exporter;
- vendorHash = "sha256-KFWDqbdbXvgEtz1nlasWrvIckpzasUdzbb+AKfXmYf8=";
+ vendorHash = "sha256-eZxxmqoiXPdjZs/lwbzvWco9mDFy0zmpGDcqTIyWbK4=";
meta = with lib; {
description = "Database-agnostic SQL exporter for Prometheus";
diff --git a/nixos/shared/prometheus-sql-exporter/service.nix b/nixos/shared/prometheus-sql-exporter/service.nix
index a887f91..a79528c 100644
--- a/nixos/shared/prometheus-sql-exporter/service.nix
+++ b/nixos/shared/prometheus-sql-exporter/service.nix
@@ -4,7 +4,16 @@
let
sqlExporter = pkgs.callPackage ./default.nix {};
cfg = config.services.prometheus-sql-exporter;
- configFile = builtins.toFile "config.yaml" (builtins.toJSON cfg.config);
+ configFile = builtins.toFile "config.yaml" (builtins.toJSON cfg.config);
+ validateConfig = file:
+ pkgs.runCommand "validate-config"
+ {
+ nativeBuildInputs = [sqlExporter];
+ }
+ ''
+ sql_exporter -config.check -config.file "${file}"
+ ln -s "${file}" "$out"
+ '';
in
{
options.services.prometheus-sql-exporter = {
@@ -20,7 +29,7 @@ in
config = lib.mkIf cfg.enable {
systemd.services.prometheus-sql-exporter = {
serviceConfig = {
- ExecStart = "${sqlExporter}/bin/sql_exporter -config.file ${configFile} -web.listen-address :${toString cfg.port}";
+ ExecStart = "${sqlExporter}/bin/sql_exporter -config.file ${validateConfig configFile} -web.listen-address :${toString cfg.port}";
DynamicUser = "true";
User = "prometheus-sql-exporter";
};