1{ lib, buildGoModule, fetchFromGitHub, go, prometheus-sql-exporter, testers }:
2
3buildGoModule rec {
4 pname = "sql_exporter";
5 version = "0.4.7";
6
7 src = fetchFromGitHub {
8 owner = "justwatchcom";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-aSygfs5jVc1CTb+uj16U//99ypP4kixz7gqDvxIxxfM=";
12 };
13
14 vendorHash = null;
15
16 ldflags = let t = "github.com/prometheus/common/version"; in
17 [
18 "-X ${t}.Version=${version}"
19 "-X ${t}.Revision=${src.rev}"
20 "-X ${t}.Branch=unknown"
21 "-X ${t}.BuildUser=nix@nixpkgs"
22 "-X ${t}.BuildDate=unknown"
23 "-X ${t}.GoVersion=${lib.getVersion go}"
24 ];
25
26 passthru.tests.version = testers.testVersion {
27 package = prometheus-sql-exporter;
28 command = "sql_exporter -version";
29 };
30
31 meta = with lib; {
32 description = "Flexible SQL exporter for Prometheus";
33 homepage = "https://github.com/justwatchcom/sql_exporter";
34 license = licenses.mit;
35 maintainers = with maintainers; [ justinas ];
36 };
37}