1{
2 lib,
3 stdenv,
4 fetchurl,
5 which,
6 m4,
7 protobuf,
8 boost,
9 zlib,
10 curl,
11 openssl,
12 icu,
13 jemalloc,
14 libtool,
15 python3Packages,
16 makeWrapper,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "rethinkdb";
21 version = "2.4.4";
22
23 src = fetchurl {
24 url = "https://download.rethinkdb.com/repository/raw/dist/${pname}-${version}.tgz";
25 hash = "sha256-UJEjdgK2KDDbLLParKarNGMjI3QeZxDC8N5NhPRCcR8=";
26 };
27
28 postPatch = ''
29 substituteInPlace external/quickjs_*/Makefile \
30 --replace "gcc-ar" "${stdenv.cc.targetPrefix}ar" \
31 --replace "gcc" "${stdenv.cc.targetPrefix}cc"
32 '';
33
34 preConfigure = ''
35 export ALLOW_WARNINGS=1
36 patchShebangs .
37 '';
38
39 configureFlags = lib.optionals (!stdenv.hostPlatform.isDarwin) [
40 "--with-jemalloc"
41 "--lib-path=${jemalloc}/lib"
42 ];
43
44 makeFlags = [ "rethinkdb" ];
45
46 buildInputs = [
47 protobuf
48 boost
49 zlib
50 curl
51 openssl
52 icu
53 ]
54 ++ lib.optional (!stdenv.hostPlatform.isDarwin) jemalloc
55 ++ lib.optional stdenv.hostPlatform.isDarwin libtool;
56
57 nativeBuildInputs = [
58 which
59 m4
60 python3Packages.python
61 makeWrapper
62 ];
63
64 enableParallelBuilding = true;
65
66 postInstall = ''
67 wrapProgram $out/bin/rethinkdb \
68 --prefix PATH ":" "${python3Packages.rethinkdb}/bin"
69 '';
70
71 meta = {
72 description = "Open-source distributed database built with love";
73 mainProgram = "rethinkdb";
74 longDescription = ''
75 RethinkDB is built to store JSON documents, and scale to
76 multiple machines with very little effort. It has a pleasant
77 query language that supports really useful queries like table
78 joins and group by, and is easy to setup and learn.
79 '';
80 homepage = "https://rethinkdb.com";
81 license = lib.licenses.asl20;
82 platforms = lib.platforms.unix;
83 maintainers = with lib.maintainers; [
84 thoughtpolice
85 ];
86 };
87}