[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#50967] file-like objects instead of gexps
From: |
Ludovic Courtès |
Subject: |
[bug#50967] file-like objects instead of gexps |
Date: |
Fri, 08 Oct 2021 09:56:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
Hi Andrew,
Andrew Tropin <andrew@trop.in> skribis:
> On 2021-10-04 16:04, Ludovic Courtès wrote:
>
>> Xinglu Chen <public@yoctocell.xyz> skribis:
>>
>>> On Sat, Oct 02 2021, Oleg Pykhalov wrote:
>>>
>>>> * gnu/home/services/configuration.scm (interpose): Include content of
>>>> files.
>>>> (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for
>>>> file-like
>>>> object.
>>>
>>> I would call it ‘file-like-or-string-or-gexp?’, just ‘files’ doesn’t
>>> really make it clear that it should be a “file-like object”.
>>
>> As a matter of API, I would make it monomorphic: accept a file-like
>> object, period. This is what’s done for System services (and
>> polymorphic APIs are rare in general in Guix).
>
> At least some of system services are far from ideal, recently I tried to
> add rtmp section to nginx configuration using nginx system service.
I agree that nginx config is problematic:
https://issues.guix.gnu.org/37388
But IMO that’s off-topic. :-)
> Imagine the following use case: I want to create a home service, which
> accepts a package (zsh plugin) and adds a code for loading this package
> to zshrc, currently it's implemented like that:
>
> https://git.sr.ht/~abcdw/rde/tree/69dd2baf0384c899a4a4f97bdac8bf0b6e499b82/item/gnu/home-services/shellutils.scm#L18
>
> Exteding the service above with `(list zsh-autosuggestions)` will add
> the following line to zshrc:
>
> source
> /gnu/store/w7d43gk1qszplj9i0rkzqvzz6kp88qfm-zsh-autosuggestions-0.7.0/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
OK.
Then that’s fine: you can have special code that emits those “source”
lines in .zshrc while still allowing users to provide their own
file-like object for .zshrc lines they want to add. Again, see how
‘torrc’ is generated in ‘tor-service-type’.
I’m happy to discuss specific service examples in mode details if you
want. Overall, I’m confident Home services don’t require any pattern
that’s not already found in one of the many System services. :-)
HTH,
Ludo’.
- [bug#50967] [PATCH 09/14] gnu: home-services: Move mcron to (gnu home services)., (continued)
- [bug#50967] [PATCH 09/14] gnu: home-services: Move mcron to (gnu home services)., Oleg Pykhalov, 2021/10/02
- [bug#50967] [PATCH 10/14] scripts: home: (gnu home-services bash) -> (gnu home services bash)., Oleg Pykhalov, 2021/10/02
- [bug#50967] [PATCH 08/14] gnu: home-services: Move shepherd to (gnu home services)., Oleg Pykhalov, 2021/10/02
- [bug#50967] [PATCH 12/14] gnu: home-services: Update %service-type-path., Oleg Pykhalov, 2021/10/02
- [bug#50967] [PATCH 11/14] doc: (gnu home-services) -> (gnu home services)., Oleg Pykhalov, 2021/10/02
- [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects., Oleg Pykhalov, 2021/10/02
- [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects., Xinglu Chen, 2021/10/02
- [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ), Ludovic Courtès, 2021/10/04
- [bug#50967] file-like objects instead of gexps, Andrew Tropin, 2021/10/06
- [bug#50967] file-like objects instead of gexps,
Ludovic Courtès <=
- [bug#50967] file-like objects instead of gexps, Andrew Tropin, 2021/10/08
- [bug#50967] file-like objects instead of gexps, Ludovic Courtès, 2021/10/09
- [bug#50967] file-like objects instead of gexps, Andrew Tropin, 2021/10/14
- [bug#50967] file-like objects instead of gexps, Xinglu Chen, 2021/10/08
- [bug#50967] file-like objects instead of gexps, Andrew Tropin, 2021/10/08
- [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects., Andrew Tropin, 2021/10/08
- [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects., Andrew Tropin, 2021/10/14
[bug#50967] [PATCH 14/14] doc: Document guix home import., Oleg Pykhalov, 2021/10/02