Hi Gábor,

Gabor Barnabas Gero <[email protected]> skribis:

> (define-syntax preserve-variable
>     (syntax-rules ()
>         ((preserve-variable str)
>          (string-append str "=" (or (getenv str) "")))))
>
> (define emacsd-service
>   (simple-service 'emacs-daemon-service home-shepherd-service-type
>                                     (list (shepherd-service
>                                                  (provision '(emacs
> emacsd emacs-daemon))
>                                                  (respawn? #t)
>                                                  (respawn-limit 3)
>                                                  (start
> #~(make-forkexec-constructor
>    (list #$(file-append emacs-package "/bin/emacs") "--fg-daemon")
>    #:environment-variables (list
> (preserve-variable "WAYLAND_DISPLAY")
> (preserve-variable "DISPLAY")
> (preserve-variable "XAUTHORITY"))))
>                                                  (stop
> #~(make-kill-destructor))

I think the problem comes from this part of the Home config.

Here ‘preserve-variable’ is defined in the Home config itself, but it is
used in the code that ends up in ‘shepherd.conf’, inside the
g-expression introduced with #~.

In that ‘shepherd.conf’ file, ‘preserve-variable’ is *not* defined.
Thus, when shepherd evaluates it, it gets an unbound variable error for
‘preserve-variable’ (maybe this appears in
~/.local/state/shepherd/shepherd.log ?).

If the goal was to make the ‘emacsd’ service inherit ‘DISPLAY’ & co.,
the solution for now is to do something similar to what
‘home-redshift-service-type’ does.  Part of it is depending on
‘x11-display’, the other part is delaying the ‘getenv’ or ‘environ’ call
that will give ‘DISPLAY’.

HTH!

Ludo’.

Reply via email to