about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/cluster/minikube/default.nix
blob: bd9d0fece1b5b9ce5c9758646ff1051af8d89e56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, installShellFiles
, pkg-config
, which
, libvirt
, vmnet
, withQemu ? false
, qemu
, makeWrapper
, OVMF
}:

buildGoModule rec {
  pname = "minikube";
  version = "1.32.0";

  vendorHash = "sha256-MzB+my1NwvZx9qfojuOlTHmuY6CyLFlrgr4UEuC5FBk=";

  doCheck = false;

  src = fetchFromGitHub {
    owner = "kubernetes";
    repo = "minikube";
    rev = "v${version}";
    sha256 = "sha256-2EWaMpcr4F1wRzIP1rPg1a/Sjd1x+oo2ee90k4Ie8cU=";
  };
  postPatch =
    (
      lib.optionalString (withQemu && stdenv.isDarwin) ''
        substituteInPlace \
          pkg/minikube/registry/drvs/qemu2/qemu2.go \
          --replace "/usr/local/opt/qemu/share/qemu" "${qemu}/share/qemu" \
          --replace "/opt/homebrew/opt/qemu/share/qemu" "${qemu}/share/qemu"
      ''
    ) + (
      lib.optionalString (withQemu && stdenv.isLinux) ''
        substituteInPlace \
          pkg/minikube/registry/drvs/qemu2/qemu2.go \
          --replace "/usr/share/OVMF/OVMF_CODE.fd" "${OVMF.firmware}" \
          --replace "/usr/share/AAVMF/AAVMF_CODE.fd" "${OVMF.firmware}"
      ''
    );

  nativeBuildInputs = [ installShellFiles pkg-config which makeWrapper ];

  buildInputs = if stdenv.isDarwin then [ vmnet ] else if stdenv.isLinux then [ libvirt ] else null;

  buildPhase = ''
    make COMMIT=${src.rev}
  '';

  installPhase = ''
    install out/minikube -Dt $out/bin

    wrapProgram $out/bin/minikube --set MINIKUBE_WANTUPDATENOTIFICATION false
    export HOME=$PWD

    for shell in bash zsh fish; do
      $out/bin/minikube completion $shell > minikube.$shell
      installShellCompletion minikube.$shell
    done
  '';

  meta = with lib; {
    homepage = "https://minikube.sigs.k8s.io";
    description = "A tool that makes it easy to run Kubernetes locally";
    license = licenses.asl20;
    maintainers = with maintainers; [ ebzzry copumpkin vdemeester atkinschang Chili-Man ];
  };
}