On 2024-04-12 22:38, Ludovic Courtès wrote: > Hi Nicolas, > > Nicolas Graves skribis: > >> As promised to Stefan a few months ago, here's a use case of >> Shepherd/Emacs implementation that we developped in RDE. > > Would be nice to have it in Guix Home!
I am commited to merge RDE contributions upstream when this is possible, I will when it's mature enough / adapted for Guix ;) > >> We're using the --daemon option on the Shepherd side to launch the >> server in the background, include code in Emacs configuration to make it >> create a pid-file as soon as the server has started, and redefine >> kill-emacs to be managed by the Shepherd. > > Emacs supports systemd-style socket activation so, instead of using a > PID file, you could use ‘make-systemd-constructor’. > > Now, that code in emacs.c is unfortunately implemented via libsystemd > and thus disabled in Guix. Using libsystemd in this case is unnecessary > (and increases the attack surface, as we’ve seen with the xz backdoor): > it could read the ‘LISTEN_FDS’ and ‘LISTEN_PID’ environment variables > instead of calling the sd_* functions. > > https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html > > https://www.gnu.org/software/shepherd/manual/html_node/Service-De_002d-and-Constructors.html#index-make_002dsystemd_002dconstructor Thanks Ludo, that is precisely the feedback I was looking for. Maybe some feedback on the Emacs side about this? There are indeed very few places where systemd sd_* functions are called in emacs.c, should we try and re-implement them instead of using the library as is? Would that be a contribution Emacs devs would be interested in? That would definitely be beneficial for Emacs on Guix as highlighted by Ludo'. > > Thanks, > Ludo’. -- Best regards, Nicolas Graves