From dbb2c6724532b4f0b3611dcb8a75e78f20513a75 Mon Sep 17 00:00:00 2001 From: Mikael Voss Date: Fri, 11 Oct 2024 11:23:05 +0200 Subject: [PATCH] =?UTF-8?q?Pre=E2=80=90allocate=20hugepages=20for=20Firefo?= =?UTF-8?q?x,=20Thunderbird=20and=20mpv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- overlay/mimalloc.nix | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/overlay/mimalloc.nix b/overlay/mimalloc.nix index 34bcad2..bd5badd 100644 --- a/overlay/mimalloc.nix +++ b/overlay/mimalloc.nix @@ -15,9 +15,26 @@ in { secureBuild = true; }; - firefox = final.wrapFirefox final.firefox-unwrapped { }; - mpv = final.mpv-unwrapped.wrapper { mpv = final.mpv-unwrapped; }; - thunderbird = final.wrapThunderbird final.thunderbird-unwrapped { }; + firefox = (final.wrapFirefox final.firefox-unwrapped { }).overrideAttrs (prevAttrs: { + buildCommand = prevAttrs.buildCommand + '' + sed -i \ + '$i export MIMALLOC_RESERVE_HUGE_OS_PAGES=2' \ + "$out/bin/firefox" + ''; + }); + + thunderbird = (final.wrapThunderbird final.thunderbird-unwrapped { }).overrideAttrs (prevAttrs: { + buildCommand = prevAttrs.buildCommand + '' + sed -i \ + '$i export MIMALLOC_RESERVE_HUGE_OS_PAGES=2' \ + "$out/bin/thunderbird" + ''; + }); + + mpv = final.mpv-unwrapped.wrapper { + mpv = final.mpv-unwrapped; + extraMakeWrapperArgs = [ "--set" "MIMALLOC_RESERVE_HUGE_OS_PAGES=1" ]; + }; } // lib.genAttrs [ "bat" "bottom"