nixpkgs/pkgs/development/tools/turso-cli/default.nix
2024-04-20 10:46:30 +00:00

49 lines
1.2 KiB
Nix

{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
installShellFiles,
nix-update-script,
}:
buildGoModule rec {
pname = "turso-cli";
version = "0.92.0";
src = fetchFromGitHub {
owner = "tursodatabase";
repo = "turso-cli";
rev = "v${version}";
hash = "sha256-L118k+NOvO9jBqBzPkrx/U+RjgY318b1Q0u5X7uT7i0=";
};
vendorHash = "sha256-2NjdjB09WYzHjQEl2hMUWN1/xsj/Hlr8lVYU/pkxTqQ=";
nativeBuildInputs = [ installShellFiles ];
ldflags = [
"-X github.com/tursodatabase/turso-cli/internal/cmd.version=v${version}"
];
preCheck = ''
export HOME=$(mktemp -d)
'';
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd turso \
--bash <($out/bin/turso completion bash) \
--fish <($out/bin/turso completion fish) \
--zsh <($out/bin/turso completion zsh)
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "This is the command line interface (CLI) to Turso.";
homepage = "https://turso.tech";
mainProgram = "turso";
license = licenses.mit;
maintainers = with maintainers; [ zestsystem kashw2 fryuni ];
};
}