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

80 lines
2.3 KiB
Nix
Raw Normal View History

2017-03-11 14:07:45 +00:00
{ stdenv, lib, fetchFromGitHub, removeReferencesTo, which, go, go-bindata, makeWrapper, rsync
2016-10-10 17:48:00 +01:00
, iptables, coreutils
, components ? [
2017-01-23 20:13:31 +00:00
"cmd/kubeadm"
2016-10-10 17:48:00 +01:00
"cmd/kubectl"
"cmd/kubelet"
"cmd/kube-apiserver"
"cmd/kube-controller-manager"
"cmd/kube-proxy"
"plugin/cmd/kube-scheduler"
2017-09-09 00:59:33 +01:00
"test/e2e/e2e.test"
2016-10-10 17:48:00 +01:00
]
}:
with lib;
2014-11-15 16:18:14 +00:00
stdenv.mkDerivation rec {
name = "kubernetes-${version}";
2018-01-16 16:08:34 +00:00
version = "1.9.1";
2014-11-15 16:18:14 +00:00
src = fetchFromGitHub {
2016-06-06 11:58:51 +01:00
owner = "kubernetes";
2014-11-15 16:18:14 +00:00
repo = "kubernetes";
rev = "v${version}";
2018-01-16 16:08:34 +00:00
sha256 = "1dmq2g138h7fsswmq4l47b44gsl9anmm3ywqyi7y48f1rkvc11mk";
2014-11-15 16:18:14 +00:00
};
2017-03-11 14:07:45 +00:00
buildInputs = [ removeReferencesTo makeWrapper which go rsync go-bindata ];
2014-11-15 16:18:14 +00:00
outputs = ["out" "man" "pause"];
# patch broken go version check, see issue #35403
# patch is from https://github.com/kubernetes/kubernetes/pull/58207
#TODO: patch already merged upstream - remove for next k8s version
patches = [ ./go-version-check.patch ];
2016-10-10 17:48:00 +01:00
postPatch = ''
2015-04-25 13:18:05 +01:00
substituteInPlace "hack/lib/golang.sh" --replace "_cgo" ""
substituteInPlace "hack/generate-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 13:18:05 +01:00
patchShebangs ./hack
'';
2014-11-23 00:27:04 +00:00
2016-10-10 17:48:00 +01:00
WHAT="--use_go_build ${concatStringsSep " " components}";
postBuild = ''
./hack/generate-docs.sh
(cd build/pause && cc pause.c -o pause)
'';
2016-10-10 17:48:00 +01:00
2014-11-15 16:18:14 +00:00
installPhase = ''
2016-12-11 13:56:25 +00:00
mkdir -p "$out/bin" "$out/share/bash-completion/completions" "$man/share/man" "$pause/bin"
2016-10-10 17:48:00 +01:00
cp _output/local/go/bin/* "$out/bin/"
cp build/pause/pause "$pause/bin/pause"
2016-10-10 17:48:00 +01:00
cp -R docs/man/man1 "$man/share/man"
2016-12-11 13:56:25 +00:00
2017-09-01 11:08:11 +01: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"
2016-12-11 13:56:25 +00:00
$out/bin/kubectl completion bash > $out/share/bash-completion/completions/kubectl
2014-11-15 16:18:14 +00:00
'';
preFixup = ''
2017-03-11 14:07:45 +00:00
find $out/bin $pause/bin -type f -exec remove-references-to -t ${go} '{}' +
2014-11-15 16:18:14 +00:00
'';
2016-10-10 17:48:00 +01:00
meta = {
2016-06-06 11:58:51 +01:00
description = "Production-Grade Container Scheduling and Management";
2014-11-15 16:18:14 +00:00
license = licenses.asl20;
2016-06-06 11:58:51 +01:00
homepage = http://kubernetes.io;
2014-11-15 16:18:14 +00:00
maintainers = with maintainers; [offline];
platforms = platforms.unix;
2014-11-15 16:18:14 +00:00
};
}