summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/kubectl/default.nix
blob: c550a0e2f2b6995ddc8ac7243f51f07b639a931b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ 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)
  dontUnpack = true;

  nativeBuildInputs = [ installShellFiles ];

  outputs = [ "out" "man" ];

  installPhase = ''
    install -D ${kubernetes}/bin/kubectl -t $out/bin

    installManPage "${kubernetes.man}/share/man/man1"/kubectl*

    installShellCompletion --cmd kubectl \
      --bash <($out/bin/kubectl completion bash) \
      --zsh <($out/bin/kubectl completion zsh)
  '';

  meta = kubernetes.meta // {
    description = "Kubernetes CLI";
    homepage = "https://github.com/kubernetes/kubectl";
  };
}