1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5}:
6
7buildGoModule rec {
8 pname = "mysqld_exporter";
9 version = "0.17.2";
10
11 src = fetchFromGitHub {
12 owner = "prometheus";
13 repo = "mysqld_exporter";
14 rev = "v${version}";
15 sha256 = "sha256-vkbjOWVV79fDBdCa6/ueY9QhPDkFCApR/EZn20SYHYU=";
16 };
17
18 vendorHash = "sha256-pdxIW800vnKK0l84bDVkl2JHBb0e9zkQnn3O8ls04R0=";
19
20 ldflags =
21 let
22 t = "github.com/prometheus/common/version";
23 in
24 [
25 "-s"
26 "-w"
27 "-X ${t}.Version=${version}"
28 "-X ${t}.Revision=${src.rev}"
29 "-X ${t}.Branch=unknown"
30 "-X ${t}.BuildUser=nix@nixpkgs"
31 "-X ${t}.BuildDate=unknown"
32 ];
33
34 # skips tests with external dependencies, e.g. on mysqld
35 checkFlags = [
36 "-short"
37 ];
38
39 meta = with lib; {
40 description = "Prometheus exporter for MySQL server metrics";
41 mainProgram = "mysqld_exporter";
42 homepage = "https://github.com/prometheus/mysqld_exporter";
43 license = licenses.asl20;
44 maintainers = with maintainers; [
45 benley
46 globin
47 ];
48 };
49}