11 , enableJemalloc ? false, jemalloc
13 , enableShared ? !stdenv.hostPlatform.isStatic
16 stdenv.mkDerivation rec {
20 src = fetchFromGitHub {
24 sha256 = "sha256-Np3HPTZYzyoPOKL0xgsLzcvOkceFiEQd+1nyGbg4BHo=";
27 nativeBuildInputs = [ cmake ninja ];
29 propagatedBuildInputs = [ bzip2 lz4 snappy zlib zstd ];
31 buildInputs = lib.optional enableJemalloc jemalloc;
33 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=deprecated-copy -Wno-error=pessimizing-move"
34 + lib.optionalString stdenv.cc.isClang "-Wno-error=unused-private-field -faligned-allocation";
38 "-DWITH_JEMALLOC=${if enableJemalloc then "1" else "0"}"
40 "-DWITH_BENCHMARK_TOOLS=0"
50 "-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere
52 (stdenv.hostPlatform.isx86 && stdenv.hostPlatform.isLinux)
54 (lib.optional enableLite "-DROCKSDB_LITE=1")
55 "-DFAIL_ON_WARNINGS=${if stdenv.hostPlatform.isMinGW then "NO" else "YES"}"
56 ] ++ lib.optional (!enableShared) "-DROCKSDB_BUILD_SHARED=0";
58 # otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
59 hardeningDisable = lib.optional stdenv.hostPlatform.isWindows "format";
61 # Old version doesn't ship the .pc file, new version puts wrong paths in there.
63 if [ -f "$out"/lib/pkgconfig/rocksdb.pc ]; then
64 substituteInPlace "$out"/lib/pkgconfig/rocksdb.pc \
65 --replace '="''${prefix}//' '="/'
70 homepage = "https://rocksdb.org";
71 description = "A library that provides an embeddable, persistent key-value store for fast storage";
72 changelog = "https://github.com/facebook/rocksdb/raw/v${version}/HISTORY.md";
73 license = licenses.asl20;
74 platforms = platforms.all;
75 maintainers = with maintainers; [ adev magenbluten ];