Merge pull request #86266 from zowoq/minikube

minikube, docker-machine-{hyperkit,kvm2}: use makefile
This commit is contained in:
Mario Rodas 2020-04-29 19:15:46 -05:00 committed by GitHub
commit 2d7e0098f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 52 deletions

View File

@ -1,19 +1,20 @@
{ lib, buildGoModule, minikube }:
buildGoModule rec {
inherit (minikube) version src nativeBuildInputs buildInputs goPackagePath preBuild;
inherit (minikube) version src nativeBuildInputs buildInputs modSha256 commit;
pname = "docker-machine-hyperkit";
subPackages = [ "cmd/drivers/hyperkit" ];
modSha256 = minikube.go-modules.outputHash;
buildPhase = ''
make docker-machine-driver-hyperkit COMMIT=${commit}
'';
postInstall = ''
mv $out/bin/hyperkit $out/bin/docker-machine-driver-hyperkit
installPhase = ''
install out/docker-machine-driver-hyperkit -Dt $out/bin
'';
meta = with lib; {
homepage = "https://github.com/kubernetes/minikube/blob/master/docs/drivers.md";
homepage = "https://minikube.sigs.k8s.io/docs/drivers/hyperkit";
description = "HyperKit driver for docker-machine.";
license = licenses.asl20;
maintainers = with maintainers; [ atkinschang ];

View File

@ -1,22 +1,27 @@
{ lib, buildGoModule, minikube }:
buildGoModule rec {
inherit (minikube) version src nativeBuildInputs buildInputs goPackagePath preBuild;
inherit (minikube) version src nativeBuildInputs buildInputs modSha256 commit;
pname = "docker-machine-kvm2";
subPackages = [ "cmd/drivers/kvm" ];
modSha256 = minikube.go-modules.outputHash;
postPatch = ''
sed -i '/GOARCH=$*/d' Makefile
'';
postInstall = ''
mv $out/bin/kvm $out/bin/docker-machine-driver-kvm2
buildPhase = ''
make docker-machine-driver-kvm2 COMMIT=${commit}
'';
installPhase = ''
install out/docker-machine-driver-kvm2 -Dt $out/bin
'';
meta = with lib; {
homepage = "https://github.com/kubernetes/minikube/blob/master/docs/drivers.md";
homepage = "https://minikube.sigs.k8s.io/docs/drivers/kvm2";
description = "KVM2 driver for docker-machine.";
license = licenses.asl20;
maintainers = with maintainers; [ tadfisher atkinschang ];
platforms = platforms.unix;
platforms = platforms.linux;
};
}

View File

@ -1,67 +1,56 @@
{ stdenv
, buildGoModule
, fetchFromGitHub
, pkgconfig
, makeWrapper
, go-bindata
, installShellFiles
, pkg-config
, which
, libvirt
, vmnet
}:
buildGoModule rec {
pname = "minikube";
pname = "minikube";
version = "1.9.2";
# for -ldflags
commit = "1b78a7b8a99ad6a3c62b8d22f57120d614d17935";
goPackagePath = "k8s.io/minikube";
subPackages = [ "cmd/minikube" ];
modSha256 = "1pxs6myszgma3rzz0nhfjbnylv6m0xzlinvmlg0c4ijvkkzxg3v5";
# for -ldflags
commit = "1b78a7b8a99ad6a3c62b8d22f57120d614d17935";
modSha256 = "1pxs6myszgma3rzz0nhfjbnylv6m0xzlinvmlg0c4ijvkkzxg3v5";
src = fetchFromGitHub {
owner = "kubernetes";
repo = "minikube";
rev = "v${version}";
owner = "kubernetes";
repo = "minikube";
rev = "v${version}";
sha256 = "025v45427d885qkjjg7ig8fgrvjalnf1lajsj0cnbwbih2m69svg";
};
nativeBuildInputs = [ pkgconfig go-bindata makeWrapper ];
buildInputs = stdenv.lib.optionals stdenv.isLinux [ libvirt ]
++ stdenv.lib.optionals stdenv.isDarwin [ vmnet ];
nativeBuildInputs = [ go-bindata installShellFiles pkg-config which ];
preBuild = ''
go-bindata -nomemcopy -o pkg/minikube/assets/assets.go -pkg assets deploy/addons/...
go-bindata -nomemcopy -o pkg/minikube/translate/translations.go -pkg translate translations/...
buildInputs = if stdenv.isDarwin then [ vmnet ] else if stdenv.isLinux then [ libvirt ] else null;
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
ISO_BUCKET=$(grep "^ISO_BUCKET" Makefile | sed "s/^.*\s//")
export buildFlagsArray="-ldflags=\
-X ${goPackagePath}/pkg/version.version=v${version} \
-X ${goPackagePath}/pkg/version.isoVersion=$ISO_VERSION \
-X ${goPackagePath}/pkg/version.isoPath=$ISO_BUCKET \
-X ${goPackagePath}/pkg/version.gitCommitID=${commit} \
-X ${goPackagePath}/pkg/drivers/kvm.version=v${version} \
-X ${goPackagePath}/pkg/drivers/kvm.gitCommitID=${commit} \
-X ${goPackagePath}/pkg/drivers/hyperkit.version=v${version} \
-X ${goPackagePath}/pkg/drivers/hyperkit.gitCommitID=${commit}"
buildPhase = ''
make COMMIT=${commit}
'';
postInstall = ''
mkdir -p $out/share/bash-completion/completions/
MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $out/bin/minikube completion bash > $out/share/bash-completion/completions/minikube
installPhase = ''
install out/minikube -Dt $out/bin
mkdir -p $out/share/zsh/site-functions/
MINIKUBE_WANTUPDATENOTIFICATION=false MINIKUBE_WANTKUBECTLDOWNLOADMSG=false HOME=$PWD $out/bin/minikube completion zsh > $out/share/zsh/site-functions/_minikube
export HOME=$PWD
export MINIKUBE_WANTUPDATENOTIFICATION=false
export MINIKUBE_WANTKUBECTLDOWNLOADMSG=false
for shell in bash zsh; do
$out/bin/minikube completion $shell > minikube.$shell
installShellCompletion minikube.$shell
done
'';
meta = with stdenv.lib; {
homepage = "https://github.com/kubernetes/minikube";
homepage = "https://minikube.sigs.k8s.io";
description = "A tool that makes it easy to run Kubernetes locally";
license = licenses.asl20;
license = licenses.asl20;
maintainers = with maintainers; [ ebzzry copumpkin vdemeester atkinschang ];
platforms = with platforms; unix;
platforms = platforms.unix;
};
}