On Mon, Jun 28 2021, Andrew Tropin wrote:
>> +(define (mpv-files-service config)>> + `(("config/mpv/mpv.conf">> + ,(mixed-text-file>> + "mpv-config">> I think more consistent naming will be "mpv-mpv.conf".> config/git/config -> "git-config"> config/sway/config -> "sway-config"> config/xmonad/xmonad.hs -> "xmonad-xmonad.hs"
Ah, that does make sense.
>> + (serialize-configuration>> + config (filter-configuration-fields>> + home-mpv-configuration-fields '(bindings) #t))))>> + ("config/mpv/input.conf">> + ,(mixed-text-file>> + "mpv-input-conf">> + (serialize-configuration>> + config (filter-configuration-fields>> + home-mpv-configuration-fields '(bindings)))))))>> +>> +(define (mpv-profile-service config)>> + (list (home-mpv-configuration-package config)))>> +>> +(define home-mpv-service-type>> + (service-type (name 'home-mpv)>> + (extensions>> + (list (service-extension>> + home-files-service-type>> + mpv-files-service)>> + (service-extension>> + home-profile-service-type>> + mpv-profile-service)))>> + (description "Install and configure Mpv")))>> +>> +(define (generate-home-mpv-documentation)>> I've not looked at the related source code deeply, but why we don't use> (map configuration->documentation '(home-mpv-configuration mpv-profile))> instead of:
By just using ‘configuration->documentation’ we cannot express the
hierachy (see the docs for ‘getmail-configuration’ to get a better
idea):
home-mpv-configuration
mpv-profile
everything gets displayed in a flat list like this:
home-mpv-configuration
mpv-profile
Since ‘mpv-profile’ is designed to used in the ‘profiles’ field of
‘home-mpv-configuration’, I think it makes sense to make it a
hierarchy. If there also was a ‘home-mpv-extension’ record or something
like that, it would make sense to put it at the same level as
‘home-mpv-configuration’.
home-mpv-configuration
mpv-profile
home-mpv-extension
> Thank you for the mpv service!) Applied.
You are welcome!
Xinglu Chen <public@yoctocell.xyz> writes:
> On Mon, Jun 28 2021, Andrew Tropin wrote:>>>> +(define (mpv-files-service config)>>> + `(("config/mpv/mpv.conf">>> + ,(mixed-text-file>>> + "mpv-config">>>> I think more consistent naming will be "mpv-mpv.conf".>> config/git/config -> "git-config">> config/sway/config -> "sway-config">> config/xmonad/xmonad.hs -> "xmonad-xmonad.hs">> Ah, that does make sense.>>>> + (serialize-configuration>>> + config (filter-configuration-fields>>> + home-mpv-configuration-fields '(bindings) #t))))>>> + ("config/mpv/input.conf">>> + ,(mixed-text-file>>> + "mpv-input-conf">>> + (serialize-configuration>>> + config (filter-configuration-fields>>> + home-mpv-configuration-fields '(bindings)))))))>>> +>>> +(define (mpv-profile-service config)>>> + (list (home-mpv-configuration-package config)))>>> +>>> +(define home-mpv-service-type>>> + (service-type (name 'home-mpv)>>> + (extensions>>> + (list (service-extension>>> + home-files-service-type>>> + mpv-files-service)>>> + (service-extension>>> + home-profile-service-type>>> + mpv-profile-service)))>>> + (description "Install and configure Mpv")))>>> +>>> +(define (generate-home-mpv-documentation)>>>> I've not looked at the related source code deeply, but why we don't use>> (map configuration->documentation '(home-mpv-configuration mpv-profile))>> instead of:>> By just using ‘configuration->documentation’ we cannot express the> hierachy (see the docs for ‘getmail-configuration’ to get a better> idea):>> home-mpv-configuration> mpv-profile>> everything gets displayed in a flat list like this:>> home-mpv-configuration> mpv-profile>> Since ‘mpv-profile’ is designed to used in the ‘profiles’ field of> ‘home-mpv-configuration’, I think it makes sense to make it a> hierarchy. If there also was a ‘home-mpv-extension’ record or something> like that, it would make sense to put it at the same level as> ‘home-mpv-configuration’.>> home-mpv-configuration> mpv-profile> home-mpv-extension>
I see, make sense. Just an idea: probably it's possible to make
configuration->documentation create hierarchy based on fields types.
One more question. Can we wrap (generate-documentation ...) into
(display), to make (generate-home-mpv-documentation) print a ready to
use documentation instead of string with a lots of \n inside?
>> Thank you for the mpv service!) Applied.>> You are welcome!
On Tue, Jun 29 2021, Andrew Tropin wrote:
>>> I've not looked at the related source code deeply, but why we don't use>>> (map configuration->documentation '(home-mpv-configuration mpv-profile))>>> instead of:>>>> By just using ‘configuration->documentation’ we cannot express the>> hierachy (see the docs for ‘getmail-configuration’ to get a better>> idea):>>>> home-mpv-configuration>> mpv-profile>>>> everything gets displayed in a flat list like this:>>>> home-mpv-configuration>> mpv-profile>>>> Since ‘mpv-profile’ is designed to used in the ‘profiles’ field of>> ‘home-mpv-configuration’, I think it makes sense to make it a>> hierarchy. If there also was a ‘home-mpv-extension’ record or something>> like that, it would make sense to put it at the same level as>> ‘home-mpv-configuration’.>>>> home-mpv-configuration>> mpv-profile>> home-mpv-extension>>>> I see, make sense. Just an idea: probably it's possible to make> configuration->documentation create hierarchy based on fields types.>> One more question. Can we wrap (generate-documentation ...) into> (display), to make (generate-home-mpv-documentation) print a ready to> use documentation instead of string with a lots of \n inside?
That would probably be a good idea. :)
Xinglu Chen <public@yoctocell.xyz> writes:
> On Tue, Jun 29 2021, Andrew Tropin wrote:>>>>> I've not looked at the related source code deeply, but why we don't use>>>> (map configuration->documentation '(home-mpv-configuration mpv-profile))>>>> instead of:>>>>>> By just using ‘configuration->documentation’ we cannot express the>>> hierachy (see the docs for ‘getmail-configuration’ to get a better>>> idea):>>>>>> home-mpv-configuration>>> mpv-profile>>>>>> everything gets displayed in a flat list like this:>>>>>> home-mpv-configuration>>> mpv-profile>>>>>> Since ‘mpv-profile’ is designed to used in the ‘profiles’ field of>>> ‘home-mpv-configuration’, I think it makes sense to make it a>>> hierarchy. If there also was a ‘home-mpv-extension’ record or something>>> like that, it would make sense to put it at the same level as>>> ‘home-mpv-configuration’.>>>>>> home-mpv-configuration>>> mpv-profile>>> home-mpv-extension>>>>>>> I see, make sense. Just an idea: probably it's possible to make>> configuration->documentation create hierarchy based on fields types.>>>> One more question. Can we wrap (generate-documentation ...) into>> (display), to make (generate-home-mpv-documentation) print a ready to>> use documentation instead of string with a lots of \n inside?>> That would probably be a good idea. :)
Cool, will add it a not to the manual, when will be writing "Declaring
new home-services" section.