about summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/kubernetes
diff options
context:
space:
mode:
authorzowoq <59103226+zowoq@users.noreply.github.com>2022-02-16 09:35:25 +1000
committerzowoq <59103226+zowoq@users.noreply.github.com>2022-02-25 19:22:30 +1000
commit8c912d5c91ea4064ec905994e8f6e80f4d843c4a (patch)
treecf3efbabee68e7b22c2d4fb2b23c745d6e89b655 /pkgs/applications/networking/cluster/kubernetes
parentae0a6a6b08b2ac4a2b2380ece50552c881c6ac0e (diff)
kubectl: build from source
this allows non-linux users to avoid building the entire kubernetes package
Diffstat (limited to 'pkgs/applications/networking/cluster/kubernetes')
-rw-r--r--pkgs/applications/networking/cluster/kubernetes/kubectl.nix28
1 files changed, 18 insertions, 10 deletions
diff --git a/pkgs/applications/networking/cluster/kubernetes/kubectl.nix b/pkgs/applications/networking/cluster/kubernetes/kubectl.nix
index fec93d8878e05..b1c15458543d3 100644
--- a/pkgs/applications/networking/cluster/kubernetes/kubectl.nix
+++ b/pkgs/applications/networking/cluster/kubernetes/kubectl.nix
@@ -1,29 +1,37 @@
-{ stdenv, kubernetes, installShellFiles }:
+{ lib, stdenv, kubernetes }:
 
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   pname = "kubectl";
-  version = kubernetes.version;
 
-  # kubectl is currently part of the main distribution but will eventially be
-  # split out (see homepage)
-  dontUnpack = true;
-
-  nativeBuildInputs = [ installShellFiles ];
+  inherit (kubernetes)
+    disallowedReferences
+    GOFLAGS
+    nativeBuildInputs
+    postBuild
+    postPatch
+    src
+    version
+    ;
 
   outputs = [ "out" "man" ];
 
+  WHAT = "cmd/kubectl";
+
   installPhase = ''
-    install -D ${kubernetes}/bin/kubectl -t $out/bin
+    runHook preInstall
+    install -D _output/local/go/bin/kubectl -t $out/bin
 
-    installManPage "${kubernetes.man}/share/man/man1"/kubectl*
+    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;
   };
 }