lima: 1.0.1 -> 1.0.2 and add version test (#361378)

authored by

OTABI Tomoya and committed by
GitHub
2d036d3a d05b3108

+45 -30
+45 -30
pkgs/applications/virtualization/lima/default.nix
··· 1 - { lib 2 - , stdenv 3 - , buildGoModule 4 - , fetchFromGitHub 5 - , installShellFiles 6 - , qemu 7 - , sigtool 8 - , makeWrapper 9 - , nix-update-script 10 - , apple-sdk_15 1 + { 2 + lib, 3 + stdenv, 4 + buildGoModule, 5 + fetchFromGitHub, 6 + installShellFiles, 7 + qemu, 8 + sigtool, 9 + makeWrapper, 10 + nix-update-script, 11 + apple-sdk_15, 12 + lima, 11 13 }: 12 14 13 15 buildGoModule rec { 14 16 pname = "lima"; 15 - version = "1.0.1"; 17 + version = "1.0.2"; 16 18 17 19 src = fetchFromGitHub { 18 20 owner = "lima-vm"; 19 - repo = pname; 21 + repo = "lima"; 20 22 rev = "v${version}"; 21 - sha256 = "sha256-XYB8Nxbs76xmiiZ7IYfgn+UgUr6CLOalQrl6Ibo+DRc="; 23 + hash = "sha256-LNsxMrbEgdosGDDUNvMZq/hpP5azNiIHjKTp0Iw/PC0="; 22 24 }; 23 25 24 - vendorHash = "sha256-nNSBwvhKSWs6to37+RLziYQqVOYfvjYib3fRRALACho="; 26 + vendorHash = "sha256-taozyQBJvkCsJAaOHg1gFK4qOnepRbzIn4jHzxfAn6A="; 25 27 26 - nativeBuildInputs = [ makeWrapper installShellFiles ] 27 - ++ lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ]; 28 + nativeBuildInputs = [ 29 + makeWrapper 30 + installShellFiles 31 + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ]; 28 32 29 33 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ]; 30 34 ··· 48 52 export LIMA_HOME="$(mktemp -d)" 49 53 ''; 50 54 51 - installPhase = '' 52 - runHook preInstall 53 - mkdir -p $out 54 - cp -r _output/* $out 55 - wrapProgram $out/bin/limactl \ 56 - --prefix PATH : ${lib.makeBinPath [ qemu ]} 57 - '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 58 - installShellCompletion --cmd limactl \ 59 - --bash <($out/bin/limactl completion bash) \ 60 - --fish <($out/bin/limactl completion fish) \ 61 - --zsh <($out/bin/limactl completion zsh) 62 - '' + '' 63 - runHook postInstall 64 - ''; 55 + installPhase = 56 + '' 57 + runHook preInstall 58 + mkdir -p $out 59 + cp -r _output/* $out 60 + wrapProgram $out/bin/limactl \ 61 + --prefix PATH : ${lib.makeBinPath [ qemu ]} 62 + '' 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) 68 + '' 69 + + '' 70 + runHook postInstall 71 + ''; 65 72 66 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. 67 76 installCheckPhase = '' 77 + if [[ "$(HOME="$(mktemp -d)" "$out/bin/limactl" --version | cut -d ' ' -f 3)" == "${version}" ]]; then 78 + echo '${pname} smoke check passed' 79 + else 80 + echo '${pname} smoke check failed' 81 + return 1 82 + fi 68 83 USER=nix $out/bin/limactl validate templates/default.yaml 69 84 ''; 70 85