mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 21:25:30 +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,
|
sqlite,
|
||||||
foundationdb,
|
foundationdb,
|
||||||
zstd,
|
zstd,
|
||||||
|
rust-jemalloc-sys-unprefixed,
|
||||||
stdenv,
|
stdenv,
|
||||||
nix-update-script,
|
nix-update-script,
|
||||||
nixosTests,
|
nixosTests,
|
||||||
|
@ -18,6 +19,9 @@
|
||||||
stalwartEnterprise ? false,
|
stalwartEnterprise ? false,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
rocksdbJemalloc = rocksdb.override { enableJemalloc = true; };
|
||||||
|
in
|
||||||
rustPlatform.buildRustPackage (finalAttrs: {
|
rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
pname = "stalwart-mail" + (lib.optionalString stalwartEnterprise "-enterprise");
|
pname = "stalwart-mail" + (lib.optionalString stalwartEnterprise "-enterprise");
|
||||||
version = "0.11.8";
|
version = "0.11.8";
|
||||||
|
@ -29,6 +33,17 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
hash = "sha256-VqGosbSQxNeOS+kGtvXAmz6vyz5mJlXvKZM57B1Xue4=";
|
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;
|
useFetchCargoVendor = true;
|
||||||
cargoHash = "sha256-iheURWxO0cOvO+FV01l2Vmo0B+S2mXzue6mx3gapftQ=";
|
cargoHash = "sha256-iheURWxO0cOvO+FV01l2Vmo0B+S2mXzue6mx3gapftQ=";
|
||||||
|
|
||||||
|
@ -43,6 +58,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
openssl
|
openssl
|
||||||
sqlite
|
sqlite
|
||||||
zstd
|
zstd
|
||||||
|
rust-jemalloc-sys-unprefixed
|
||||||
|
rocksdbJemalloc
|
||||||
] ++ lib.optionals (stdenv.hostPlatform.isLinux && withFoundationdb) [ foundationdb ];
|
] ++ lib.optionals (stdenv.hostPlatform.isLinux && withFoundationdb) [ foundationdb ];
|
||||||
|
|
||||||
# Issue: https://github.com/stalwartlabs/mail-server/issues/1104
|
# Issue: https://github.com/stalwartlabs/mail-server/issues/1104
|
||||||
|
@ -63,8 +80,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
env = {
|
env = {
|
||||||
OPENSSL_NO_VENDOR = true;
|
OPENSSL_NO_VENDOR = true;
|
||||||
ZSTD_SYS_USE_PKG_CONFIG = true;
|
ZSTD_SYS_USE_PKG_CONFIG = true;
|
||||||
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
|
ROCKSDB_INCLUDE_DIR = "${rocksdbJemalloc}/include";
|
||||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
ROCKSDB_LIB_DIR = "${rocksdbJemalloc}/lib";
|
||||||
};
|
};
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
@ -151,7 +168,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
__darwinAllowLocalNetworking = true;
|
__darwinAllowLocalNetworking = true;
|
||||||
|
|
||||||
passthru = {
|
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 { };
|
webadmin = callPackage ./webadmin.nix { };
|
||||||
updateScript = nix-update-script { };
|
updateScript = nix-update-script { };
|
||||||
tests.stalwart-mail = nixosTests.stalwart-mail;
|
tests.stalwart-mail = nixosTests.stalwart-mail;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue