1 { buildGo121Module, fetchFromGitHub, lib }:
4 generic = { subPackages, pname, postInstall ? "", mainProgram }:
8 shortRev = "9587df6"; # for internal version info
10 src = fetchFromGitHub {
14 sha256 = "sha256-Vcay8vUYLjV65g526btQX0+m5n/cRocIKx7C2LuWeP4=";
17 inherit subPackages postInstall;
19 vendorHash = "sha256-ADqU/ZJiyZ5hAkqFXExmA8fSZxzhx42QptYu3TIlgBc=";
22 # Without this, we get error messages like:
23 # 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)
24 # The patch was generated by changing "go 1.16" to "go 1.21" and executing `go mod tidy`.
25 ./fix-go-version-error.patch
31 versionPkg = "github.com/sensu/sensu-go/version";
33 "-X ${versionPkg}.Version=${version}"
34 "-X ${versionPkg}.BuildSHA=${shortRev}"
39 homepage = "https://sensu.io";
40 description = "Open source monitoring tool for ephemeral infrastructure & distributed applications";
41 license = lib.licenses.mit;
42 maintainers = with lib.maintainers; [ thefloweringash ];
47 sensu-go-cli = generic {
48 pname = "sensu-go-cli";
49 subPackages = [ "cmd/sensuctl" ];
52 "''${!outputBin}/share/bash-completion/completions" \
53 "''${!outputBin}/share/zsh/site-functions"
55 ''${!outputBin}/bin/sensuctl completion bash > ''${!outputBin}/share/bash-completion/completions/sensuctl
57 # https://github.com/sensu/sensu-go/issues/3132
59 echo "#compdef sensuctl"
60 ''${!outputBin}/bin/sensuctl completion zsh
61 echo '_complete sensuctl 2>/dev/null'
62 ) > ''${!outputBin}/share/zsh/site-functions/_sensuctl
65 mainProgram = "sensuctl";
68 sensu-go-backend = generic {
69 pname = "sensu-go-backend";
70 subPackages = [ "cmd/sensu-backend" ];
71 mainProgram = "sensu-backend";
74 sensu-go-agent = generic {
75 pname = "sensu-go-agent";
76 subPackages = [ "cmd/sensu-agent" ];
77 mainProgram = "sensu-agent";