From 711b9bd4c8307f67a32898cd788e58740acbcf1a Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sat, 16 Nov 2024 21:15:46 +0100 Subject: [PATCH] lima: fix cross Only try to generate shell completions if the executables can be run --- pkgs/applications/virtualization/lima/bin.nix | 4 ++-- pkgs/applications/virtualization/lima/default.nix | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/virtualization/lima/bin.nix b/pkgs/applications/virtualization/lima/bin.nix index ca45c58ff219..b0a90987d1d2 100644 --- a/pkgs/applications/virtualization/lima/bin.nix +++ b/pkgs/applications/virtualization/lima/bin.nix @@ -57,7 +57,7 @@ stdenvNoCC.mkDerivation { chmod +x $out/bin/limactl wrapProgram $out/bin/limactl \ --prefix PATH : ${lib.makeBinPath [ qemu ]} - + '' + lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) '' # the shell completion only works with a patched $out/bin/limactl and so # needs to run after the autoPatchelfHook is executed in postFixup. doShellCompletion() { @@ -67,7 +67,7 @@ stdenvNoCC.mkDerivation { --zsh <($out/bin/limactl completion zsh) } postFixupHooks+=(doShellCompletion) - + '' + '' runHook postInstall ''; diff --git a/pkgs/applications/virtualization/lima/default.nix b/pkgs/applications/virtualization/lima/default.nix index 0f9ffb1dbc54..9878b425329b 100644 --- a/pkgs/applications/virtualization/lima/default.nix +++ b/pkgs/applications/virtualization/lima/default.nix @@ -54,10 +54,12 @@ buildGoModule rec { 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 '';