2016-10-10 17:48:00 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, which, go, go-bindata, makeWrapper, rsync
|
|
|
|
, iptables, coreutils
|
|
|
|
, components ? [
|
|
|
|
"cmd/kubectl"
|
|
|
|
"cmd/kubelet"
|
|
|
|
"cmd/kube-apiserver"
|
|
|
|
"cmd/kube-controller-manager"
|
|
|
|
"cmd/kube-proxy"
|
|
|
|
"plugin/cmd/kube-scheduler"
|
|
|
|
"cmd/kube-dns"
|
|
|
|
"federation/cmd/federation-apiserver"
|
|
|
|
"federation/cmd/federation-controller-manager"
|
|
|
|
]
|
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
2014-11-15 16:18:14 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "kubernetes-${version}";
|
2016-12-13 14:24:18 +00:00
|
|
|
version = "1.5.2";
|
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";
|
2015-03-18 13:26:40 +00:00
|
|
|
rev = "v${version}";
|
2016-12-13 14:24:18 +00:00
|
|
|
sha256 = "1ps9bn5gqknyjv0b9jvp7xg3cyd4anq11j785p22347al0b8w81v";
|
2014-11-15 16:18:14 +00:00
|
|
|
};
|
|
|
|
|
2016-10-10 17:48:00 +01:00
|
|
|
buildInputs = [ makeWrapper which go rsync go-bindata ];
|
2014-11-15 16:18:14 +00:00
|
|
|
|
2016-12-11 14:04:00 +00:00
|
|
|
outputs = ["out" "man" "pause"];
|
2015-06-08 12:10:32 +01:00
|
|
|
|
2016-10-10 17:48:00 +01:00
|
|
|
postPatch = ''
|
2015-04-25 13:18:05 +01:00
|
|
|
substituteInPlace "hack/lib/golang.sh" --replace "_cgo" ""
|
2016-12-11 14:04:00 +00:00
|
|
|
substituteInPlace "hack/generate-docs.sh" --replace "make" "make SHELL=${stdenv.shell}"
|
2017-01-15 01:30:43 +00:00
|
|
|
# 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"
|
2016-12-11 14:04:00 +00:00
|
|
|
|
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}";
|
|
|
|
|
2016-12-11 14:04:00 +00:00
|
|
|
postBuild = ''
|
|
|
|
./hack/generate-docs.sh
|
2016-12-13 14:24:18 +00:00
|
|
|
(cd build-tools/pause && gcc pause.c -o pause)
|
2016-12-11 14:04:00 +00:00
|
|
|
'';
|
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/"
|
2016-12-13 14:24:18 +00:00
|
|
|
cp build-tools/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
|
|
|
|
|
|
|
$out/bin/kubectl completion bash > $out/share/bash-completion/completions/kubectl
|
2014-11-15 16:18:14 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = ''
|
2016-10-10 17:48:00 +01:00
|
|
|
# Remove references to go compiler
|
|
|
|
while read file; do
|
|
|
|
cat $file | sed "s,${go},$(echo "${go}" | sed "s,$NIX_STORE/[^-]*,$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,"),g" > $file.tmp
|
|
|
|
mv $file.tmp $file
|
|
|
|
chmod +x $file
|
|
|
|
done < <(find $out/bin $pause/bin -type f 2>/dev/null)
|
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];
|
2016-10-10 17:48:00 +01:00
|
|
|
platforms = platforms.linux;
|
2014-11-15 16:18:14 +00:00
|
|
|
};
|
|
|
|
}
|