mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-19 22:30:23 +00:00
[Backport release-26.05] talosctl: Add withQemu parameter (#564654)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user