1{
2 stdenv,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 lib,
7 pscale,
8 testers,
9}:
10
11buildGoModule rec {
12 pname = "pscale";
13 version = "0.248.0";
14
15 src = fetchFromGitHub {
16 owner = "planetscale";
17 repo = "cli";
18 rev = "v${version}";
19 sha256 = "sha256-Vp9qS8Od+OVV/kVMH8CsD/Ltx9aFykU7E8w+o91J2gY=";
20 };
21
22 vendorHash = "sha256-eGF44NEW8dIm2neJmGnYiafvRISIAUgA5jKV9EzsJj0=";
23
24 ldflags = [
25 "-s"
26 "-w"
27 "-X main.version=v${version}"
28 "-X main.commit=v${version}"
29 "-X main.date=unknown"
30 ];
31
32 nativeBuildInputs = [ installShellFiles ];
33
34 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
35 installShellCompletion --cmd pscale \
36 --bash <($out/bin/pscale completion bash) \
37 --fish <($out/bin/pscale completion fish) \
38 --zsh <($out/bin/pscale completion zsh)
39 '';
40
41 __darwinAllowLocalNetworking = true;
42
43 passthru.tests.version = testers.testVersion {
44 package = pscale;
45 };
46
47 meta = {
48 description = "CLI for PlanetScale Database";
49 mainProgram = "pscale";
50 changelog = "https://github.com/planetscale/cli/releases/tag/v${version}";
51 homepage = "https://www.planetscale.com/";
52 license = lib.licenses.asl20;
53 maintainers = with lib.maintainers; [
54 kashw2
55 ];
56 };
57}