2023-08-04 22:07:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchzip
|
|
|
|
, buildFHSEnv
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
version = "23.1.7";
|
2023-10-19 13:55:26 +00:00
|
|
|
pname = "cockroachdb";
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
# For several reasons building cockroach from source has become
|
|
|
|
# nearly impossible. See https://github.com/NixOS/nixpkgs/pull/152626
|
|
|
|
# Therefore we use the pre-build release binary and wrap it with buildFHSUserEnv to
|
|
|
|
# work on nix.
|
|
|
|
# You can generate the hashes with
|
|
|
|
# nix flake prefetch <url>
|
|
|
|
srcs = {
|
|
|
|
aarch64-linux = fetchzip {
|
|
|
|
url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-arm64.tgz";
|
|
|
|
hash = "sha256-73qJL3o328NckH6POXv+AUvlAJextb31Vs8NGdc8dwE=";
|
|
|
|
};
|
|
|
|
x86_64-linux = fetchzip {
|
|
|
|
url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-amd64.tgz";
|
|
|
|
hash = "sha256-FL/zDrl+QstBp54LE9/SbIfSPorneGZSef6dcOQJbSo=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
|
|
|
|
in
|
|
|
|
buildFHSEnv {
|
2023-10-19 13:55:26 +00:00
|
|
|
inherit pname version;
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
runScript = "${src}/cockroach";
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
extraInstallCommands = ''
|
|
|
|
cp -P $out/bin/cockroachdb $out/bin/cockroach
|
|
|
|
'';
|
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.cockroachlabs.com";
|
|
|
|
description = "A scalable, survivable, strongly-consistent SQL database";
|
|
|
|
license = licenses.bsl11;
|
|
|
|
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ rushmorem thoughtpolice neosimsim ];
|
|
|
|
};
|
|
|
|
}
|