From 6b199865d3b7ff72fa5ab8701679b005df6e84a5 Mon Sep 17 00:00:00 2001 From: "Simen A. W. Olsen" Date: Mon, 14 Sep 2026 21:26:34 +0200 Subject: feat(darwin): package the turso.tech cloud CLI nixpkgs' `turso` is the database engine (tursodb), not the cloud CLI, and upstream only ships the CLI via a Homebrew tap whose sqld dependency tap is broken. Unpack the same GoReleaser tarball instead. --- modules/darwin/default.nix | 2 ++ pkgs/turso-cli.nix | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 pkgs/turso-cli.nix diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index 90f9ab2..dd98a39 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -111,7 +111,9 @@ act # Databases and database tools + # turso: the database engine (tursodb). turso-cli: the turso.tech cloud CLI. turso + (pkgs.callPackage ../../pkgs/turso-cli.nix { }) libpq sqlc diff --git a/pkgs/turso-cli.nix b/pkgs/turso-cli.nix new file mode 100644 index 0000000..2eef835 --- /dev/null +++ b/pkgs/turso-cli.nix @@ -0,0 +1,68 @@ +# The turso.tech cloud CLI. Not in nixpkgs — nixpkgs' `turso` is the database +# engine (the `tursodb` shell). Upstream ships it via a Homebrew tap whose +# `sqld` dependency tap is broken, so this unpacks the same GoReleaser tarball. +{ + lib, + stdenvNoCC, + fetchurl, + installShellFiles, +}: + +let + version = "1.0.32"; + + sources = { + aarch64-darwin = { + suffix = "Darwin_arm64"; + hash = "sha256-nwIrfTOYZJZfPCDQk8cZEKTk7tidvEr/paSSLizSRUQ="; + }; + x86_64-darwin = { + suffix = "Darwin_x86_64"; + hash = "sha256-9Mk0ZKFR9QQ/gE5SDoD4PDF/t7kQZWnLk39eaKpMiHw="; + }; + aarch64-linux = { + suffix = "Linux_arm64"; + hash = "sha256-kmipCZ4lTlyHMIKL8FDVf9/2Zhg8i/SeJuhuy5CrMXI="; + }; + x86_64-linux = { + suffix = "Linux_x86_64"; + hash = "sha256-MU1Ocqez2Ltv2yEiyfz0I6AKVsVm4UDeAognbG7UNbI="; + }; + }; + + source = + sources.${stdenvNoCC.hostPlatform.system} + or (throw "turso-cli: unsupported platform ${stdenvNoCC.hostPlatform.system}"); +in +stdenvNoCC.mkDerivation { + pname = "turso-cli"; + inherit version; + + src = fetchurl { + url = "https://github.com/tursodatabase/homebrew-tap/releases/download/v${version}/homebrew-tap_${source.suffix}.tar.gz"; + inherit (source) hash; + }; + + sourceRoot = "."; + + nativeBuildInputs = [ installShellFiles ]; + + installPhase = '' + runHook preInstall + install -Dm755 turso $out/bin/turso + installShellCompletion \ + --bash completions/turso.bash \ + --zsh completions/turso.zsh \ + --fish completions/turso.fish + runHook postInstall + ''; + + meta = { + description = "CLI for managing Turso databases in the cloud"; + homepage = "https://github.com/tursodatabase/turso-cli"; + license = lib.licenses.mit; + mainProgram = "turso"; + platforms = lib.attrNames sources; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +} -- cgit v1.3.1