nixos/malloc: use ld preload

This is more robust than setting via environment variable, though it does come
later in the load sequence.  An added benefit is affecting the current
session.
This commit is contained in:
Joachim Fasting 2019-06-02 16:03:26 +02:00
parent 6a6d11565d
commit 44b6999614
No known key found for this signature in database
GPG Key ID: 5C204DF675C90294

View File

@ -79,19 +79,13 @@ in
and/or service failure.
</para>
</warning>
<note>
<para>
Changing this option does not affect the current session.
</para>
</note>
'';
};
};
config = mkIf (cfg.provider != "libc") {
environment.variables.LD_PRELOAD = providerLibPath;
systemd.extraConfig = "DefaultEnvironment=\"LD_PRELOAD=${providerLibPath}\"";
systemd.user.extraConfig = "DefaultEnvironment=\"LD_PRELOAD=${providerLibPath}\"";
environment.etc."ld-nix.so.preload".text = ''
${providerLibPath}
'';
};
}