Skip to content

Commit 778223b

Browse files
authored
globalping-cli: only build main package (#387793)
2 parents 88d0103 + 0662a9d commit 778223b

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

pkgs/by-name/gl/globalping-cli/package.nix

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, nix-update-script }:
1+
{
2+
lib,
3+
buildGoModule,
4+
fetchFromGitHub,
5+
stdenv,
6+
installShellFiles,
7+
nix-update-script,
8+
}:
29

310
buildGoModule rec {
411
pname = "globalping-cli";
@@ -16,7 +23,12 @@ buildGoModule rec {
1623
nativeBuildInputs = [ installShellFiles ];
1724

1825
env.CGO_ENABLED = 0;
19-
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
26+
subPackages = [ "." ];
27+
ldflags = [
28+
"-s"
29+
"-w"
30+
"-X main.version=${version}"
31+
];
2032

2133
preCheck = ''
2234
export HOME="$TMPDIR"
@@ -37,13 +49,16 @@ buildGoModule rec {
3749
in
3850
[ "-skip=^${builtins.concatStringsSep "|^" skippedTests}" ];
3951

40-
postInstall = ''
41-
mv $out/bin/${pname} $out/bin/globalping
42-
installShellCompletion --cmd globalping \
43-
--bash <($out/bin/globalping completion bash) \
44-
--fish <($out/bin/globalping completion fish) \
45-
--zsh <($out/bin/globalping completion zsh)
46-
'';
52+
postInstall =
53+
''
54+
mv $out/bin/globalping-cli $out/bin/globalping
55+
''
56+
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
57+
installShellCompletion --cmd globalping \
58+
--bash <($out/bin/globalping completion bash) \
59+
--fish <($out/bin/globalping completion fish) \
60+
--zsh <($out/bin/globalping completion zsh)
61+
'';
4762

4863
passthru.updateScript = nix-update-script { };
4964

0 commit comments

Comments
 (0)