3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/monitoring/sensu-go/default.nix
2019-07-11 23:40:12 +09:00

68 lines
1.8 KiB
Nix

{ buildGoPackage, fetchFromGitHub, lib }:
let
generic = { subPackages, pname, postInstall ? "" }:
buildGoPackage rec {
inherit pname;
version = "5.11.0";
shortRev = "dd8f160"; # for internal version info
goPackagePath = "github.com/sensu/sensu-go";
src = fetchFromGitHub {
owner = "sensu";
repo = "sensu-go";
rev = version;
sha256 = "05dx0nxcjl6fy68br2a37j52iz71kvqnqp29swcif2nwvq7w8mxx";
};
inherit subPackages postInstall;
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
# 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
'';
};
sensu-go-backend = generic {
pname = "sensu-go-backend";
subPackages = [ "cmd/sensu-backend" ];
};
sensu-go-agent = generic {
pname = "sensu-go-agent";
subPackages = [ "cmd/sensu-agent" ];
};
}