From cc2394d9fac9995ca0ee48c35c718a0b995c3d24 Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Sun, 7 Jun 2026 08:10:02 -0400 Subject: [PATCH] pkgs.formats.ini: share ignoredArgs between ini generators --- pkgs/pkgs-lib/formats.nix | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/pkgs/pkgs-lib/formats.nix b/pkgs/pkgs-lib/formats.nix index 2f3e5ad9d191..3d0f800873d2 100644 --- a/pkgs/pkgs-lib/formats.nix +++ b/pkgs/pkgs-lib/formats.nix @@ -256,6 +256,11 @@ optionalAttrs allowAliases aliases mapAttrs (key: val: if isList val then listToValue val else val) else id; + + ignoredArgs = [ + "listToValue" + "atomsCoercedToLists" + ]; in { ini = @@ -287,12 +292,7 @@ optionalAttrs allowAliases aliases name: value: pipe value [ (mapAttrs (_: maybeToList listToValue)) - (toINI ( - removeAttrs args [ - "listToValue" - "atomsCoercedToLists" - ] - )) + (toINI (removeAttrs args ignoredArgs)) (pkgs.writeText name) ]; }; @@ -341,15 +341,10 @@ optionalAttrs allowAliases aliases ... }: pkgs.writeText name ( - toINIWithGlobalSection - (removeAttrs args [ - "listToValue" - "atomsCoercedToLists" - ]) - { - globalSection = maybeToList listToValue globalSection; - sections = mapAttrs (_: maybeToList listToValue) sections; - } + toINIWithGlobalSection (removeAttrs args ignoredArgs) { + globalSection = maybeToList listToValue globalSection; + sections = mapAttrs (_: maybeToList listToValue) sections; + } ); };