From f81b05ab46afd7b0b8907f4b990345760ee24bd7 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 3 Apr 2022 10:03:43 +0200 Subject: [PATCH] prometheus-backbox-exporter: correctly expose version info --- .../monitoring/prometheus/blackbox-exporter.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/monitoring/prometheus/blackbox-exporter.nix b/pkgs/servers/monitoring/prometheus/blackbox-exporter.nix index 2349bac177c9..430da1ea4d08 100644 --- a/pkgs/servers/monitoring/prometheus/blackbox-exporter.nix +++ b/pkgs/servers/monitoring/prometheus/blackbox-exporter.nix @@ -3,9 +3,10 @@ buildGoModule rec { pname = "blackbox_exporter"; version = "0.20.0"; + rev = "v${version}"; src = fetchFromGitHub { - rev = "v${version}"; + inherit rev; owner = "prometheus"; repo = "blackbox_exporter"; sha256 = "sha256-Y3HdFIChkQVooxy2I2Gbqw3WLHsI4Zm+osHTzFluRZA="; @@ -18,11 +19,21 @@ buildGoModule rec { passthru.tests = { inherit (nixosTests.prometheus-exporters) blackbox; }; + ldflags = [ + "-s" + "-w" + "-X github.com/prometheus/common/version.Version=${version}" + "-X github.com/prometheus/common/version.Revision=${rev}" + "-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" + ]; + meta = with lib; { description = "Blackbox probing of endpoints over HTTP, HTTPS, DNS, TCP and ICMP"; homepage = "https://github.com/prometheus/blackbox_exporter"; license = licenses.asl20; - maintainers = with maintainers; [ globin fpletz willibutz Frostman ]; + maintainers = with maintainers; [ globin fpletz willibutz Frostman ma27 ]; platforms = platforms.unix; }; }