[Backport release-26.05] talosctl: Add withQemu parameter (#564654)

This commit is contained in:
nixpkgs-ci[bot]
2026-09-19 07:43:12 +00:00
committed by GitHub

View File

@@ -4,7 +4,10 @@
buildGoModule,
fetchFromGitHub,
installShellFiles,
makeWrapper,
versionCheckHook,
withQemu ? false,
qemu,
}:
buildGoModule (finalAttrs: {
@@ -20,6 +23,11 @@ buildGoModule (finalAttrs: {
vendorHash = "sha256-8v4xJT4HfE3tTFPPxXeqKMHNE/kKUVGE73flW17zXKM=";
postPatch = lib.optionalString withQemu ''
substituteInPlace pkg/provision/providers/qemu/arch.go \
--replace-fail '/opt/homebrew' '${lib.getLib qemu}'
'';
ldflags = [
"-s"
"-w"
@@ -33,14 +41,19 @@ buildGoModule (finalAttrs: {
subPackages = [ "cmd/talosctl" ];
nativeBuildInputs = [ installShellFiles ];
nativeBuildInputs = [ installShellFiles ] ++ lib.optionals withQemu [ makeWrapper ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd talosctl \
--bash <($out/bin/talosctl completion bash) \
--fish <($out/bin/talosctl completion fish) \
--zsh <($out/bin/talosctl completion zsh)
'';
postInstall =
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd talosctl \
--bash <($out/bin/talosctl completion bash) \
--fish <($out/bin/talosctl completion fish) \
--zsh <($out/bin/talosctl completion zsh)
''
+ lib.optionalString withQemu ''
wrapProgram $out/bin/talosctl \
--suffix PATH : ${lib.makeBinPath [ qemu ]}
'';
doCheck = false; # no tests