mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
stalwart-mail: build against system jemalloc [second try] (#411265)
This commit is contained in:
commit
24b70d6579
2 changed files with 37 additions and 3 deletions
|
@ -48,9 +48,20 @@ in
|
|||
session.auth.directory = "'in-memory'";
|
||||
storage.directory = "in-memory";
|
||||
|
||||
storage.data = "rocksdb";
|
||||
storage.fts = "rocksdb";
|
||||
storage.blob = "rocksdb";
|
||||
storage.lookup = "rocksdb";
|
||||
|
||||
session.rcpt.directory = "'in-memory'";
|
||||
queue.outbound.next-hop = "'local'";
|
||||
|
||||
store."rocksdb" = {
|
||||
type = "rocksdb";
|
||||
path = "/var/lib/stalwart-mail/data";
|
||||
compression = "lz4";
|
||||
};
|
||||
|
||||
directory."in-memory" = {
|
||||
type = "memory";
|
||||
principals = [
|
||||
|
@ -116,6 +127,12 @@ in
|
|||
main.wait_for_open_port(143)
|
||||
|
||||
main.succeed("test-smtp-submission")
|
||||
|
||||
# restart stalwart to test rocksdb compaction of existing database
|
||||
main.succeed("systemctl restart stalwart-mail.service")
|
||||
main.wait_for_open_port(587)
|
||||
main.wait_for_open_port(143)
|
||||
|
||||
main.succeed("test-imap-read")
|
||||
'';
|
||||
|
||||
|
|
|
@ -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