Skip to content

Commit 9b8c09e

Browse files
authored
go-task: fix cross by only generating shell completions when possible (#372797)
2 parents 435a03e + 624d136 commit 9b8c09e

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

pkgs/by-name/go/go-task/package.nix

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
{ lib
2-
, buildGoModule
3-
, fetchFromGitHub
4-
, installShellFiles
5-
, testers
6-
, nix-update-script
7-
, go-task
1+
{
2+
lib,
3+
stdenv,
4+
buildGoModule,
5+
fetchFromGitHub,
6+
installShellFiles,
7+
testers,
8+
nix-update-script,
9+
go-task,
810
}:
911

1012
buildGoModule rec {
@@ -34,14 +36,16 @@ buildGoModule rec {
3436

3537
env.CGO_ENABLED = 0;
3638

37-
postInstall = ''
38-
ln -s $out/bin/task $out/bin/go-task
39-
40-
installShellCompletion --cmd task \
41-
--bash <($out/bin/task --completion bash) \
42-
--fish <($out/bin/task --completion fish) \
43-
--zsh <($out/bin/task --completion zsh)
44-
'';
39+
postInstall =
40+
''
41+
ln -s $out/bin/task $out/bin/go-task
42+
''
43+
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
44+
installShellCompletion --cmd task \
45+
--bash <($out/bin/task --completion bash) \
46+
--fish <($out/bin/task --completion fish) \
47+
--zsh <($out/bin/task --completion zsh)
48+
'';
4549

4650
passthru = {
4751
tests = {

0 commit comments

Comments
 (0)