nixpkgs/pkgs/by-name/gl/globalping-cli/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

58 lines
1.5 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles, nix-update-script }:
buildGoModule rec {
pname = "globalping-cli";
version = "1.4.0";
src = fetchFromGitHub {
owner = "jsdelivr";
repo = pname;
rev = "v${version}";
hash = "sha256-MepnNbRX/smljiR9ysRWExFsfb7Qrz++7Y8S0Xn1Ax8=";
};
vendorHash = "sha256-V6DwV2KukFfFK0PK9MacoHH0sB5qNV315jn0T+4rhfA=";
nativeBuildInputs = [ installShellFiles ];
CGO_ENABLED = 0;
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
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}" ];
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";
};
}