about summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/kubernetes/kubectl.nix
blob: 754bca32511c1ea7ad204716d9295ecaa514af0c (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
34
35
36
37
38
39
40
41
{ lib, buildGoModule, kubernetes }:

buildGoModule rec {
  pname = "kubectl";

  inherit (kubernetes)
    buildPhase
    doCheck
    nativeBuildInputs
    src
    vendorSha256
    version
    ;

  outputs = [ "out" "man" "convert" ];

  WHAT = lib.concatStringsSep " " [
    "cmd/kubectl"
    "cmd/kubectl-convert"
  ];

  installPhase = ''
    runHook preInstall
    install -D _output/local/go/bin/kubectl -t $out/bin
    install -D _output/local/go/bin/kubectl-convert -t $convert/bin

    installManPage docs/man/man1/kubectl*

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

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