2018-07-21 02:44:44 +02:00
|
|
|
{ stdenv, buildGoPackage, fetchFromGitHub, go-bindata, libvirt, qemu
|
2019-06-16 21:59:06 +02:00
|
|
|
, gpgme, makeWrapper, vmnet
|
2018-06-06 23:38:05 +02:00
|
|
|
, docker-machine-kvm, docker-machine-kvm2
|
|
|
|
, extraDrivers ? []
|
|
|
|
}:
|
2017-01-31 18:39:24 +01:00
|
|
|
|
2018-06-06 23:38:05 +02:00
|
|
|
let
|
|
|
|
drivers = stdenv.lib.filter (d: d != null) (extraDrivers
|
|
|
|
++ stdenv.lib.optionals stdenv.isLinux [ docker-machine-kvm docker-machine-kvm2 ]);
|
|
|
|
|
|
|
|
binPath = drivers
|
|
|
|
++ stdenv.lib.optionals stdenv.isLinux ([ libvirt qemu ]);
|
2017-01-31 18:39:24 +01:00
|
|
|
|
2017-03-12 02:12:53 +01:00
|
|
|
in buildGoPackage rec {
|
|
|
|
pname = "minikube";
|
|
|
|
name = "${pname}-${version}";
|
2019-05-11 15:58:23 +02:00
|
|
|
version = "1.0.1";
|
2018-10-03 16:41:03 +02:00
|
|
|
|
2019-05-11 15:58:23 +02:00
|
|
|
kubernetesVersion = "1.14.1";
|
2016-12-06 02:23:59 +01:00
|
|
|
|
2017-03-12 02:12:53 +01:00
|
|
|
goPackagePath = "k8s.io/minikube";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "kubernetes";
|
|
|
|
repo = "minikube";
|
|
|
|
rev = "v${version}";
|
2019-05-11 15:58:23 +02:00
|
|
|
sha256 = "1fgyaq8789wc3h6xmn4iw6if2jxdv5my35yn6ipx3q6i4hagxl4b";
|
2016-12-06 02:23:59 +01:00
|
|
|
};
|
|
|
|
|
2018-08-20 20:43:41 +02:00
|
|
|
buildInputs = [ go-bindata makeWrapper gpgme ] ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin vmnet;
|
|
|
|
subPackages = [ "cmd/minikube" ] ++ stdenv.lib.optional stdenv.hostPlatform.isDarwin "cmd/drivers/hyperkit";
|
2016-12-06 02:23:59 +01:00
|
|
|
|
2017-03-12 02:12:53 +01:00
|
|
|
preBuild = ''
|
|
|
|
pushd go/src/${goPackagePath} >/dev/null
|
2016-12-06 02:23:59 +01:00
|
|
|
|
2018-05-08 23:20:11 +02:00
|
|
|
go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/...
|
2017-03-05 04:23:44 +01:00
|
|
|
|
2019-03-08 22:01:53 +01:00
|
|
|
VERSION_MAJOR=$(grep "^VERSION_MAJOR" Makefile | sed "s/^.*\s//")
|
|
|
|
VERSION_MINOR=$(grep "^VERSION_MINOR" Makefile | sed "s/^.*\s//")
|
|
|
|
ISO_VERSION=v$VERSION_MAJOR.$VERSION_MINOR.0
|
2017-03-12 02:12:53 +01:00
|
|
|
ISO_BUCKET=$(grep "^ISO_BUCKET" Makefile | sed "s/^.*\s//")
|
2018-10-03 16:41:03 +02:00
|
|
|
KUBERNETES_VERSION=${kubernetesVersion}
|
2017-01-31 18:39:24 +01:00
|
|
|
|
2017-03-12 02:12:53 +01:00
|
|
|
export buildFlagsArray="-ldflags=\
|
|
|
|
-X k8s.io/minikube/pkg/version.version=v${version} \
|
|
|
|
-X k8s.io/minikube/pkg/version.isoVersion=$ISO_VERSION \
|
2018-05-08 23:20:11 +02:00
|
|
|
-X k8s.io/minikube/pkg/version.isoPath=$ISO_BUCKET \
|
|
|
|
-X k8s.io/minikube/vendor/k8s.io/client-go/pkg/version.gitVersion=$KUBERNETES_VERSION \
|
|
|
|
-X k8s.io/minikube/vendor/k8s.io/kubernetes/pkg/version.gitVersion=$KUBERNETES_VERSION"
|
2017-03-12 02:12:53 +01:00
|
|
|
|
|
|
|
popd >/dev/null
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $bin/share/bash-completion/completions/
|
2018-05-08 00:21:08 +02:00
|
|
|
MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $bin/bin/minikube completion bash > $bin/share/bash-completion/completions/minikube
|
2017-12-13 18:19:40 +01:00
|
|
|
mkdir -p $bin/share/zsh/site-functions/
|
2018-05-08 00:21:08 +02:00
|
|
|
MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $bin/bin/minikube completion zsh > $bin/share/zsh/site-functions/_minikube
|
2016-12-06 02:23:59 +01:00
|
|
|
'';
|
|
|
|
|
2018-05-08 04:38:29 +02:00
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $bin/bin/${pname} --prefix PATH : $bin/bin:${stdenv.lib.makeBinPath binPath}
|
2018-08-20 20:43:41 +02:00
|
|
|
'' + stdenv.lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2018-05-08 04:38:29 +02:00
|
|
|
mv $bin/bin/hyperkit $bin/bin/docker-machine-driver-hyperkit
|
|
|
|
'';
|
2017-03-12 02:12:53 +01:00
|
|
|
|
2016-12-06 02:23:59 +01:00
|
|
|
meta = with stdenv.lib; {
|
2017-03-12 02:12:53 +01:00
|
|
|
homepage = https://github.com/kubernetes/minikube;
|
2016-12-06 02:23:59 +01:00
|
|
|
description = "A tool that makes it easy to run Kubernetes locally";
|
2017-03-12 02:12:53 +01:00
|
|
|
license = licenses.asl20;
|
2019-03-08 22:01:53 +01:00
|
|
|
maintainers = with maintainers; [ ebzzry copumpkin vdemeester ];
|
2017-03-12 02:12:53 +01:00
|
|
|
platforms = with platforms; unix;
|
2016-12-06 02:23:59 +01:00
|
|
|
};
|
|
|
|
}
|