[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Contributing Guix Home services
From: |
Tanguy LE CARROUR |
Subject: |
Re: Contributing Guix Home services |
Date: |
Thu, 20 Apr 2023 17:28:52 +0200 |
User-agent: |
alot/0.10 |
Hi Ludo’,
Quoting Ludovic Courtès (2023-04-17 15:39:02)
> Tanguy LE CARROUR <tanguy@bioneland.org> skribis:
> > It's been quite a journey on my side! Ups. Downs. Mostly downs, though! 😅
> > Thanks to Simon's unconditional technical and moral support, a **LOT**
> > has changed since I sent this message. Hopefully for the better! 🤞
>
> Heh. :-) While it’s fresh on your mind, it would be nice to list the
> problems you ran into on your journey and see what we can do about it.
Mostly figuring out how to test it!
On my machine at home, `guix home reconfigure` can take minutes.
And some errors don't actually show up.
After trying different solutions, I eventually settled on the following:
while developing, I add, at the end of service file, something like:
```scheme
(define configuration
(home-service-configuration
; […]
)
(mixed-text-file
"test"
(serialize-configuration configuration home-service-configuration-fields))
```
And then I run:
```console
> cat (guix build -f path/to/home/service.scm)
# … the content of the generated file
```
I can only test file generation, though.
Then I painfully discovered that replacing in a string is not as easy as
it sounds, or, more precisely, that "python replace in string" yields
better results than "scheme replace in string" in DuckDuckGo!
I've also used `gexp` in places where I'm not sure it makes any sense,
but it works, so… #pragmatic!
> > At least now one of them [1] looks like a decent home service. Except
> > for the problem with `(every khal-calendar? lst)` that I haven't figure
> > out yet.
> >
> > [1]:
> > https://git.easter-eggs.org/bioneland/guix/-/blob/main/bioneland/home/services/khal.scm
> >
> >
> > The one for MSMTP [2] does not contain all the available options, but all
> > the configurations and serializers are there.
> >
> > [2]:
> > https://git.easter-eggs.org/bioneland/guix/-/blob/main/bioneland/home/services/msmtp.scm
>
> I don’t use these two programs, but the services look nice! The extra
> bit of work you’d have to do is documentation, similar to what is done
> for the other Home services. Maybe start with msmtp to get a feel of
> what that entails?
`(configuration->documentation 'home-msmtp-configuration)`
`(configuration->documentation 'msmtp-account)`
`(configuration->documentation 'msmtp-configuration)`
… *et voilà !*
> >> There’s no formal rule, but I think that what we’ve been doing so far is
> >> to ensure basic functionality of
> >> the service is covered, and to provide an “escape hatch” for bits of the
> >> configuration that are not covered.
> >
> > If by "escape hatch" you mean `extra-config`, you're right!
>
> Yup!
The convention seems to be `extra-content`, but you knew what I meant, right!? 😅
> > I'll try to submit a patch for one of the two mentioned above soon…ish!
>
> Excellent, thanks!
Done! <https://issues.guix.gnu.org/62969>
I could have done a **lot** more with the documentation, but I wanted to
be sure to get the basic right first.
--
Tanguy