mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
b9f9b05c37
Also provides shell completions for zsh, bash and fish
54 lines
1.4 KiB
Nix
54 lines
1.4 KiB
Nix
{ stdenv, lib, fetchFromGitHub, kubectl, makeWrapper }:
|
|
|
|
with lib;
|
|
|
|
stdenv.mkDerivation rec {
|
|
name = "kubectx";
|
|
version = "0.6.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ahmetb";
|
|
repo = "${name}";
|
|
rev = "v${version}";
|
|
sha256 = "1507g8sm73mqfsxl3fabmj37pk9l4jddsdi4qlpf0ixhk3z1lfkg";
|
|
};
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
dontBuild = true;
|
|
doCheck = false;
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
mkdir -p $out/share/zsh/site-functions
|
|
mkdir -p $out/share/bash-completion/completions
|
|
mkdir -p $out/share/fish/vendor_completions.d
|
|
|
|
cp kubectx $out/bin
|
|
cp kubens $out/bin
|
|
|
|
# Provide ZSH completions
|
|
cp completion/kubectx.zsh $out/share/zsh/site-functions/_kubectx
|
|
cp completion/kubens.zsh $out/share/zsh/site-functions/_kubens
|
|
|
|
# Provide BASH completions
|
|
cp completion/kubectx.bash $out/share/bash-completion/completions/kubectx
|
|
cp completion/kubens.bash $out/share/bash-completion/completions/kubens
|
|
|
|
# Provide FISH completions
|
|
cp completion/*.fish $out/share/fish/vendor_completions.d/
|
|
|
|
for f in $out/bin/*; do
|
|
wrapProgram $f --prefix PATH : ${makeBinPath [ kubectl ]}
|
|
done
|
|
'';
|
|
|
|
meta = {
|
|
description = "Fast way to switch between clusters and namespaces in kubectl!";
|
|
license = licenses.asl20;
|
|
homepage = https://github.com/ahmetb/kubectx;
|
|
maintainers = with maintainers; [ periklis ];
|
|
platforms = with platforms; unix;
|
|
};
|
|
}
|