From 624d136b93b854c8b0251907fc96618d00b7c1b5 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sat, 11 Jan 2025 01:22:18 +0100 Subject: [PATCH] go-task: only generate shell completions when possible --- pkgs/by-name/go/go-task/package.nix | 34 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/pkgs/by-name/go/go-task/package.nix b/pkgs/by-name/go/go-task/package.nix index 8639df064de2..662ab8d64db9 100644 --- a/pkgs/by-name/go/go-task/package.nix +++ b/pkgs/by-name/go/go-task/package.nix @@ -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 = {