kubelogin: install shell completions (#346587)

This commit is contained in:
Aleksana 2024-10-17 12:08:05 +08:00 committed by GitHub
commit a7671c23ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, buildGoModule, go }:
{ stdenv, lib, fetchFromGitHub, buildGoModule, installShellFiles, go }:
buildGoModule rec {
pname = "kubelogin";
@ -18,6 +18,17 @@ buildGoModule rec {
"-X main.goVersion=${lib.getVersion go}"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
$out/bin/kubelogin completion bash >kubelogin.bash
$out/bin/kubelogin completion fish >kubelogin.fish
$out/bin/kubelogin completion zsh >kubelogin.zsh
installShellCompletion kubelogin.{bash,fish,zsh}
'';
__darwinAllowLocalNetworking = true;
meta = with lib; {
description = "Kubernetes credential plugin implementing Azure authentication";
mainProgram = "kubelogin";