libfmvoice: 0-unstable-2024-11-08 -> 0-unstable-2024-12-11 (#364919)
[NixPkgs.git] / pkgs / servers / monitoring / sensu-go / default.nix
blob2ddfdb4f4de61f133c1a65852ee8994b26fafe66
2   buildGo122Module,
3   fetchFromGitHub,
4   lib,
5 }:
7 let
8   generic =
9     {
10       subPackages,
11       pname,
12       postInstall ? "",
13       mainProgram,
14     }:
15     buildGo122Module rec {
16       inherit pname;
17       version = "6.11.0";
18       shortRev = "9587df6"; # for internal version info
20       src = fetchFromGitHub {
21         owner = "sensu";
22         repo = "sensu-go";
23         rev = "v${version}";
24         sha256 = "sha256-Vcay8vUYLjV65g526btQX0+m5n/cRocIKx7C2LuWeP4=";
25       };
27       inherit subPackages postInstall;
29       vendorHash = "sha256-ADqU/ZJiyZ5hAkqFXExmA8fSZxzhx42QptYu3TIlgBc=";
31       patches = [
32         # Without this, we get error messages like:
33         # vendor/golang.org/x/sys/unix/mremap.go:41:10: unsafe.Slice requires go1.17 or later (-lang was set to go1.16; check go.mod)
34         # The patch was generated by changing "go 1.16" to "go 1.21" and executing `go mod tidy`.
35         ./fix-go-version-error.patch
36       ];
38       doCheck = false;
40       ldflags =
41         let
42           versionPkg = "github.com/sensu/sensu-go/version";
43         in
44         [
45           "-X ${versionPkg}.Version=${version}"
46           "-X ${versionPkg}.BuildSHA=${shortRev}"
47         ];
49       meta = {
50         inherit mainProgram;
51         homepage = "https://sensu.io";
52         description = "Open source monitoring tool for ephemeral infrastructure & distributed applications";
53         license = lib.licenses.mit;
54         maintainers = with lib.maintainers; [
55           thefloweringash
56           teutat3s
57         ];
58       };
59     };
62   sensu-go-cli = generic {
63     pname = "sensu-go-cli";
64     subPackages = [ "cmd/sensuctl" ];
65     postInstall = ''
66       mkdir -p \
67         "''${!outputBin}/share/bash-completion/completions" \
68         "''${!outputBin}/share/zsh/site-functions"
70       ''${!outputBin}/bin/sensuctl completion bash > ''${!outputBin}/share/bash-completion/completions/sensuctl
72       # https://github.com/sensu/sensu-go/issues/3132
73       (
74         echo "#compdef sensuctl"
75         ''${!outputBin}/bin/sensuctl completion zsh
76         echo '_complete sensuctl 2>/dev/null'
77       ) > ''${!outputBin}/share/zsh/site-functions/_sensuctl
79     '';
80     mainProgram = "sensuctl";
81   };
83   sensu-go-backend = generic {
84     pname = "sensu-go-backend";
85     subPackages = [ "cmd/sensu-backend" ];
86     mainProgram = "sensu-backend";
87   };
89   sensu-go-agent = generic {
90     pname = "sensu-go-agent";
91     subPackages = [ "cmd/sensu-agent" ];
92     mainProgram = "sensu-agent";
93   };