Skip to content

Commit

Permalink
kubectl: use installShellFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
zowoq committed Dec 9, 2020
1 parent 563ff4a commit d183736
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions pkgs/applications/networking/cluster/kubectl/default.nix
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
{ stdenv, kubernetes }:
{ stdenv, kubernetes, installShellFiles }:

stdenv.mkDerivation {
name = "kubectl-${kubernetes.version}";

# kubectl is currently part of the main distribution but will eventially be
# split out (see homepage)
src = kubernetes;
dontUnpack = true;

nativeBuildInputs = [ installShellFiles ];

outputs = [ "out" "man" ];

installPhase = ''
mkdir -p \
"$out/bin" \
"$out/share/bash-completion/completions" \
"$out/share/zsh/site-functions" \
"$man/share/man/man1"
cp bin/kubectl $out/bin/kubectl
install -D ${kubernetes}/bin/kubectl -t $out/bin
cp "${kubernetes.man}/share/man/man1"/kubectl* "$man/share/man/man1"
installManPage "${kubernetes.man}/share/man/man1"/kubectl*
$out/bin/kubectl completion bash > $out/share/bash-completion/completions/kubectl
$out/bin/kubectl completion zsh > $out/share/zsh/site-functions/_kubectl
installShellCompletion --cmd kubectl \
--bash <($out/bin/kubectl completion bash) \
--zsh <($out/bin/kubectl completion zsh)
'';

meta = kubernetes.meta // {
Expand Down

0 comments on commit d183736

Please sign in to comment.