nixpkgs/pkgs/applications/networking/cluster/stern/default.nix
2020-12-20 00:10:52 +01:00

41 lines
1.1 KiB
Nix

{ stdenv, lib, buildPackages, buildGoModule, fetchFromGitHub, installShellFiles }:
let isCrossBuild = stdenv.hostPlatform != stdenv.buildPlatform;
in
buildGoModule rec {
pname = "stern";
version = "1.13.1";
src = fetchFromGitHub {
owner = "stern";
repo = "stern";
rev = "v${version}";
sha256 = "0fj6a52wb0jv5bz2j2wq3ljnlxnsj9bg3kbzgkz0vh0b63zyn782";
};
vendorSha256 = "14nrdaaby74bjbk777hr82p0ybzk3spc59lbrjn9z0q3hc0p4vaf";
nativeBuildInputs = [ installShellFiles ];
buildFlagsArray =
[ "-ldflags=-s -w -X github.com/stern/stern/cmd.version=${version}" ];
postInstall =
let stern = if isCrossBuild then buildPackages.stern else "$out";
in
''
for shell in bash zsh; do
${stern}/bin/stern --completion $shell > stern.$shell
installShellCompletion stern.$shell
done
'';
meta = with lib; {
description = "Multi pod and container log tailing for Kubernetes";
homepage = "https://github.com/stern/stern";
license = licenses.asl20;
maintainers = with maintainers; [ mbode preisschild ];
platforms = platforms.unix;
};
}