Hilton Chain <hako@ultrarare.space> writes:

> Hilton Chain <hako@ultrarare.space> writes:
>
>>> 1. Too many configuration fields.  e.g. bluetooth-configuration
>>>   I don't think all the fields have at least one user. :) I remember the
>>>   experience of trying to find ‘auto-enable?’ from the documentation.  
>>> Keeping
>>>   track of upstream updates would be a pain, and it requires knowledge to 
>>> write
>>>   readable documentation for some fields.
>>>
>>>   If it's a port of the original configuration, why not supply an INI file
>>>   directly?  (extra-config)
>>>
>>>   If the point is to use Scheme, why not use an alist and serialize it to 
>>> INI?
>>>   (RDE, free-style configurations)
>> Instead of alist, I tried to use the current configuration interface,
>> but with service extensions exposed.  I'll see how to add serializers in
>> later and experiment with more services.
>
> Here's one example for serializers (the INI serializer is taken from RDE).
>
> Configuration interface:
> --8<---------------cut here---------------start------------->8---
> (service iwd-service-type
>   (iwd-configuration
>     (network-configuration? #f)
>     (control-port-over-nl80211? #f)
>     (address-randomization 'network)))
> --8<---------------cut here---------------end--------------->8---
>
> --8<---------------cut here---------------start------------->8---
> (service iwd-service-type
>   (iwd-configuration
>     (config
>      '((General
>         ((EnableNetworkConfiguration . #f)
>          (ControlPortOverNL80211 . #f)
>          (AddressRandomization . network)))))))
> --8<---------------cut here---------------end--------------->8---
> [...]

Clarifying the intention, the approach I propose is based on the current
configuration interface.  Sexps are used as the escape hatch, configuration
fields can then be lowered to sexps suitable for serializers and serialized to
configuration files.

By using sexps as the escape hatch, it's also possible to override
configurations fields, so that configurations that will be passed to serializers
can be fully written in sexps.

This way we can reduce configuration fields to actually used ones, reducing
possiblity of being affected by upstream changes and improving documentation
quality in general, since the writers know about the them.

Reply via email to