Lately I've had an idea swimming around my head I'd like some feedback on.

Guix system and home configurations are written in scheme, and then string-append'd together and written to disk.

This makes guix the nonnegotiable boss of all configuration its involved in, and arbitrary scheme code cant realistically be edit by third party programs to update some config. and such configuration is only an option for so called "power users"

Therefore I thought, what if we wrote parsers for every config format under the sun, and then allowed ourselves to read, inherit, modify, and assert invariants about these config formats seemlessly as naturally as working with guix records. One could set a default value that is set if the value is empty or if there is no config file yet, but left alone if it differs. one could set all keys of a certain name to a certain value, or set values for things where its not clear where exactly it is in the file, it will be searched for in the tree structure of the config, once again without complicated recursion.

This allows for a healthy cooexistance with graphical programs that change there settings via their interface.

With this, administators could setup tailored configurations for workplaces, schools, libraries, which assert necessary config for use in that environment, whilst also allowing the user to freely change things. essential updates to defualt configurations can be reconfigured without having to inform the user to manually change things in settings

one could assert that only certain variables in the config need to be certain values, and the parses would preserve white space and comments so that users tracking config in git wouldn't see the file changing back and forth in pretty-printing style. guix would just leave it as is as much as possible.

one thing about guix records is that we try to define symbols for every possible key that can exist, but perhaps this is a bit rigid, and config specifications could be more data-like, allowing looser extension. or not.

I'd like the way of defining parsers to be as simple and composable as possible. ideally the grammar definition looks at first glance like the format its defining, not some complicated SICP looking code. similar config formats would reuse these patterns.

i had a look at guiles PEG and think its a good start, but it needs more in order to validate config, like check if a number is within a certain range.


Reply via email to