diff options
author | zowoq <59103226+zowoq@users.noreply.github.com> | 2022-02-16 10:05:14 +1000 |
---|---|---|
committer | zowoq <59103226+zowoq@users.noreply.github.com> | 2022-02-25 19:22:30 +1000 |
commit | ae0a6a6b08b2ac4a2b2380ece50552c881c6ac0e (patch) | |
tree | 6dd82dd6f88bc28ea1fef384d59d11401c182c0b /pkgs/applications/networking/cluster/kubernetes | |
parent | ec2028eb3ca59679b829f801524e73223021cb3e (diff) |
kubernetes: only build on linux
- don't build kubectl, symlink from pkgs.kubectl - use GOFLAGS and disallowedReferences - move pause to installPhase
Diffstat (limited to 'pkgs/applications/networking/cluster/kubernetes')
-rw-r--r-- | pkgs/applications/networking/cluster/kubernetes/default.nix | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/pkgs/applications/networking/cluster/kubernetes/default.nix b/pkgs/applications/networking/cluster/kubernetes/default.nix index 7a708c5e061d0..8d11bc28017a6 100644 --- a/pkgs/applications/networking/cluster/kubernetes/default.nix +++ b/pkgs/applications/networking/cluster/kubernetes/default.nix @@ -1,12 +1,12 @@ { stdenv , lib , fetchFromGitHub -, removeReferencesTo , which , go , makeWrapper , rsync , installShellFiles +, kubectl , nixosTests , components ? [ @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { sha256 = "sha256-srJHW/wvrFKKgxVwJB4h0FGeaT7iSJYOTtSeTkcR3FE="; }; - nativeBuildInputs = [ removeReferencesTo makeWrapper which go rsync installShellFiles ]; + nativeBuildInputs = [ makeWrapper which go rsync installShellFiles ]; outputs = [ "out" "man" "pause" ]; @@ -51,12 +51,10 @@ stdenv.mkDerivation rec { WHAT = lib.concatStringsSep " " ([ "cmd/kubeadm" - "cmd/kubectl" ] ++ components); postBuild = '' ./hack/update-generated-docs.sh - (cd build/pause/linux && cc pause.c -o pause) ''; installPhase = '' @@ -65,9 +63,14 @@ stdenv.mkDerivation rec { install -D _output/local/go/bin/''${p##*/} -t $out/bin done - install -D build/pause/linux/pause -t $pause/bin + cc build/pause/linux/pause.c -o pause + install -D pause -t $pause/bin + + rm docs/man/man1/kubectl* installManPage docs/man/man1/*.[1-9] + ln -s ${kubectl}/bin/kubectl $out/bin/kubectl + # Unfortunately, kube-addons-main.sh only looks for the lib file in either the # current working dir or in /opt. We have to patch this for now. substitute cluster/addons/addon-manager/kube-addons-main.sh $out/bin/kube-addons \ @@ -79,24 +82,22 @@ stdenv.mkDerivation rec { cp cluster/addons/addon-manager/kube-addons.sh $out/bin/kube-addons-lib.sh - for tool in kubeadm kubectl; do - installShellCompletion --cmd $tool \ - --bash <($out/bin/$tool completion bash) \ - --zsh <($out/bin/$tool completion zsh) - done + installShellCompletion --cmd kubeadm \ + --bash <($out/bin/kubeadm completion bash) \ + --zsh <($out/bin/kubeadm completion zsh) runHook postInstall ''; - preFixup = '' - find $out/bin $pause/bin -type f -exec remove-references-to -t ${go} '{}' + - ''; + disallowedReferences = [ go ]; + + GOFLAGS = [ "-trimpath" ]; meta = with lib; { description = "Production-Grade Container Scheduling and Management"; license = licenses.asl20; homepage = "https://kubernetes.io"; maintainers = with maintainers; [ ] ++ teams.kubernetes.members; - platforms = platforms.unix; + platforms = platforms.linux; }; passthru.tests = nixosTests.kubernetes; |