1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-03 07:31:03 +01:00
home-manager/tests/lib/generators/tokdl.nix
Quentin Smith ea24675e4f
lib: Improve KDL generator (#7429)
This adds support for generating ordered children and nodes with
attributes and/or properties but no children. These are both needed to
generate zellij keybinding configuration.
2025-07-12 14:32:14 -05:00

86 lines
1.3 KiB
Nix

{ lib, ... }:
{
home.file."tokdl-result.txt".text = lib.hm.generators.toKDL { } {
a = 1;
b = "string";
c = ''
multiline string
with special characters:
\t \n \" "
'';
unsafeString = " \" \n ";
flatItems = [
1
2
"asdf"
true
null
];
bigFlatItems = [
23847590283751
1.239
''
multiline " " "
string
''
null
];
nested = [
[
1
2
]
[
true
false
]
[ ]
[ null ]
];
duplicateChildren._children = [
{ child = [ 2 ]; }
{ child = [ 1 ]; }
];
extraAttrs = {
_args = [
2
true
];
_props = {
arg1 = 1;
arg2 = false;
};
nested = {
a = 1;
b = null;
};
};
argsAndProps = {
_args = [
1
2
];
_props = {
a = 3;
};
};
listInAttrsInList = {
list1 = [
{ a = 1; }
{ b = true; }
{
c = null;
d = [ { e = "asdfadfasdfasdf"; } ];
}
];
list2 = [ { a = 8; } ];
};
};
nmt.script = ''
assertFileContent \
home-files/tokdl-result.txt \
${./tokdl-result.txt}
'';
}