nixpkgs/pkgs/servers/monitoring/sensu-go/default.nix

70 lines
1.9 KiB
Nix
Raw Normal View History

2019-10-29 18:14:46 +01:00
{ buildGoModule, fetchFromGitHub, lib }:
2019-06-09 15:29:49 +02:00
let
generic = { subPackages, pname, postInstall ? "" }:
2019-10-29 18:14:46 +01:00
buildGoModule rec {
2019-06-09 15:29:49 +02:00
inherit pname;
2019-10-29 18:14:46 +01:00
version = "5.14.1";
shortRev = "1f6d16b"; # for internal version info
2019-06-09 15:29:49 +02:00
goPackagePath = "github.com/sensu/sensu-go";
src = fetchFromGitHub {
owner = "sensu";
repo = "sensu-go";
2019-10-29 18:14:46 +01:00
rev = "v${version}";
sha256 = "1fhvw2hrn2zqpz3ypsx6i1zrn83pdifvsyzpbhzxmff6l9a290bq";
2019-06-09 15:29:49 +02:00
};
inherit subPackages postInstall;
2019-10-29 18:14:46 +01:00
modSha256 = "0c0cj0ylhifyb7l9kjmgdlfzcz8528fzw8kr3c5y7j5h6pih06sy";
2019-06-09 15:29:49 +02:00
buildFlagsArray = let
versionPkg = "github.com/sensu/sensu-go/version";
in ''
-ldflags=
-X ${versionPkg}.Version=${version}
-X ${versionPkg}.BuildSHA=${shortRev}
'';
meta = {
homepage = https://sensu.io;
description = "Open source monitoring tool for ephemeral infrastructure & distributed applications";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ thefloweringash ];
};
};
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 15:50:58 +02: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 15:29:49 +02: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" ];
};
}