anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / networking / cluster / minikube / default.nix
bloba367c8bc3aab36c67a2cba7d9682e0b0569cd871
1 { lib
2 , stdenv
3 , buildGoModule
4 , fetchFromGitHub
5 , installShellFiles
6 , pkg-config
7 , which
8 , libvirt
9 , vmnet
10 , withQemu ? false
11 , qemu
12 , makeWrapper
13 , OVMF
16 buildGoModule rec {
17   pname = "minikube";
18   version = "1.34.0";
20   vendorHash = "sha256-gw5Ol7Gp26KyIaiMvwik8FJpABpMT86vpFnZnAJ6hhs=";
22   doCheck = false;
24   src = fetchFromGitHub {
25     owner = "kubernetes";
26     repo = "minikube";
27     rev = "v${version}";
28     sha256 = "sha256-Z7x3MOQUF3a19X4SSiIUfSJ3xl3482eKH700m/9pqcU=";
29   };
30   postPatch =
31     (
32       lib.optionalString (withQemu && stdenv.hostPlatform.isDarwin) ''
33         substituteInPlace \
34           pkg/minikube/registry/drvs/qemu2/qemu2.go \
35           --replace "/usr/local/opt/qemu/share/qemu" "${qemu}/share/qemu" \
36           --replace "/opt/homebrew/opt/qemu/share/qemu" "${qemu}/share/qemu"
37       ''
38     ) + (
39       lib.optionalString (withQemu && stdenv.hostPlatform.isLinux) ''
40         substituteInPlace \
41           pkg/minikube/registry/drvs/qemu2/qemu2.go \
42           --replace "/usr/share/OVMF/OVMF_CODE.fd" "${OVMF.firmware}" \
43           --replace "/usr/share/AAVMF/AAVMF_CODE.fd" "${OVMF.firmware}"
44       ''
45     );
47   nativeBuildInputs = [ installShellFiles pkg-config which makeWrapper ];
49   buildInputs = if stdenv.hostPlatform.isDarwin then [ vmnet ] else if stdenv.hostPlatform.isLinux then [ libvirt ] else null;
51   buildPhase = ''
52     make COMMIT=${src.rev}
53   '';
55   installPhase = ''
56     install out/minikube -Dt $out/bin
58     wrapProgram $out/bin/minikube --set MINIKUBE_WANTUPDATENOTIFICATION false
59     export HOME=$PWD
61     for shell in bash zsh fish; do
62       $out/bin/minikube completion $shell > minikube.$shell
63       installShellCompletion minikube.$shell
64     done
65   '';
67   meta = with lib; {
68     homepage = "https://minikube.sigs.k8s.io";
69     description = "Tool that makes it easy to run Kubernetes locally";
70     mainProgram = "minikube";
71     license = licenses.asl20;
72     maintainers = with maintainers; [ ebzzry copumpkin vdemeester atkinschang Chili-Man ];
73   };