go-task: fix cross by only generating shell completions when possible (#372797)

This commit is contained in:
Colin
2025-01-14 02:49:33 +00:00
committed by GitHub
+19 -15
View File
@@ -1,10 +1,12 @@
{ lib
, buildGoModule
, fetchFromGitHub
, installShellFiles
, testers
, nix-update-script
, go-task
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
testers,
nix-update-script,
go-task,
}:
buildGoModule rec {
@@ -34,14 +36,16 @@ buildGoModule rec {
env.CGO_ENABLED = 0;
postInstall = ''
ln -s $out/bin/task $out/bin/go-task
installShellCompletion --cmd task \
--bash <($out/bin/task --completion bash) \
--fish <($out/bin/task --completion fish) \
--zsh <($out/bin/task --completion zsh)
'';
postInstall =
''
ln -s $out/bin/task $out/bin/go-task
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd task \
--bash <($out/bin/task --completion bash) \
--fish <($out/bin/task --completion fish) \
--zsh <($out/bin/task --completion zsh)
'';
passthru = {
tests = {