Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchzip,
5 buildFHSEnv,
6}:
7
8let
9 version = "23.1.14";
10 pname = "cockroachdb";
11
12 # For several reasons building cockroach from source has become
13 # nearly impossible. See https://github.com/NixOS/nixpkgs/pull/152626
14 # Therefore we use the pre-build release binary and wrap it with buildFHSUserEnv to
15 # work on nix.
16 # You can generate the hashes with
17 # nix flake prefetch <url>
18 srcs = {
19 aarch64-linux = fetchzip {
20 url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-arm64.tgz";
21 hash = "sha256-cwczzmSKKQs/DN6WZ/FF6nJC82Pu47akeDqWdBMgdz0=";
22 };
23 x86_64-linux = fetchzip {
24 url = "https://binaries.cockroachdb.com/cockroach-v${version}.linux-amd64.tgz";
25 hash = "sha256-goCBE+zv9KArdoMsI48rlISurUM0bL/l1OEYWQKqzv0=";
26 };
27 };
28 src =
29 srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
30
31in
32buildFHSEnv {
33 inherit pname version;
34
35 runScript = "${src}/cockroach";
36
37 extraInstallCommands = ''
38 cp -P $out/bin/cockroachdb $out/bin/cockroach
39 '';
40
41 meta = with lib; {
42 homepage = "https://www.cockroachlabs.com";
43 description = "Scalable, survivable, strongly-consistent SQL database";
44 license = with licenses; [
45 bsl11
46 mit
47 cockroachdb-community-license
48 ];
49 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
50 platforms = [
51 "aarch64-linux"
52 "x86_64-linux"
53 ];
54 maintainers = with maintainers; [
55 rushmorem
56 thoughtpolice
57 ];
58 };
59}