summary refs log tree commit diff
path: root/pkgs/servers/monitoring/prometheus/pushgateway/default.nix
blob: db66e963208e1726fdef3f6d847e82e9fb9de416 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ stdenv, lib, goPackages, fetchFromGitHub }:

with goPackages;

buildGoPackage rec {
  name = "prometheus-pushgateway-${version}";
  version = "0.1.0";
  goPackagePath = "github.com/prometheus/pushgateway";
  rev = "3f1d42dade342ddb88381607358bae61a0a6b6c7";

  src = fetchFromGitHub {
    inherit rev;
    owner = "prometheus";
    repo = "pushgateway";
    sha256 = "1wqxbl9rlnxszp9ylvdbx6f5lyj2z0if3x099fnjahbqmz8yhnf4";
  };

  buildInputs = [
    go-bindata
    protobuf
    httprouter
    golang_protobuf_extensions
    prometheus.client_golang
  ];

  buildFlagsArray = ''
    -ldflags=
        -X main.buildVersion ${version}
        -X main.buildRev ${rev}
        -X main.buildBranch master
        -X main.buildUser nix@nixpkgs
        -X main.buildDate 20150101-00:00:00
        -X main.goVersion ${lib.getVersion go}
  '';

  preBuild = ''
  (
    cd "go/src/$goPackagePath"
    go-bindata ./resources/
  )
  '';

  meta = with lib; {
    description =
      "Allows ephemeral and batch jobs to expose metrics to Prometheus";
    homepage = https://github.com/prometheus/pushgateway;
    license = licenses.asl20;
    maintainers = with maintainers; [ benley ];
    platforms = platforms.unix;
  };
}