diff --git a/pkgs/servers/monitoring/prometheus/pushgateway.nix b/pkgs/servers/monitoring/prometheus/pushgateway.nix index f8a195c92fe0..1bdd7854205a 100644 --- a/pkgs/servers/monitoring/prometheus/pushgateway.nix +++ b/pkgs/servers/monitoring/prometheus/pushgateway.nix @@ -1,42 +1,31 @@ -{ lib, go, buildGoPackage, fetchFromGitHub }: +{ lib, buildGoModule, fetchFromGitHub, testers, prometheus-pushgateway }: -buildGoPackage rec { +buildGoModule rec { pname = "pushgateway"; - version = "1.4.0"; - rev = "v${version}"; - - goPackagePath = "github.com/prometheus/pushgateway"; + version = "1.4.3"; src = fetchFromGitHub { - inherit rev; owner = "prometheus"; repo = "pushgateway"; - sha256 = "sha256-230JgG+TtAuopkkcUda+0hl8E6WXOtTUygWoyorLiEU="; + rev = "v${version}"; + sha256 = "sha256-fSp173/ubeXw44IHVnuyYAYnTCrHcsq7GRwPlH05kJY="; }; - buildUser = "nix@nixpkgs"; - buildDate = "19700101-00:00:00"; + vendorSha256 = "sha256-abl2L8+QY2khLnsjXWWnzs9ewbFWctiJgHE29BRR2gU="; ldflags = [ - "-X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.Version=${version}" - "-X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.Revision=${rev}" - "-X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.Branch=${rev}" - "-X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.BuildUser=${buildUser}" - "-X github.com/prometheus/pushgateway/vendor/github.com/prometheus/common/version.BuildDate=${buildDate}" - "-X main.goVersion=${lib.getVersion go}" + "-s" + "-w" + "-X github.com/prometheus/common/version.Version=${version}" + "-X github.com/prometheus/common/version.Revision=${version}" + "-X github.com/prometheus/common/version.Branch=${version}" + "-X github.com/prometheus/common/version.BuildUser=nix@nixpkgs" + "-X github.com/prometheus/common/version.BuildDate=19700101-00:00:00" ]; - doInstallCheck = true; - installCheckPhase = '' - export PATH=$PATH:$out/bin - - pushgateway --help - - # Make sure our -X options were included in the build - for s in ${version} ${rev} ${buildUser} ${buildDate}; do - pushgateway --version 2>&1 | fgrep -q -- "$s" || { echo "pushgateway --version output missing $s"; exit 1; } - done - ''; + passthru.tests.version = testers.testVersion { + package = prometheus-pushgateway; + }; meta = with lib; { description = "Allows ephemeral and batch jobs to expose metrics to Prometheus";