15 aarch64-darwin = rec {
16 archSuffix = "Darwin-arm64";
17 url = "https://github.com/lima-vm/lima/releases/download/v${version}/lima-${version}-${archSuffix}.tar.gz";
18 sha256 = "97a0517ff5d72feb30ff413f5f0ef75e4c07982651bb2f7326fe5faadb0232d9";
22 archSuffix = "Darwin-x86_64";
23 url = "https://github.com/lima-vm/lima/releases/download/v${version}/lima-${version}-${archSuffix}.tar.gz";
24 sha256 = "f4a3a01d0ca13bd1bddf14766f39569bc3e074c7744b54d33e9336b1b55e77c9";
28 archSuffix = "Linux-aarch64";
29 url = "https://github.com/lima-vm/lima/releases/download/v${version}/lima-${version}-${archSuffix}.tar.gz";
30 sha256 = "6d3f1fe0ef561e1513579a1bf85b04f1bebe73b4c1f03d8683551ece34fecc6a";
34 archSuffix = "Linux-x86_64";
35 url = "https://github.com/lima-vm/lima/releases/download/v${version}/lima-${version}-${archSuffix}.tar.gz";
36 sha256 = "9a75c8700a988b35986ed6f761f398fdb31d56394a8e2b6801566a86e59b346c";
40 stdenvNoCC.mkDerivation {
44 inherit (dist.${stdenvNoCC.hostPlatform.system} or
45 (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}")) url sha256;
50 nativeBuildInputs = [ makeBinaryWrapper installShellFiles ]
51 ++ lib.optionals stdenvNoCC.isLinux [ autoPatchelfHook ];
57 chmod +x $out/bin/limactl
58 wrapProgram $out/bin/limactl \
59 --prefix PATH : ${lib.makeBinPath [ qemu ]}
60 installShellCompletion --cmd limactl \
61 --bash <($out/bin/limactl completion bash) \
62 --fish <($out/bin/limactl completion fish) \
63 --zsh <($out/bin/limactl completion zsh)
67 doInstallCheck = true;
68 installCheckPhase = ''
69 USER=nix $out/bin/limactl validate $out/share/lima/examples/default.yaml
70 USER=nix $out/bin/limactl validate $out/share/lima/examples/experimental/vz.yaml
73 # Stripping removes entitlements of the binary on Darwin making it non-operational.
74 # Therefore, disable stripping on Darwin.
75 dontStrip = stdenvNoCC.isDarwin;
77 passthru.updateScript =
79 lima-bin = builtins.toString ./bin.nix;
81 writeScript "update-lima-bin.sh" ''
82 #!/usr/bin/env nix-shell
83 #!nix-shell -i bash -p common-updater-scripts curl jq gawk
87 LATEST_VERSION=$(curl -H "Accept: application/vnd.github+json" -Ls https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name | cut -c 2-)
88 curl -Ls -o SHA256SUMS https://github.com/lima-vm/lima/releases/download/v$LATEST_VERSION/SHA256SUMS
89 AARCH64_DARWIN_SHA256=$(cat SHA256SUMS | awk '/Darwin-arm64/{print $1}')
90 X86_64_DARWIN_SHA256=$(cat SHA256SUMS | awk '/Darwin-x86_64/{print $1}')
91 AARCH64_LINUX_SHA256=$(cat SHA256SUMS | awk '/Linux-aarch64/{print $1}')
92 X86_64_LINUX_SHA256=$(cat SHA256SUMS | awk '/Linux-x86_64/{print $1}')
94 # reset version first so that all platforms are always updated and in sync
95 update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=aarch64-darwin
96 update-source-version lima-bin $LATEST_VERSION $AARCH64_DARWIN_SHA256 --file=${lima-bin} --system=aarch64-darwin
97 update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=x86_64-darwin
98 update-source-version lima-bin $LATEST_VERSION $X86_64_DARWIN_SHA256 --file=${lima-bin} --system=x86_64-darwin
99 update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=aarch64-linux
100 update-source-version lima-bin $LATEST_VERSION $AARCH64_LINUX_SHA256 --file=${lima-bin} --system=aarch64-linux
101 update-source-version lima-bin 0 ${lib.fakeSha256} --file=${lima-bin} --system=x86_64-linux
102 update-source-version lima-bin $LATEST_VERSION $X86_64_LINUX_SHA256 --file=${lima-bin} --system=x86_64-linux
107 homepage = "https://github.com/lima-vm/lima";
108 description = "Linux virtual machines (on macOS, in most cases)";
109 license = licenses.asl20;
110 maintainers = with maintainers; [ tricktron ];
111 platforms = platforms.linux ++ platforms.darwin;