assert that rocksdb versions match during eval

This commit is contained in:
Charles Hall 2024-10-24 15:20:04 -07:00
parent 9f4a1578aa
commit a550d8db1f
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -1,14 +1,39 @@
# Dependencies (keep sorted)
{ rocksdb
{ lib
, rocksdb
, rust-jemalloc-sys
# Options (keep sorted)
, enableJemalloc ? false
}:
rocksdb.override {
jemalloc = rust-jemalloc-sys;
let
rocksdb' = rocksdb.override {
jemalloc = rust-jemalloc-sys;
enableLiburing = false;
inherit enableJemalloc;
}
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"
])