diff --git a/modules/lib/generators.nix b/modules/lib/generators.nix index 9cb0e1cf..eb556097 100644 --- a/modules/lib/generators.nix +++ b/modules/lib/generators.nix @@ -68,10 +68,8 @@ in "${name} ${concatStringsSep " " flatElements}"; # String -> ListOf Anything -> String - convertListOfNonFlatAttrsToKDL = name: list: '' - ${name} { - ${indentStrings (map (x: convertAttributeToKDL "-" x) list)} - }''; + convertListOfNonFlatAttrsToKDL = name: list: + "${concatStringsSep "\n" (map (x: convertAttributeToKDL name x) list)}"; # String -> ListOf Anything -> String convertListToKDL = name: list: diff --git a/tests/lib/generators/tokdl-result.txt b/tests/lib/generators/tokdl-result.txt index 6ad2af36..a314bddd 100644 --- a/tests/lib/generators/tokdl-result.txt +++ b/tests/lib/generators/tokdl-result.txt @@ -27,15 +27,11 @@ listInAttrsInList { } } list2 { - - { - a 8 - } + a 8 } } -nested { - - 1 2 - - true false - - - - null -} +repeated 1 2 +repeated true false +repeated +repeated null unsafeString " \" \n " diff --git a/tests/lib/generators/tokdl.nix b/tests/lib/generators/tokdl.nix index 6e4a4047..364a96c3 100644 --- a/tests/lib/generators/tokdl.nix +++ b/tests/lib/generators/tokdl.nix @@ -20,7 +20,7 @@ '' null ]; - nested = [ [ 1 2 ] [ true false ] [ ] [ null ] ]; + repeated = [ [ 1 2 ] [ true false ] [ ] [ null ] ]; extraAttrs = { _args = [ 2 true ]; _props = { @@ -33,12 +33,12 @@ }; }; listInAttrsInList = { - list1 = [ + list1."-" = [ { a = 1; } { b = true; } { c = null; - d = [{ e = "asdfadfasdfasdf"; }]; + d."-" = [{ e = "asdfadfasdfasdf"; }]; } ]; list2 = [{ a = 8; }];