nixpkgs/pkgs/tools/networking/globalping-cli/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

58 lines
1.5 KiB
Nix
Raw Normal View History

2023-07-30 11:39:31 -04:00
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, nix-update-script }:
buildGoModule rec {
pname = "globalping-cli";
2024-10-11 02:15:17 -04:00
version = "1.4.0";
2023-07-30 11:39:31 -04:00
src = fetchFromGitHub {
owner = "jsdelivr";
repo = pname;
rev = "v${version}";
2024-10-11 02:15:17 -04:00
hash = "sha256-MepnNbRX/smljiR9ysRWExFsfb7Qrz++7Y8S0Xn1Ax8=";
2023-07-30 11:39:31 -04:00
};
2024-06-20 20:14:19 -04:00
vendorHash = "sha256-V6DwV2KukFfFK0PK9MacoHH0sB5qNV315jn0T+4rhfA=";
2023-07-30 11:39:31 -04:00
nativeBuildInputs = [ installShellFiles ];
CGO_ENABLED = 0;
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
2024-10-11 02:15:17 -04:00
preCheck = ''
export HOME="$TMPDIR"
'';
checkFlags =
let
skippedTests = [
# Skip tests that require network access
"Test_Authorize"
"Test_TokenIntrospection"
"Test_Logout"
"Test_RevokeToken"
"Test_Limits"
"Test_CreateMeasurement"
"Test_GetMeasurement"
];
in
[ "-skip=^${builtins.concatStringsSep "|^" skippedTests}" ];
2023-07-30 11:39:31 -04:00
postInstall = ''
mv $out/bin/${pname} $out/bin/globalping
installShellCompletion --cmd globalping \
--bash <($out/bin/globalping completion bash) \
--fish <($out/bin/globalping completion fish) \
--zsh <($out/bin/globalping completion zsh)
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Simple CLI tool to run networking commands remotely from hundreds of globally distributed servers";
homepage = "https://www.jsdelivr.com/globalping/cli";
license = licenses.mpl20;
maintainers = with maintainers; [ xyenon ];
mainProgram = "globalping";
};
}