{ lib, stdenv, autoPatchelfHook, fetchzip, }: stdenv.mkDerivation rec { pname = "cockroachdb-bin"; version = "23.1.9"; src = let inherit (stdenv.hostPlatform) system; selectSystem = attrs: attrs.${system} or (throw "Unsupported system: ${system}"); suffix = selectSystem { x86_64-linux = "linux-amd64"; aarch64-linux = "linux-arm64"; }; sha256 = selectSystem { x86_64-linux = "sha256-TopDCszdU73WiD/fsa/lq4h7jPUk0u50v3ELiuakzTU="; aarch64-linux = "sha256-uRW1g2IFAfQ6a1w7pz5GKklHmfaNgk70qj3hhm6KV6s="; }; in fetchzip { url = "https://binaries.cockroachdb.com/cockroach-v${version}.${suffix}.tgz"; inherit sha256; }; dontConfigure = true; dontBuild = true; dontStrip = stdenv.isDarwin; nativeBuildInputs = [autoPatchelfHook]; installPhase = '' runHook preInstall install -D cockroach $out/bin/cockroach runHook postInstall ''; meta = with lib; { homepage = "https://www.cockroachlabs.com"; description = "A scalable, survivable, strongly-consistent SQL database"; license = licenses.bsl11; mainProgram = "cockroach"; sourceProvenance = with sourceTypes; [binaryNativeCode]; platforms = ["x86_64-linux" "aarch64-linux"]; }; }