2018-08-12 10:24:42 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, kubectl, makeWrapper }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-11-04 23:32:52 +00:00
|
|
|
pname = "kubectx";
|
2020-05-02 14:22:53 +01:00
|
|
|
version = "0.9.0";
|
2018-08-12 10:24:42 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ahmetb";
|
2018-11-04 23:32:52 +00:00
|
|
|
repo = pname;
|
2018-08-12 10:24:42 +01:00
|
|
|
rev = "v${version}";
|
2020-05-02 14:22:53 +01:00
|
|
|
sha256 = "1b22jk8zl944w5zn3s7ybkkbmzp9519x32pfqwd1malfly7dzf55";
|
2018-08-12 10:24:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2018-10-03 11:58:06 +01:00
|
|
|
mkdir -p $out/share/zsh/site-functions
|
|
|
|
mkdir -p $out/share/bash-completion/completions
|
|
|
|
mkdir -p $out/share/fish/vendor_completions.d
|
|
|
|
|
2018-08-12 10:24:42 +01:00
|
|
|
cp kubectx $out/bin
|
|
|
|
cp kubens $out/bin
|
|
|
|
|
2018-10-03 11:58:06 +01:00
|
|
|
# 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/
|
|
|
|
|
2018-08-12 10:24:42 +01:00
|
|
|
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;
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/ahmetb/kubectx";
|
2018-08-12 10:24:42 +01:00
|
|
|
maintainers = with maintainers; [ periklis ];
|
|
|
|
platforms = with platforms; unix;
|
|
|
|
};
|
|
|
|
}
|