2023-06-30 09:36:17 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchzip
|
|
|
|
, buildFHSEnv
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2024-02-02 22:30:37 +01:00
|
|
|
version = "23.1.14";
|
2023-10-01 13:32:33 +02:00
|
|
|
pname = "cockroachdb";
|
2023-06-30 09:36:17 +02:00
|
|
|
|
|
|
|
# For several reasons building cockroach from source has become
|
2023-08-02 13:45:35 +02:00
|
|
|
# nearly impossible. See https://github.com/NixOS/nixpkgs/pull/152626
|
2023-06-30 09:36:17 +02:00
|
|
|
# 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>
|
2023-08-02 13:45:35 +02:00
|
|
|
srcs = {
|
|
|
|
aarch64-linux = fetchzip {
|
|
|
|
url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-arm64.tgz";
|
2024-02-02 22:30:37 +01:00
|
|
|
hash = "sha256-cwczzmSKKQs/DN6WZ/FF6nJC82Pu47akeDqWdBMgdz0=";
|
2023-08-02 13:45:35 +02:00
|
|
|
};
|
|
|
|
x86_64-linux = fetchzip {
|
2023-06-30 09:36:17 +02:00
|
|
|
url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-amd64.tgz";
|
2024-02-02 22:30:37 +01:00
|
|
|
hash = "sha256-goCBE+zv9KArdoMsI48rlISurUM0bL/l1OEYWQKqzv0=";
|
2023-06-30 09:36:17 +02:00
|
|
|
};
|
2023-08-02 13:45:35 +02:00
|
|
|
};
|
|
|
|
src = srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
2023-06-30 09:36:17 +02:00
|
|
|
|
|
|
|
in
|
|
|
|
buildFHSEnv {
|
2023-10-01 13:32:33 +02:00
|
|
|
inherit pname version;
|
2023-06-30 09:36:17 +02:00
|
|
|
|
|
|
|
runScript = "${src}/cockroach";
|
|
|
|
|
2023-11-27 10:19:10 +01:00
|
|
|
extraInstallCommands = ''
|
|
|
|
cp -P $out/bin/cockroachdb $out/bin/cockroach
|
|
|
|
'';
|
|
|
|
|
2023-06-30 09:36:17 +02:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.cockroachlabs.com";
|
|
|
|
description = "A scalable, survivable, strongly-consistent SQL database";
|
|
|
|
license = licenses.bsl11;
|
2023-08-02 13:45:35 +02:00
|
|
|
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
2023-06-30 09:36:17 +02:00
|
|
|
maintainers = with maintainers; [ rushmorem thoughtpolice neosimsim ];
|
|
|
|
};
|
|
|
|
}
|