From 9e60eab8f546a81feefe32d2ebf03420131f04e6 Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Thu, 30 May 2019 12:07:34 +0900 Subject: [PATCH] nixos/malloc: apply allocator settings to systemd units This uses systemd's system.conf/user.conf "DefaultEnvironment" feature to set the allocator's LD_PRELOAD near-globally. --- nixos/modules/config/malloc.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/config/malloc.nix b/nixos/modules/config/malloc.nix index bc51b9fc573..dfa86a44a32 100644 --- a/nixos/modules/config/malloc.nix +++ b/nixos/modules/config/malloc.nix @@ -91,5 +91,7 @@ in config = mkIf (cfg.provider != "libc") { environment.variables.LD_PRELOAD = providerLibPath; + systemd.extraConfig = "DefaultEnvironment=\"LD_PRELOAD=${providerLibPath}\""; + systemd.user.extraConfig = "DefaultEnvironment=\"LD_PRELOAD=${providerLibPath}\""; }; }