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

56 lines
2.1 KiB
Nix
Raw Normal View History

2015-08-19 22:51:54 +01:00
{ stdenv, fetchFromGitHub, which, go, makeWrapper, iptables, rsync, utillinux, coreutils, e2fsprogs, procps-ng }:
2014-11-15 16:18:14 +00:00
stdenv.mkDerivation rec {
name = "kubernetes-${version}";
2016-06-06 11:58:51 +01:00
version = "1.2.4";
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}";
2016-06-06 11:58:51 +01:00
sha256 = "1a3y0f1l008ywkwwygg9vn2rb722c54i3pbgqks38gw1yyvgbiih";
2014-11-15 16:18:14 +00:00
};
buildInputs = [ makeWrapper which go iptables rsync ];
2015-04-25 13:18:05 +01:00
buildPhase = ''
GOPATH=$(pwd):$(pwd)/Godeps/_workspace
2016-06-06 11:58:51 +01:00
mkdir -p $(pwd)/Godeps/_workspace/src/k8s.io
ln -s $(pwd) $(pwd)/Godeps/_workspace/src/k8s.io/kubernetes
2015-04-25 13:18:05 +01:00
substituteInPlace "hack/lib/golang.sh" --replace "_cgo" ""
patchShebangs ./hack
hack/build-go.sh --use_go_build
(cd cluster/addons/dns/kube2sky && go build ./kube2sky.go)
2015-04-25 13:18:05 +01:00
'';
2014-11-23 00:27:04 +00:00
2014-11-15 16:18:14 +00:00
installPhase = ''
2015-08-19 22:51:54 +01:00
mkdir -p "$out/bin" "$out"/libexec/kubernetes/cluster
cp _output/local/go/bin/{kube*,hyperkube} "$out/bin/"
cp cluster/addons/dns/kube2sky/kube2sky "$out/bin/"
2015-08-19 22:51:54 +01:00
cp cluster/saltbase/salt/helpers/safe_format_and_mount "$out/libexec/kubernetes"
cp -R hack "$out/libexec/kubernetes"
cp cluster/update-storage-objects.sh "$out/libexec/kubernetes/cluster"
makeWrapper "$out"/libexec/kubernetes/cluster/update-storage-objects.sh "$out"/bin/kube-update-storage-objects \
--prefix KUBE_BIN : "$out/bin"
2014-11-15 16:18:14 +00:00
'';
preFixup = ''
wrapProgram "$out/bin/kube-proxy" --prefix PATH : "${iptables}/bin"
2016-08-22 23:06:51 +01:00
wrapProgram "$out/bin/kubelet" --prefix PATH : "${stdenv.lib.makeBinPath [ utillinux procps-ng ]}"
2015-08-19 22:51:54 +01:00
chmod +x "$out/libexec/kubernetes/safe_format_and_mount"
2016-08-22 23:06:51 +01:00
wrapProgram "$out/libexec/kubernetes/safe_format_and_mount" --prefix PATH : "${stdenv.lib.makeBinPath [ e2fsprogs utillinux ]}"
2015-08-19 22:51:54 +01:00
substituteInPlace "$out"/libexec/kubernetes/cluster/update-storage-objects.sh \
--replace KUBE_OUTPUT_HOSTBIN KUBE_BIN
2014-11-15 16:18:14 +00:00
'';
meta = with stdenv.lib; {
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];
2014-11-30 00:24:59 +00:00
platforms = [ "x86_64-linux" ];
2014-11-15 16:18:14 +00:00
};
}