nixpkgs/pkgs/applications/networking/cluster/stern/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

40 lines
1.1 KiB
Nix

{ stdenv, lib, buildPackages, buildGoModule, fetchFromGitHub, installShellFiles }:
buildGoModule rec {
pname = "stern";
version = "1.28.0";
src = fetchFromGitHub {
owner = "stern";
repo = "stern";
rev = "v${version}";
sha256 = "sha256-Lx5f2dqjdhgMXky1Pv2ik9i56ugsQmZK/ag4veC9Dac=";
};
vendorHash = "sha256-6jI/I7Nw/vJwKNvgH/35uHYu51SBX+WFH5s0WKfCqBo=";
subPackages = [ "." ];
nativeBuildInputs = [ installShellFiles ];
ldflags = [ "-s" "-w" "-X github.com/stern/stern/cmd.version=${version}" ];
postInstall = let
stern = if stdenv.buildPlatform.canExecute stdenv.hostPlatform then "$out" else buildPackages.stern;
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";
mainProgram = "stern";
homepage = "https://github.com/stern/stern";
license = licenses.asl20;
maintainers = with maintainers; [ mbode preisschild ];
};
}