biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / servers / nosql / dragonflydb / default.nix
blobe73f00164fe9cd114fc1e19907629ee65d21d676
1 { fetchFromGitHub
2 , fetchurl
3 , lib
4 , stdenv
5 , double-conversion
6 , gperftools
7 , mimalloc
8 , rapidjson
9 , liburing
10 , xxHash
11 , gbenchmark
12 , glog
13 , gtest
14 , jemalloc
15 , gcc-unwrapped
16 , autoconf
17 , autoconf-archive
18 , automake
19 , cmake
20 , ninja
21 , boost
22 , libunwind
23 , libtool
24 , openssl
27 let
28   pname = "dragonflydb";
29   version = "0.1.0";
31   src = fetchFromGitHub {
32     owner = pname;
33     repo = "dragonfly";
34     rev = "v${version}";
35     hash = "sha256-P6WMW/n+VezWDXGagT4B+ZYyCp8oufDV6MTrpKpLZcs=";
36     fetchSubmodules = true;
37   };
39   # Needed exactly 5.4.4 for patch to work
40   lua = fetchurl {
41     url = "https://github.com/lua/lua/archive/refs/tags/v5.4.4.tar.gz";
42     hash = "sha256-L/ibvqIqfIuRDWsAb1ukVZ7c9GiiVTfO35mI7ZD2tFA=";
43   };
45   # Needed exactly 20211102.0 for patch to work
46   abseil-cpp_202111 = fetchFromGitHub {
47     owner = "abseil";
48     repo = "abseil-cpp";
49     rev = "20211102.0";
50     sha256 = "sha256-sSXT6D4JSrk3dA7kVaxfKkzOMBpqXQb0WbMYWG+nGwk=";
51   };
53 stdenv.mkDerivation {
54   inherit pname version src;
56   postPatch = ''
57     mkdir -p ./build/{third_party,_deps}
58     ln -s ${double-conversion.src} ./build/third_party/dconv
59     ln -s ${mimalloc.src} ./build/third_party/mimalloc
60     ln -s ${rapidjson.src} ./build/third_party/rapidjson
61     ln -s ${gbenchmark.src} ./build/_deps/benchmark-src
62     ln -s ${gtest.src} ./build/_deps/gtest-src
63     cp -R --no-preserve=mode,ownership ${gperftools.src} ./build/third_party/gperf
64     cp -R --no-preserve=mode,ownership ${liburing.src} ./build/third_party/uring
65     cp -R --no-preserve=mode,ownership ${xxHash.src} ./build/third_party/xxhash
66     cp -R --no-preserve=mode,ownership ${abseil-cpp_202111} ./build/_deps/abseil_cpp-src
67     cp -R --no-preserve=mode,ownership ${glog.src} ./build/_deps/glog-src
68     chmod u+x ./build/third_party/uring/configure
69     cp ./build/third_party/xxhash/cli/xxhsum.{1,c} ./build/third_party/xxhash
70     patch -p1 -d ./build/_deps/glog-src < ${./glog.patch}
71     sed '
72     s@REPLACEJEMALLOCURL@file://${jemalloc.src}@
73     s@REPLACELUAURL@file://${lua}@
74     ' ${./fixes.patch} | patch -p1
75   '';
77   nativeBuildInputs = [
78     autoconf
79     autoconf-archive
80     automake
81     cmake
82     ninja
83   ];
85   buildInputs = [
86     boost
87     libunwind
88     libtool
89     openssl
90   ];
92   cmakeFlags = [
93     "-DCMAKE_AR=${gcc-unwrapped}/bin/gcc-ar"
94     "-DCMAKE_RANLIB=${gcc-unwrapped}/bin/gcc-ranlib"
95   ];
97   ninjaFlags = [ "dragonfly" ];
99   doCheck = false;
100   dontUseNinjaInstall = true;
102   installPhase = ''
103     runHook preInstall
104     mkdir -p $out/bin
105     cp ./dragonfly $out/bin
106     runHook postInstall
107   '';
109   meta = with lib; {
110     description = "A modern replacement for Redis and Memcached";
111     homepage = "https://dragonflydb.io/";
112     license = licenses.bsl11;
113     platforms = platforms.linux;
114     maintainers = with maintainers; [ yureien ];
115   };