Subject: [bug#76619] [PATCH] gnu: home: services: Add 'wayland-display' service.

From: Hilton Chain <[email-masked]>
Date: Sun, 02 Mar 2025 13:10:15 +0800

Hi Sisiutl and Ludo,

I merged all wayland-display issues, please send follow-ups to
[email-masked] instead of [email-masked] next time :)

On Sat, 01 Mar 2025 06:02:07 +0800,
Ludovic Courtès wrote:
>
> Hello,
>
> Sisiutl <[email-masked]> skribis:
>
> > * gnu/home/services/desktop.scm (wayland-shepherd-service): New procedure.
> > (home-wayland-service-type): New variable.
> > * doc/guix.texi (Desktop Home Services): Document it.
> >
> > Change-Id: If1ed849d29198d2949c6852b0f2645e325211240
>
> Nice!  So this is a followup to <https://issues.guix.gnu.org/76060>.
>
>
> [...]
>
> > +(define (wayland-shepherd-service config)
> > +  (list (shepherd-service
> > +         (provision '(wayland-display))
> > +         (modules '((ice-9 ftw)
> > +                    (ice-9 regex)
> > +                    (ice-9 match)
> > +                    (srfi srfi-1)
> > +                    (shepherd support)))
> > +         (respawn? #t)
> > +         (respawn-limit config)
> > +         (respawn-delay 1)
>
> The default value for ‘config’ is 10, but that’s not a valid value for
> ‘respawn-limit’ (it should be a pair).
>
> But anyway, we should remove these two fields: they have no effect,
> except for services associated with a process.  We can also change
> ‘default-value’ to #f or so to not give the impression that it has a
> special meaning.
>
> Apart from that LGTM; let me know if you can make this change (and if it
> sounds right to you) or I can do it on your behalf.

Since some services may depend on either DISPLAY or WAYLAND_DISPLAY, and these
two services (x11-display, wayland-display) are similar, I think we can merge
them into one and deprecate home-x11-service-type by this new service.

e.g.
--8<---------------cut here---------------start------------->8---
service: home-display-service-type
configuration: x11? (boolean: #f) wayland? (boolean: #f) time-to-wait (integer: 10)
default-value #f
provision: 'x11-display when x11? is #t
           'wayland-display when walyand? is #t
           'display when either x11? or wayland? is #t
return value: "DISPLAY: unset; WAYLAND_DISPLAY: wayland-1"
--8<---------------cut here---------------end--------------->8---

Then one service can choose to depend on 'display or specifically 'x11-display /
'wayland-display.