Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / monitoring / prometheus / alertmanager.nix
blob1db975f591d985f5079d01aac6f7bef74f7f9b2f
1 { lib
2 , go
3 , buildGoModule
4 , fetchFromGitHub
5 , installShellFiles
6 , nixosTests
7 }:
9 buildGoModule rec {
10   pname = "alertmanager";
11   version = "0.27.0";
12   rev = "v${version}";
14   src = fetchFromGitHub {
15     inherit rev;
16     owner = "prometheus";
17     repo = "alertmanager";
18     hash = "sha256-soE2D/PLesV1+Kif9myB54a9zIFIa94i0BrmywJPTbI=";
19   };
21   vendorHash = "sha256-zkHIdEdAy44iV2F929NB3ISuUbxdecaeZcsNQQGd06E=";
23   subPackages = [ "cmd/alertmanager" "cmd/amtool" ];
25   ldflags = let t = "github.com/prometheus/common/version"; in [
26     "-X ${t}.Version=${version}"
27     "-X ${t}.Revision=${src.rev}"
28     "-X ${t}.Branch=unknown"
29     "-X ${t}.BuildUser=nix@nixpkgs"
30     "-X ${t}.BuildDate=unknown"
31     "-X ${t}.GoVersion=${lib.getVersion go}"
32   ];
34   nativeBuildInputs = [ installShellFiles ];
36   postInstall = ''
37     $out/bin/amtool --completion-script-bash > amtool.bash
38     installShellCompletion amtool.bash
39     $out/bin/amtool --completion-script-zsh > amtool.zsh
40     installShellCompletion amtool.zsh
41   '';
43   passthru.tests = { inherit (nixosTests.prometheus) alertmanager; };
45   meta = with lib; {
46     description = "Alert dispatcher for the Prometheus monitoring system";
47     homepage = "https://github.com/prometheus/alertmanager";
48     changelog = "https://github.com/prometheus/alertmanager/blob/v${version}/CHANGELOG.md";
49     license = licenses.asl20;
50     maintainers = with maintainers; [ benley fpletz globin Frostman ];
51   };