about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/pscale
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/pscale')
-rw-r--r--nixpkgs/pkgs/development/tools/pscale/default.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/pscale/default.nix b/nixpkgs/pkgs/development/tools/pscale/default.nix
new file mode 100644
index 000000000000..5ef1453d8770
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/pscale/default.nix
@@ -0,0 +1,49 @@
+{ buildGoModule
+, fetchFromGitHub
+, installShellFiles
+, lib
+, pscale
+, testers
+}:
+
+buildGoModule rec {
+  pname = "pscale";
+  version = "0.154.0";
+
+  src = fetchFromGitHub {
+    owner = "planetscale";
+    repo = "cli";
+    rev = "v${version}";
+    sha256 = "sha256-TExrsxG+7K0QLuMmmIuNcmkFuU9jxbZsQSPxm1q+F0Q=";
+  };
+
+  vendorHash = "sha256-hj+uzb1mpFrbbZXozCP9166i0C5pwIKhEtJOxovBCZE=";
+
+  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 kashw2 ];
+  };
+}