move rust-jemalloc-sys to its own file

This commit is contained in:
Charles Hall 2024-10-24 14:51:16 -07:00
parent f07c8c2b6f
commit 2e6bf86a42
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
3 changed files with 18 additions and 12 deletions

View file

@ -32,6 +32,10 @@
default = prev.default.override args;
});
rust-jemalloc-sys = self.callPackage ./nix/pkgs/rust-jemalloc-sys {
inherit (pkgs) rust-jemalloc-sys;
};
shell = self.callPackage ./nix/shell.nix {};
# The Rust toolchain to use

View file

@ -34,20 +34,10 @@ let
featureEnabled = feature : builtins.elem feature features';
# This derivation will set the JEMALLOC_OVERRIDE variable, causing the
# tikv-jemalloc-sys crate to use the nixpkgs jemalloc instead of building it's
# own. In order for this to work, we need to set flags on the build that match
# whatever flags tikv-jemalloc-sys was going to use. These are dependent on
# which features we enable in tikv-jemalloc-sys.
rust-jemalloc-sys' = (rust-jemalloc-sys.override {
# tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms feature
unprefixed = true;
});
buildDepsOnlyEnv =
let
rocksdb' = rocksdb.override {
jemalloc = rust-jemalloc-sys';
jemalloc = rust-jemalloc-sys;
enableJemalloc = featureEnabled "jemalloc";
enableLiburing = false;
};
@ -92,7 +82,7 @@ let
dontStrip = profile == "dev";
buildInputs = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys';
buildInputs = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys;
nativeBuildInputs = [
# bindgen needs the build platform's libclang. Apparently due to "splicing

View file

@ -0,0 +1,12 @@
# This derivation will set the JEMALLOC_OVERRIDE variable, causing the
# tikv-jemalloc-sys crate to use the nixpkgs jemalloc instead of building it's
# own. In order for this to work, we need to set flags on the build that match
# whatever flags tikv-jemalloc-sys was going to use. These are dependent on
# which features we enable in tikv-jemalloc-sys.
{ rust-jemalloc-sys }:
rust-jemalloc-sys.override {
# tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms feature
unprefixed = true;
}