about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/cluster/kubernetes/kubectl.nix
blob: b1c15458543d3c4519d8fe91a4627ce5a676cc15 (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
{ lib, stdenv, kubernetes }:

stdenv.mkDerivation rec {
  pname = "kubectl";

  inherit (kubernetes)
    disallowedReferences
    GOFLAGS
    nativeBuildInputs
    postBuild
    postPatch
    src
    version
    ;

  outputs = [ "out" "man" ];

  WHAT = "cmd/kubectl";

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

    installManPage docs/man/man1/kubectl*

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

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