1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 go,
6 nix-update-script,
7 nixosTests,
8 testers,
9 thanos,
10}:
11
12buildGoModule rec {
13 pname = "thanos";
14 version = "0.38.0";
15
16 src = fetchFromGitHub {
17 owner = "thanos-io";
18 repo = "thanos";
19 tag = "v${version}";
20 hash = "sha256-3rNtiVTrA+MoCVuTSLIzh65U0kjA86EF+bQCyfVa6rA=";
21 };
22
23 vendorHash = "sha256-Z/S4mVg+VbP8hNVB1xz1uGWR6N/1aTA0DqTHbntGMLg=";
24
25 subPackages = "cmd/thanos";
26
27 ldflags =
28 let
29 t = "github.com/prometheus/common/version";
30 in
31 [
32 "-X ${t}.Version=${version}"
33 "-X ${t}.Revision=unknown"
34 "-X ${t}.Branch=unknown"
35 "-X ${t}.BuildUser=nix@nixpkgs"
36 "-X ${t}.BuildDate=unknown"
37 "-X ${t}.GoVersion=${lib.getVersion go}"
38 ];
39
40 doCheck = true;
41
42 passthru = {
43 updateScript = nix-update-script { };
44 tests = {
45 inherit (nixosTests) thanos;
46 version = testers.testVersion {
47 command = "thanos --version";
48 package = thanos;
49 };
50 };
51 };
52
53 meta = {
54 description = "Highly available Prometheus setup with long term storage capabilities";
55 homepage = "https://github.com/thanos-io/thanos";
56 changelog = "https://github.com/thanos-io/thanos/releases/tag/v${version}";
57 license = lib.licenses.asl20;
58 mainProgram = "thanos";
59 maintainers = with lib.maintainers; [
60 basvandijk
61 anthonyroussel
62 ];
63 };
64}