nixos/matrix-synapse: allow preloading jemalloc

This is the default in the upstreams docker image and claims to reduce
memory fragmentation and usage.
This commit is contained in:
Martin Weinelt 2021-05-27 04:28:01 +02:00
parent 058b981b5b
commit 01f8f4f074
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759

View File

@ -143,6 +143,13 @@ in {
List of additional Matrix plugins to make available.
'';
};
withJemalloc = mkOption {
type = types.bool;
default = false;
description = ''
Whether to preload jemalloc to reduce memory fragmentation and overall usage.
'';
};
no_tls = mkOption {
type = types.bool;
default = false;
@ -720,7 +727,11 @@ in {
--keys-directory ${cfg.dataDir} \
--generate-keys
'';
environment.PYTHONPATH = makeSearchPathOutput "lib" cfg.package.python.sitePackages [ pluginsEnv ];
environment = {
PYTHONPATH = makeSearchPathOutput "lib" cfg.package.python.sitePackages [ pluginsEnv ];
} // optionalAttrs (cfg.withJemalloc) {
LD_PRELOAD = "${pkgs.jemalloc}/lib/libjemalloc.so";
};
serviceConfig = {
Type = "notify";
User = "matrix-synapse";