Discussion: scfg generator semantics #7465
Replies: 3 comments
-
|
I am not familiar with scfg apart from what I did with pimsync. I would say this depends on what you want to achieve.I mean you could bypass the scfg generator for a quick merge or scope its usage to the final blocks. Ideally we want the generator to support all of the scfg specs: if the spec supports several blocks with the same name than choosing a top level dict is an error and it should be a list of for instance lib.nameValuePair ? |
Beta Was this translation helpful? Give feedback.
-
|
I really like the idea of using something like name value pairs, though maybe it would wise to have triplets (name, parameters, children to keep the naming from the specification repo) instead. |
Beta Was this translation helpful? Give feedback.
-
|
use whatever you think is best. I mentioned nameValuePair because it brought some familiarity and the value could have been a submodule. If |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
#4650 introduced a new generator,
toSCFGfor thescfgconfiguration file format. This generator seems to work for all requirementssenpaihas, but lacks some features. While trying to implement apimsyncmodule (see #6810), I encountered the need to have a more completescfggenerator. I am very unsure about how this generator should work, as thescfgformat e.g. doesn't care about duplicate keys.The following code samples show how the current generator works:
home-manager/tests/lib/generators/toscfg-example.nix
Lines 5 to 31 in 5f217e5
turns into
home-manager/tests/lib/generators/toscfg-example-result.txt
Lines 1 to 10 in 5f217e5
We encounter a problem if we even try to write a config like the sample config from the documentation, see also this comment of mine.
One approach I considered was to keep the current
_paramspattern as-is and add the possibility to use lists of attribute sets to achieve a nix representation of the example like this:I am very unsure whether this approach would work for every possible
scfg, and would appreciate a few other heads thinking this through. As far as I can tell this would not even need to break existingsenpaiconfigs.CC: @teto you said you'd review a
pimsyncPR. I haven't got that far yet, but would appreciate your feedback at this stage!Beta Was this translation helpful? Give feedback.
All reactions