1{
2 lib,
3 stdenv,
4 buildGo121Module,
5 fetchFromGitHub,
6 installShellFiles,
7 nix-update-script,
8}:
9buildGo121Module rec {
10 pname = "turso-cli";
11 version = "0.87.4";
12
13 src = fetchFromGitHub {
14 owner = "tursodatabase";
15 repo = "turso-cli";
16 rev = "v${version}";
17 hash = "sha256-e5HuDWMmikTlWC2ezZ5zxxKYFlgz9jrpHtNfIwSiiok=";
18 };
19
20 vendorHash = "sha256-EcWhpx93n+FzkXDOHwAxhn13qR4n9jLFeaKoe49x1x4=";
21
22 nativeBuildInputs = [ installShellFiles ];
23
24 ldflags = [
25 "-X github.com/tursodatabase/turso-cli/internal/cmd.version=v${version}"
26 ];
27
28 preCheck = ''
29 export HOME=$(mktemp -d)
30 '';
31
32 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
33 installShellCompletion --cmd turso \
34 --bash <($out/bin/turso completion bash) \
35 --fish <($out/bin/turso completion fish) \
36 --zsh <($out/bin/turso completion zsh)
37 '';
38
39 passthru.updateScript = nix-update-script { };
40
41 meta = with lib; {
42 description = "This is the command line interface (CLI) to Turso.";
43 homepage = "https://turso.tech";
44 mainProgram = "turso";
45 license = licenses.mit;
46 maintainers = with maintainers; [ zestsystem kashw2 fryuni ];
47 };
48}