From 659c0084940aede2c9d90c6cf16735b3bf9690ee Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Sun, 10 Dec 2023 10:44:49 +0000 Subject: [PATCH] prometheus-zfs-exporter: Added ldflags to add version label to _build_info metric. --- pkgs/servers/monitoring/prometheus/zfs-exporter.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/servers/monitoring/prometheus/zfs-exporter.nix b/pkgs/servers/monitoring/prometheus/zfs-exporter.nix index 3e5ec75a2922..d229daa14b81 100644 --- a/pkgs/servers/monitoring/prometheus/zfs-exporter.nix +++ b/pkgs/servers/monitoring/prometheus/zfs-exporter.nix @@ -16,6 +16,16 @@ buildGoModule rec { vendorHash = "sha256-uIilESEmAxANxFOy7qvYxlF/bId/Kqh4jUspNknlhlc="; + ldflags = [ + "-s" + "-w" + "-X github.com/prometheus/common/version.Version=${version}" + "-X github.com/prometheus/common/version.Revision=unknown" + "-X github.com/prometheus/common/version.Branch=unknown" + "-X github.com/prometheus/common/version.BuildUser=nix@nixpkgs" + "-X github.com/prometheus/common/version.BuildDate=unknown" + ]; + postInstall = '' install -Dm444 -t $out/share/doc/${pname} *.md '';