make it easy to configure cargo features from nix
Users of the nix package can now just use `.override` to choose what features they want. This also makes RocksDB automatically use jemalloc when Conduit is configured to use jemalloc.
This commit is contained in:
parent
3336d3f812
commit
d796fe7cd3
1 changed files with 34 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Keep sorted
|
# Dependencies (keep sorted)
|
||||||
{ craneLib
|
{ craneLib
|
||||||
, inputs
|
, inputs
|
||||||
, lib
|
, lib
|
||||||
|
@ -6,13 +6,24 @@
|
||||||
, rocksdb
|
, rocksdb
|
||||||
, rust
|
, rust
|
||||||
, stdenv
|
, stdenv
|
||||||
|
|
||||||
|
# Options (keep sorted)
|
||||||
|
, default-features ? true
|
||||||
|
, features ? []
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
env = {
|
env =
|
||||||
CONDUIT_VERSION_EXTRA = inputs.self.shortRev or inputs.self.dirtyShortRev;
|
let
|
||||||
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
rocksdb' = rocksdb.override {
|
||||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
enableJemalloc = builtins.elem "jemalloc" features;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
CONDUIT_VERSION_EXTRA =
|
||||||
|
inputs.self.shortRev or inputs.self.dirtyShortRev;
|
||||||
|
ROCKSDB_INCLUDE_DIR = "${rocksdb'}/include";
|
||||||
|
ROCKSDB_LIB_DIR = "${rocksdb'}/lib";
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
(import ./cross-compilation-env.nix {
|
(import ./cross-compilation-env.nix {
|
||||||
|
@ -44,6 +55,14 @@ craneLib.buildPackage rec {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cargoExtraArgs = "--locked "
|
||||||
|
+ lib.optionalString
|
||||||
|
(!default-features)
|
||||||
|
"--no-default-features "
|
||||||
|
+ lib.optionalString
|
||||||
|
(features != [])
|
||||||
|
"--features " + (builtins.concatStringsSep "," features);
|
||||||
|
|
||||||
# This is redundant with CI
|
# This is redundant with CI
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue