depot/third_party/nixpkgs/pkgs/development/tools/pscale/default.nix

50 lines
1.1 KiB
Nix
Raw Normal View History

{ buildGoModule
, fetchFromGitHub
, installShellFiles
, lib
, pscale
, testers
}:
buildGoModule rec {
pname = "pscale";
version = "0.130.0";
src = fetchFromGitHub {
owner = "planetscale";
repo = "cli";
rev = "v${version}";
sha256 = "sha256-rrrjIyIMoCshq348bUBGzMcwYhEZMt1OA/pOoE4PEY8=";
};
vendorHash = "sha256-shs05gXqLjp+L3t5f7oh0BV8YRPtcoCzrTlmx1tOvP0=";
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)
'';
passthru.tests.version = testers.testVersion {
package = pscale;
};
meta = with lib; {
description = "The CLI for PlanetScale Database";
changelog = "https://github.com/planetscale/cli/releases/tag/v${version}";
homepage = "https://www.planetscale.com/";
license = licenses.asl20;
maintainers = with maintainers; [ pimeys ];
};
}