19 src = fetchFromGitHub {
23 hash = "sha256-LNsxMrbEgdosGDDUNvMZq/hpP5azNiIHjKTp0Iw/PC0=";
26 vendorHash = "sha256-taozyQBJvkCsJAaOHg1gFK4qOnepRbzIn4jHzxfAn6A=";
31 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ];
33 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ];
36 substituteInPlace Makefile \
37 --replace-fail 'codesign -f -v --entitlements vz.entitlements -s -' 'codesign -f --entitlements vz.entitlements -s -'
40 # It attaches entitlements with codesign and strip removes those,
41 # voiding the entitlements and making it non-operational.
42 dontStrip = stdenv.hostPlatform.isDarwin;
46 make "VERSION=v${version}" "CC=${stdenv.cc.targetPrefix}cc" binaries
51 # Workaround for: could not create "/homeless-shelter/.lima/_config" directory: mkdir /homeless-shelter: permission denied
52 export LIMA_HOME="$(mktemp -d)"
60 wrapProgram $out/bin/limactl \
61 --prefix PATH : ${lib.makeBinPath [ qemu ]}
63 + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
64 installShellCompletion --cmd limactl \
65 --bash <($out/bin/limactl completion bash) \
66 --fish <($out/bin/limactl completion fish) \
67 --zsh <($out/bin/limactl completion zsh)
73 doInstallCheck = true;
74 # Workaround for: "panic: $HOME is not defined" at https://github.com/lima-vm/lima/blob/v1.0.2/pkg/limayaml/defaults.go#L52
75 # Don't use versionCheckHook for this package. It cannot inject environment variables.
76 installCheckPhase = ''
77 if [[ "$(HOME="$(mktemp -d)" "$out/bin/limactl" --version | cut -d ' ' -f 3)" == "${version}" ]]; then
78 echo '${pname} smoke check passed'
80 echo '${pname} smoke check failed'
83 USER=nix $out/bin/limactl validate templates/default.yaml
86 passthru.updateScript = nix-update-script { };
89 homepage = "https://github.com/lima-vm/lima";
90 description = "Linux virtual machines (on macOS, in most cases)";
91 changelog = "https://github.com/lima-vm/lima/releases/tag/v${version}";
92 license = licenses.asl20;
93 maintainers = with maintainers; [ anhduy ];