Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / jemalloc / rust.nix
blob1a9968933b1e9982845c1d19f9300162cfb29d3e
1 { lib
2 , stdenv
3 , jemalloc
4 , writeText
6 , unprefixed ? false
7 }:
9 let
10   # On some platforms the unprefixed feature will be ignored:
11   # https://github.com/tikv/jemallocator/blob/ab0676d77e81268cd09b059260c75b38dbef2d51/jemalloc-sys/src/env.rs
12   unprefixed' = unprefixed && !stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isAndroid;
14 in jemalloc.overrideAttrs (oldAttrs: {
15   configureFlags = oldAttrs.configureFlags ++ [
16     "--with-private-namespace=_rjem_"
17   ] ++ lib.optionals (!unprefixed') [
18     "--with-jemalloc-prefix=_rjem_"
19   ];
21   setupHook = writeText "setup-hook.sh" ''
22     export JEMALLOC_OVERRIDE="@out@/lib/libjemalloc${stdenv.hostPlatform.extensions.library}"
23   '';