mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
stalwart-mail: build against system jemalloc
This commit is contained in:
parent
8a5df70796
commit
0e8dd7e175
1 changed files with 20 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
|||
sqlite,
|
||||
foundationdb,
|
||||
zstd,
|
||||
rust-jemalloc-sys-unprefixed,
|
||||
stdenv,
|
||||
nix-update-script,
|
||||
nixosTests,
|
||||
|
@ -18,6 +19,9 @@
|
|||
stalwartEnterprise ? false,
|
||||
}:
|
||||
|
||||
let
|
||||
rocksdbJemalloc = rocksdb.override { enableJemalloc = true; };
|
||||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "stalwart-mail" + (lib.optionalString stalwartEnterprise "-enterprise");
|
||||
version = "0.11.8";
|
||||
|
@ -29,6 +33,17 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
hash = "sha256-VqGosbSQxNeOS+kGtvXAmz6vyz5mJlXvKZM57B1Xue4=";
|
||||
};
|
||||
|
||||
# rocksdb does not properly distinguish between pointers it has allocated itself
|
||||
# and pointers which were passed in and might be registered with a different
|
||||
# allocator, so we enable the unprefixed_malloc_on_supported_platforms to use
|
||||
# jemalloc implicitly in the entire process.
|
||||
postPatch = ''
|
||||
for file in crates/main/Cargo.toml tests/Cargo.toml; do
|
||||
substituteInPlace $file --replace-fail \
|
||||
'jemallocator = "0.5.0"' 'jemallocator = { version = "0.5.0", features = ["unprefixed_malloc_on_supported_platforms"] }'
|
||||
done
|
||||
'';
|
||||
|
||||
useFetchCargoVendor = true;
|
||||
cargoHash = "sha256-iheURWxO0cOvO+FV01l2Vmo0B+S2mXzue6mx3gapftQ=";
|
||||
|
||||
|
@ -43,6 +58,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
openssl
|
||||
sqlite
|
||||
zstd
|
||||
rust-jemalloc-sys-unprefixed
|
||||
rocksdbJemalloc
|
||||
] ++ lib.optionals (stdenv.hostPlatform.isLinux && withFoundationdb) [ foundationdb ];
|
||||
|
||||
# Issue: https://github.com/stalwartlabs/mail-server/issues/1104
|
||||
|
@ -63,8 +80,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
env = {
|
||||
OPENSSL_NO_VENDOR = true;
|
||||
ZSTD_SYS_USE_PKG_CONFIG = true;
|
||||
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
||||
ROCKSDB_INCLUDE_DIR = "${rocksdbJemalloc}/include";
|
||||
ROCKSDB_LIB_DIR = "${rocksdbJemalloc}/lib";
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
|
@ -151,7 +168,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
__darwinAllowLocalNetworking = true;
|
||||
|
||||
passthru = {
|
||||
inherit rocksdb; # make used rocksdb version available (e.g., for backup scripts)
|
||||
rocksdb = rocksdbJemalloc; # make used rocksdb version available (e.g., for backup scripts)
|
||||
webadmin = callPackage ./webadmin.nix { };
|
||||
updateScript = nix-update-script { };
|
||||
tests.stalwart-mail = nixosTests.stalwart-mail;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue