From 44b6999614477ef66684267b4473d8253d3c2f76 Mon Sep 17 00:00:00 2001 From: Joachim Fasting Date: Sun, 2 Jun 2019 16:03:26 +0200 Subject: [PATCH] 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. --- nixos/modules/config/malloc.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/nixos/modules/config/malloc.nix b/nixos/modules/config/malloc.nix index dfa86a44a3260..65130454735c7 100644 --- a/nixos/modules/config/malloc.nix +++ b/nixos/modules/config/malloc.nix @@ -79,19 +79,13 @@ in and/or service failure. - - - - Changing this option does not affect the current session. - - ''; }; }; 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} + ''; }; }