{
buildGoModule,
fetchFromGitHub,
installShellFiles,
lib,
pscale,
testers,
}:
buildGoModule rec {
pname = "pscale";
version = "0.216.0";
src = fetchFromGitHub {
owner = "planetscale";
repo = "cli";
rev = "v${version}";
sha256 = "sha256-4fh8bLuwZgx104sfqraYMdlaqZHLnF7/aH2oU2G7Ej0=";
};
vendorHash = "sha256-0SRP995sOLM5FRRWXA/a+7D4v1c53P6VTFk4RSfmOfI=";
ldflags = [
"-s"
"-w"
"-X main.version=v${version}"
"-X main.commit=v${version}"
"-X main.date=unknown"
];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
installShellCompletion --cmd pscale \
--bash <($out/bin/pscale completion bash) \
--fish <($out/bin/pscale completion fish) \
--zsh <($out/bin/pscale completion zsh)
'';
__darwinAllowLocalNetworking = true;
passthru.tests.version = testers.testVersion {
package = pscale;
meta = with lib; {
description = "CLI for PlanetScale Database";
mainProgram = "pscale";
changelog = "https://github.com/planetscale/cli/releases/tag/v${version}";
homepage = "https://www.planetscale.com/";
license = licenses.asl20;
maintainers = with maintainers; [
pimeys
kashw2
}