From 9b4dde7ebaa50349c2c3bd8d0f5dc0cc2a31d0ec Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 21 May 2026 16:04:12 -0400 Subject: [PATCH] lib.generators.toGitINI: move escape logic outside of hot loop --- lib/generators.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/generators.nix b/lib/generators.nix index 9361404a5a0e..b742797bb627 100644 --- a/lib/generators.nix +++ b/lib/generators.nix @@ -394,11 +394,10 @@ rec { ''${head sections} "${concatStringsSep "." (tail sections)}"''; mkValueString = - v: let - escapedV = ''"${replaceStrings [ "\n" " " ''"'' "\\" ] [ "\\n" "\\t" ''\"'' "\\\\" ] v}"''; + escape = replaceStrings [ "\n" " " ''"'' "\\" ] [ "\\n" "\\t" ''\"'' "\\\\" ]; in - mkValueStringDefault { } (if isString v then escapedV else v); + v: mkValueStringDefault { } (if isString v then ''"${escape v}"'' else v); # generation for multiple ini values mkKeyValue =