Subject: bug#51141: guix home reconfigure does not apply changes to shepherd services

From: Andrew Tropin <[email-masked]>
Date: Mon, 18 Oct 2021 13:04:24 +0300

On 2021-10-16 18:06, Oleg Pykhalov wrote:

> Hi Andrew,
>
> Andrew Tropin <[email-masked]> writes:
>
>> On 2021-10-12 01:53, Oleg Pykhalov wrote:
>>
>>> After changing a home shepherd service I tried to reconfigure with 'guix
>>> home reconfigure'.
>>>
>>> Process started by a service did not restart.  Assuming home shepherd is
>>> like Guix System shepherd I tried to 'herd restart SERVICE_NAME', the
>>> process restarted but without changes in a service definition.
>>
>> It's intentional, only `herd load root new-config.conf` called on
>> activation, so existing services are not affected to prevent situations,
>> where emacs daemon or other important process killed in the middle of
>> unsaved work.
>
> If I change something inside a system service definition
> SERVICE-shepherd-service and then invoke 'guix system reconfigure', the
> service will not restart and not produce any effect until I invoke 'sudo
> herd restart SERVICE'.
>
> After herd restart the service will be running with applied changes and
> does not require 'herd unload root SERVICE_NAME'.
> E.g. nginx-service-type.
>
> I think this behaviour should be the same for home services.  WDYT?

Yes, make sense.

According to what I see in the shepherd tests:
https://git.savannah.gnu.org/cgit/shepherd.git/tree/tests/replacement.sh?h=4c5176f5a7a5a1e7d7f258f585e8ed127a21b99a#n61

and how it's implemented in home-shepherd:
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/home/services/shepherd.scm?h=7c3f28fdc4edc00f66801cd51a5ba08eee44f77f#n59

It should work as you expect it.

Tried to do the following: I updated documentation field for a shepherd
service, reconfigured and it got loaded after I restarted a service.

--8<---------------cut here---------------start------------->8---
~ $ herd doc state
Init, update and maybe destroy state.
~ $ herd restart state
Service state has been stopped.
Service state has been started.
~ $ herd doc state
Really init, update and maybe destroy state.
--8<---------------cut here---------------end--------------->8---

Didn't check if start action gexp is updated too, but I expect it was.

-- 
Best regards,
Andrew Tropin