diff --git a/pkgs/by-name/k8/k8sgpt/package.nix b/pkgs/by-name/k8/k8sgpt/package.nix index dc409a18ed61..a2e828265cf4 100644 --- a/pkgs/by-name/k8/k8sgpt/package.nix +++ b/pkgs/by-name/k8/k8sgpt/package.nix @@ -1,25 +1,35 @@ { lib, + stdenv, buildGoModule, fetchFromGitHub, + installShellFiles, }: buildGoModule (finalAttrs: { pname = "k8sgpt"; - version = "0.4.8"; + version = "0.4.28"; + + nativeBuildInputs = [ + installShellFiles + ]; src = fetchFromGitHub { owner = "k8sgpt-ai"; repo = "k8sgpt"; rev = "v${finalAttrs.version}"; - hash = "sha256-TaJBGU+nLMVOL1uiHPan8p2DfuAWTr57Lt2BtfNq6dA="; + hash = "sha256-hY1gyKy37SIASyhlWD+2aAeyfgfFpoBtm2XXIwCrh/Y="; }; - vendorHash = "sha256-960gfOCpqY2gCbHR+fYFeV9UjztWMRVQKHIg/n3ELxk="; + vendorHash = "sha256-6RgcIGGhtgxWR90gQWxXYxID6L5bZLrLLH0S+MSIO2w="; # https://nixos.org/manual/nixpkgs/stable/#var-go-CGO_ENABLED env.CGO_ENABLED = 0; + preCheck = '' + export HOME=$TMPDIR + ''; + # https://nixos.org/manual/nixpkgs/stable/#ssec-skip-go-tests ldflags = [ "-s" @@ -29,6 +39,13 @@ buildGoModule (finalAttrs: { "-X main.date=1970-01-01-00:00:01" ]; + postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion --cmd k8sgpt \ + --bash <($out/bin/k8sgpt completion bash) \ + --zsh <($out/bin/k8sgpt completion zsh) \ + --fish <($out/bin/k8sgpt completion fish) + ''; + meta = { description = "Giving Kubernetes Superpowers to everyone"; mainProgram = "k8sgpt";