about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/cluster/kubectl/default.nix
blob: 40d42408679eb7486a3cd7b05f9808838a6b3b29 (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
29
30
31
32
33
{ stdenv, kubernetes }:

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

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

  outputs = [ "out" "man" ];

  doBuild = false;

  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

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

    $out/bin/kubectl completion bash > $out/share/bash-completion/completions/kubectl
    $out/bin/kubectl completion zsh > $out/share/zsh/site-functions/_kubectl
  '';

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