nixpkgs-suyu/pkgs/applications/networking/cluster/kubernetes/default.nix

80 lines
2.3 KiB
Nix
Raw Normal View History

2018-12-12 05:30:50 +01:00
{ stdenv, lib, fetchFromGitHub, removeReferencesTo, which, go, go-bindata, makeWrapper, rsync
2016-10-10 18:48:00 +02:00
, components ? [
2017-01-23 21:13:31 +01:00
"cmd/kubeadm"
2016-10-10 18:48:00 +02:00
"cmd/kubectl"
"cmd/kubelet"
"cmd/kube-apiserver"
"cmd/kube-controller-manager"
"cmd/kube-proxy"
2018-03-31 01:16:32 +02:00
"cmd/kube-scheduler"
2017-09-09 01:59:33 +02:00
"test/e2e/e2e.test"
2016-10-10 18:48:00 +02:00
]
}:
with lib;
2014-11-15 17:18:14 +01:00
stdenv.mkDerivation rec {
pname = "kubernetes";
2020-11-12 13:05:39 +01:00
version = "1.19.4";
2014-11-15 17:18:14 +01:00
src = fetchFromGitHub {
2016-06-06 12:58:51 +02:00
owner = "kubernetes";
2014-11-15 17:18:14 +01:00
repo = "kubernetes";
rev = "v${version}";
2020-11-12 13:05:39 +01:00
sha256 = "05gisihrklkzsdsrrmvmqlfwfdx73jbwd5668n5wa5hp432qyvwi";
2014-11-15 17:18:14 +01:00
};
nativeBuildInputs = [ removeReferencesTo makeWrapper which go rsync go-bindata ];
2014-11-15 17:18:14 +01:00
outputs = ["out" "man" "pause"];
2016-10-10 18:48:00 +02:00
postPatch = ''
2019-08-09 09:50:49 +02:00
# go env breaks the sandbox
substituteInPlace "hack/lib/golang.sh" \
--replace 'echo "$(go env GOHOSTOS)/$(go env GOHOSTARCH)"' 'echo "${go.GOOS}/${go.GOARCH}"'
2019-04-07 17:01:41 +02:00
substituteInPlace "hack/update-generated-docs.sh" --replace "make" "make SHELL=${stdenv.shell}"
# hack/update-munge-docs.sh only performs some tests on the documentation.
# They broke building k8s; disabled for now.
echo "true" > "hack/update-munge-docs.sh"
2015-04-25 14:18:05 +02:00
patchShebangs ./hack
'';
2014-11-23 01:27:04 +01:00
2019-09-09 01:38:31 +02:00
WHAT=concatStringsSep " " components;
2016-10-10 18:48:00 +02:00
postBuild = ''
2019-04-07 17:01:41 +02:00
./hack/update-generated-docs.sh
(cd build/pause && cc pause.c -o pause)
'';
2016-10-10 18:48:00 +02:00
2014-11-15 17:18:14 +01:00
installPhase = ''
2018-03-31 16:37:32 +02:00
mkdir -p "$out/bin" "$out/share/bash-completion/completions" "$out/share/zsh/site-functions" "$man/share/man" "$pause/bin"
2016-10-10 18:48:00 +02:00
cp _output/local/go/bin/* "$out/bin/"
cp build/pause/pause "$pause/bin/pause"
2016-10-10 18:48:00 +02:00
cp -R docs/man/man1 "$man/share/man"
2016-12-11 14:56:25 +01:00
2017-09-01 12:08:11 +02:00
cp cluster/addons/addon-manager/kube-addons.sh $out/bin/kube-addons
patchShebangs $out/bin/kube-addons
wrapProgram $out/bin/kube-addons --set "KUBECTL_BIN" "$out/bin/kubectl"
2019-08-09 09:50:49 +02:00
cp ${./mk-docker-opts.sh} $out/bin/mk-docker-opts.sh
2016-12-11 14:56:25 +01:00
$out/bin/kubectl completion bash > $out/share/bash-completion/completions/kubectl
2018-03-31 16:37:32 +02:00
$out/bin/kubectl completion zsh > $out/share/zsh/site-functions/_kubectl
2014-11-15 17:18:14 +01:00
'';
preFixup = ''
2018-12-12 05:30:50 +01:00
find $out/bin $pause/bin -type f -exec remove-references-to -t ${go} '{}' +
2014-11-15 17:18:14 +01:00
'';
2016-10-10 18:48:00 +02:00
meta = {
2016-06-06 12:58:51 +02:00
description = "Production-Grade Container Scheduling and Management";
2014-11-15 17:18:14 +01:00
license = licenses.asl20;
2020-04-01 15:59:46 +02:00
homepage = "https://kubernetes.io";
maintainers = with maintainers; [johanot offline saschagrunert];
platforms = platforms.unix;
2014-11-15 17:18:14 +01:00
};
}