1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 04:23:34 +02:00
home-manager/tests/lib/generators/tokdl-result.txt
Josh Robson Chase 7c8bf29df3 generators.toKDL: support repeated nodes, break JiK compat
Replaces the list attr -> KDL conversion logic with a more flexible approach,
allowing for multiple nodes with the same name in a scope. This unfortunately
also breaks the existing JSON-in-KDL semantics in favor of ergonomics. As far
as I can tell though, zellij is the only program using it, and it doesn't accept
JiK anyway.

For example, the following KDL was previously impossible to generate, since nix
attrs were mapped 1:1 to KDL nodes:
```
resize {
	bind "k" "Up" { Resize "Increase Up"; }
	bind "j" "Down" { Resize "Increase Down"; }
}
```

Now, this can be achieved with the nix expression:

```
resize.bind = [
	{ _args = ["k" "Up"]; Resize = "Increase Up"; }
	{ _args = ["j" "Down"]; Resize = "Increase Down"; }
];
```

which would previously have generated the not-very-useful:

```
resize {
	bind {
		- "k" "Up" { Resize "Increase Up"; }
		- "j" "Down" { Resize "Increase Down"; }
	}
}
```

which, in turn, can now be generated via:

```
resize.bind."-" = [
	{ _args = ["k" "Up"]; Resize = "Increase Up"; }
	{ _args = ["j" "Down"]; Resize = "Increase Down"; }
];
```
2024-04-15 08:42:12 -04:00

38 lines
492 B
Plaintext

a 1
b "string"
bigFlatItems 23847590283751 1.239000 "multiline \" \" \"\nstring\n" null
c "multiline string\nwith special characters:\n\t \n \\" \"\n"
extraAttrs 2 true arg1=1 arg2=false {
nested {
a 1
b null
}
}
flatItems 1 2 "asdf" true null
listInAttrsInList {
list1 {
- {
a 1
}
- {
b true
}
- {
c null
d {
- {
e "asdfadfasdfasdf"
}
}
}
}
list2 {
a 8
}
}
repeated 1 2
repeated true false
repeated
repeated null
unsafeString " \" \n "