1{ lib
2, buildGoModule
3, fetchFromGitHub
4, installShellFiles
5, qemu
6, makeWrapper
7}:
8
9buildGoModule rec {
10 pname = "lima";
11 version = "0.7.3";
12
13 src = fetchFromGitHub {
14 owner = "lima-vm";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "sha256-HVWZ0XF1oBUHhkOQHELlZ/pxXUsUo2cVo6EhZl6S0W4=";
18 };
19
20 vendorSha256 = "sha256-LhmZRa7vDylA4DRTfKFRs3lQMnwNfzF1H6ki1/zdpUg=";
21
22 nativeBuildInputs = [ makeWrapper installShellFiles ];
23
24 buildPhase = ''
25 runHook preBuild
26 make "VERSION=v${version}" binaries
27 runHook postBuild
28 '';
29
30 installPhase = ''
31 runHook preInstall
32 mkdir -p $out
33 cp -r _output/* $out
34 wrapProgram $out/bin/limactl \
35 --prefix PATH : ${lib.makeBinPath [ qemu ]}
36 installShellCompletion --cmd limactl \
37 --bash <($out/bin/limactl completion bash) \
38 --fish <($out/bin/limactl completion fish) \
39 --zsh <($out/bin/limactl completion zsh)
40 runHook postInstall
41 '';
42
43 doInstallCheck = true;
44 installCheckPhase = ''
45 USER=nix $out/bin/limactl validate examples/default.yaml
46 '';
47
48 meta = with lib; {
49 homepage = "https://github.com/lima-vm/lima";
50 description = "Linux virtual machines (on macOS, in most cases)";
51 license = licenses.asl20;
52 maintainers = with maintainers; [ anhduy ];
53 };
54}