mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
39 lines
882 B
Nix
39 lines
882 B
Nix
# Dependencies (keep sorted)
|
|
{ lib
|
|
, rocksdb
|
|
, rust-jemalloc-sys
|
|
|
|
# Options (keep sorted)
|
|
, enableJemalloc ? false
|
|
}:
|
|
|
|
let
|
|
rocksdb' = rocksdb.override {
|
|
jemalloc = rust-jemalloc-sys;
|
|
|
|
enableLiburing = false;
|
|
inherit enableJemalloc;
|
|
};
|
|
|
|
cVersion = rocksdb'.version;
|
|
|
|
rustVersion = builtins.elemAt
|
|
(lib.splitString
|
|
"+"
|
|
(lib.findSingle
|
|
(x: x.name == "rust-librocksdb-sys")
|
|
(builtins.throw "Multiple rust-librocksdb-sys versions in Cargo.lock")
|
|
(builtins.throw "No rust-librocksdb-sys versions in Cargo.lock")
|
|
(builtins.fromTOML (builtins.readFile ../../../Cargo.lock)).package
|
|
).version
|
|
)
|
|
1;
|
|
in
|
|
|
|
if cVersion == rustVersion
|
|
then rocksdb'
|
|
else builtins.throw
|
|
(builtins.concatStringsSep " " [
|
|
"C version (${cVersion}) and Rust version (${rustVersion}) of RocksDB do"
|
|
"not match"
|
|
])
|