Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 go,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 nixosTests,
8}:
9
10buildGoModule rec {
11 pname = "alertmanager";
12 version = "0.28.1";
13 rev = "v${version}";
14
15 src = fetchFromGitHub {
16 inherit rev;
17 owner = "prometheus";
18 repo = "alertmanager";
19 hash = "sha256-2HHQ7S1J/X4PVFnPbi8Oapsqf1MyNnsqfMMBJRItWf0=";
20 };
21
22 vendorHash = "sha256-4XWHe32UZ+1HOQzQdZX4leoPD6pfJZwyjDQV3dv164s=";
23
24 subPackages = [
25 "cmd/alertmanager"
26 "cmd/amtool"
27 ];
28
29 ldflags =
30 let
31 t = "github.com/prometheus/common/version";
32 in
33 [
34 "-X ${t}.Version=${version}"
35 "-X ${t}.Revision=${src.rev}"
36 "-X ${t}.Branch=unknown"
37 "-X ${t}.BuildUser=nix@nixpkgs"
38 "-X ${t}.BuildDate=unknown"
39 "-X ${t}.GoVersion=${lib.getVersion go}"
40 ];
41
42 nativeBuildInputs = [ installShellFiles ];
43
44 postInstall = ''
45 $out/bin/amtool --completion-script-bash > amtool.bash
46 installShellCompletion amtool.bash
47 $out/bin/amtool --completion-script-zsh > amtool.zsh
48 installShellCompletion amtool.zsh
49 '';
50
51 passthru.tests = { inherit (nixosTests.prometheus) alertmanager; };
52
53 meta = with lib; {
54 description = "Alert dispatcher for the Prometheus monitoring system";
55 homepage = "https://github.com/prometheus/alertmanager";
56 changelog = "https://github.com/prometheus/alertmanager/blob/v${version}/CHANGELOG.md";
57 license = licenses.asl20;
58 maintainers = with maintainers; [
59 benley
60 fpletz
61 globin
62 Frostman
63 ];
64 };
65}