2020-03-21 11:23:00 +00:00
|
|
|
{ buildGoModule, fetchFromGitHub, stdenv, Security }:
|
2019-06-09 13:29:49 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
generic = { subPackages, pname, postInstall ? "" }:
|
2019-10-29 17:14:46 +00:00
|
|
|
buildGoModule rec {
|
2019-06-09 13:29:49 +00:00
|
|
|
inherit pname;
|
2020-03-14 13:08:11 +00:00
|
|
|
version = "5.18.1";
|
2019-10-29 17:14:46 +00:00
|
|
|
shortRev = "1f6d16b"; # for internal version info
|
2019-06-09 13:29:49 +00:00
|
|
|
|
|
|
|
goPackagePath = "github.com/sensu/sensu-go";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sensu";
|
|
|
|
repo = "sensu-go";
|
2019-10-29 17:14:46 +00:00
|
|
|
rev = "v${version}";
|
2020-03-14 13:08:11 +00:00
|
|
|
sha256 = "1iwlkm7ac7brap45r6ly0blywgq6f28r1nws3yf0ybydv30brfj4";
|
2019-06-09 13:29:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inherit subPackages postInstall;
|
|
|
|
|
2020-03-14 13:08:11 +00:00
|
|
|
modSha256 = "02h4cav6ivzs3z0qakwxzf5lfy6hzax5c0i2icp0qymqc2789npw";
|
2019-10-29 17:14:46 +00:00
|
|
|
|
2020-03-21 11:23:00 +00:00
|
|
|
buildInputs = stdenv.lib.optionals stdenv.isDarwin [ Security ];
|
|
|
|
|
2019-06-09 13:29:49 +00:00
|
|
|
buildFlagsArray = let
|
|
|
|
versionPkg = "github.com/sensu/sensu-go/version";
|
|
|
|
in ''
|
|
|
|
-ldflags=
|
|
|
|
-X ${versionPkg}.Version=${version}
|
|
|
|
-X ${versionPkg}.BuildSHA=${shortRev}
|
|
|
|
'';
|
|
|
|
|
2020-03-21 11:23:00 +00:00
|
|
|
meta = with stdenv.lib; {
|
2020-03-14 13:08:11 +00:00
|
|
|
homepage = "https://sensu.io";
|
2019-06-09 13:29:49 +00:00
|
|
|
description = "Open source monitoring tool for ephemeral infrastructure & distributed applications";
|
2020-03-21 11:23:00 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ thefloweringash ];
|
2019-06-09 13:29:49 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
sensu-go-cli = generic {
|
|
|
|
pname = "sensu-go-cli";
|
|
|
|
subPackages = [ "cmd/sensuctl" ];
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p \
|
|
|
|
"''${!outputBin}/share/bash-completion/completions" \
|
|
|
|
"''${!outputBin}/share/zsh/site-functions"
|
|
|
|
|
|
|
|
''${!outputBin}/bin/sensuctl completion bash > ''${!outputBin}/share/bash-completion/completions/sensuctl
|
2019-07-11 13:50:58 +00:00
|
|
|
|
|
|
|
# https://github.com/sensu/sensu-go/issues/3132
|
|
|
|
(
|
|
|
|
echo "#compdef sensuctl"
|
|
|
|
''${!outputBin}/bin/sensuctl completion zsh
|
|
|
|
echo '_complete sensuctl 2>/dev/null'
|
|
|
|
) > ''${!outputBin}/share/zsh/site-functions/_sensuctl
|
|
|
|
|
2019-06-09 13:29:49 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
sensu-go-backend = generic {
|
|
|
|
pname = "sensu-go-backend";
|
|
|
|
subPackages = [ "cmd/sensu-backend" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
sensu-go-agent = generic {
|
|
|
|
pname = "sensu-go-agent";
|
|
|
|
subPackages = [ "cmd/sensu-agent" ];
|
|
|
|
};
|
|
|
|
}
|