lima: 1.0.1 -> 1.0.2 and add version test (#361378)
This commit is contained in:
@@ -1,30 +1,34 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, installShellFiles
|
||||
, qemu
|
||||
, sigtool
|
||||
, makeWrapper
|
||||
, nix-update-script
|
||||
, apple-sdk_15
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
qemu,
|
||||
sigtool,
|
||||
makeWrapper,
|
||||
nix-update-script,
|
||||
apple-sdk_15,
|
||||
lima,
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "lima";
|
||||
version = "1.0.1";
|
||||
version = "1.0.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "lima-vm";
|
||||
repo = pname;
|
||||
repo = "lima";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-XYB8Nxbs76xmiiZ7IYfgn+UgUr6CLOalQrl6Ibo+DRc=";
|
||||
hash = "sha256-LNsxMrbEgdosGDDUNvMZq/hpP5azNiIHjKTp0Iw/PC0=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-nNSBwvhKSWs6to37+RLziYQqVOYfvjYib3fRRALACho=";
|
||||
vendorHash = "sha256-taozyQBJvkCsJAaOHg1gFK4qOnepRbzIn4jHzxfAn6A=";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper installShellFiles ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ];
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
installShellFiles
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ sigtool ];
|
||||
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ];
|
||||
|
||||
@@ -48,23 +52,34 @@ buildGoModule rec {
|
||||
export LIMA_HOME="$(mktemp -d)"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r _output/* $out
|
||||
wrapProgram $out/bin/limactl \
|
||||
--prefix PATH : ${lib.makeBinPath [ qemu ]}
|
||||
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd limactl \
|
||||
--bash <($out/bin/limactl completion bash) \
|
||||
--fish <($out/bin/limactl completion fish) \
|
||||
--zsh <($out/bin/limactl completion zsh)
|
||||
'' + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r _output/* $out
|
||||
wrapProgram $out/bin/limactl \
|
||||
--prefix PATH : ${lib.makeBinPath [ qemu ]}
|
||||
''
|
||||
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd limactl \
|
||||
--bash <($out/bin/limactl completion bash) \
|
||||
--fish <($out/bin/limactl completion fish) \
|
||||
--zsh <($out/bin/limactl completion zsh)
|
||||
''
|
||||
+ ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
# Workaround for: "panic: $HOME is not defined" at https://github.com/lima-vm/lima/blob/v1.0.2/pkg/limayaml/defaults.go#L52
|
||||
# Don't use versionCheckHook for this package. It cannot inject environment variables.
|
||||
installCheckPhase = ''
|
||||
if [[ "$(HOME="$(mktemp -d)" "$out/bin/limactl" --version | cut -d ' ' -f 3)" == "${version}" ]]; then
|
||||
echo '${pname} smoke check passed'
|
||||
else
|
||||
echo '${pname} smoke check failed'
|
||||
return 1
|
||||
fi
|
||||
USER=nix $out/bin/limactl validate templates/default.yaml
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user