@@ -0,0 +1,53 @@
1+{ lib
2+, buildGoModule
3+, fetchFromGitHub
4+, installShellFiles
5+, qemu
6+, makeWrapper
7+}:
8+
9+buildGoModule rec {
10+ pname = "lima";
11+ version = "0.4.0";
12+
13+ src = fetchFromGitHub {
14+ owner = "AkihiroSuda";
15+ repo = pname;
16+ rev = "v${version}";
17+ sha256 = "sha256-vwAxVBy2SqghxJGscSZ1o1B8EMvQh1fz5CS1YG7Rq2g=";
18+ };
19+
20+ vendorSha256 = "sha256-xM9LLh5c5QBrcIptdqiNNp1nU9GcdQvwrCnnyuXWYfE=";
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+ runHook postInstall
39+ '';
40+
41+ doInstallCheck = true;
42+ installCheckPhase = ''
43+ USER=nix $out/bin/limactl validate examples/default.yaml
44+ '';
45+
46+ meta = with lib; {
47+ homepage = "https://github.com/AkihiroSuda/lima";
48+ description = "Linux virtual machines (on macOS, in most cases)";
49+ license = licenses.asl20;
50+ maintainers = with maintainers; [ anhduy ];
51+ };
52+}
53+