GNU bug report logs - #76060
[PATCH] gnu: home: services: Add 'wayland-display' service.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Severity: wishlist; Reported by: Sisiutl <sisiutl@HIDDEN>; Keywords: patch; merged with #76057, #76058; dated Tue, 4 Feb 2025 21:45:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 76057 76058 76060. Request was from Ludovic Courtès <ludo@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 76060 <at> debbugs.gnu.org:


Received: (at 76060) by debbugs.gnu.org; 5 Feb 2025 21:48:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 05 16:48:22 2025
Received: from localhost ([127.0.0.1]:52967 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfnFu-0008WQ-Gv
	for submit <at> debbugs.gnu.org; Wed, 05 Feb 2025 16:48:22 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:33790)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ludo@HIDDEN>) id 1tfnFq-0008WC-Tr
 for 76060 <at> debbugs.gnu.org; Wed, 05 Feb 2025 16:48:20 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1tfnFi-0004Ex-Op; Wed, 05 Feb 2025 16:48:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=qZfjR0u14tyxFNNsK42LdWKHVZ6bUnzpk6K8BnrPvek=; b=Qwnxoj5d4rNyHNEFHtMe
 rioaeJaphtUO/muto8V1Lz7e+xOyYrbyLsk2p49mCepYb6L1SXCOzksgOMh40HE6+A03yt95fxtW6
 f/v4WweB0tVq05WHA8UGG+QyXEsO45ZGXmHwQJS3ZaQdJ8D0mZMBDW4j6J56l8mt57kwgij2fT59w
 ikwXurHWirawgsqVwtiee9uubFqe/Pqddarwj1FnkflOuXN8i3ykA7Rw7VRFGS0/smUsNVcuZtt5/
 sVrl2q9a2ZiI/ZU1Wi1JMQ29hiLvxqIUAM4w6ievTN2efxw/q8LldMrtWNN360C/CL5l4RJuCWGqs
 f5VzxRFlf31GVA==;
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Sisiutl <sisiutl@HIDDEN>
Subject: Re: [bug#76060] [PATCH] gnu: home: services: Add 'wayland-display'
 service.
In-Reply-To: <20250203124518.11531-1-sisiutl@HIDDEN>
 (sisiutl@HIDDEN's message of "Mon, 3 Feb 2025 13:45:13 +0100")
References: <20250203124518.11531-1-sisiutl@HIDDEN>
Date: Wed, 05 Feb 2025 22:48:07 +0100
Message-ID: <87h65883mw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 76060
Cc: 76060 <at> debbugs.gnu.org, Janneke Nieuwenhuizen <janneke@HIDDEN>,
 Tanguy Le Carrour <tanguy@HIDDEN>, Andrew Tropin <andrew@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

Hello,

(Cc=E2=80=99ing members of the Home team.)

Sisiutl <sisiutl@HIDDEN> skribis:

> * gnu/home/services/desktop.scm (wayland-shepherd-service): New procedure.
> (home-wayland-service-type): New variable.
>
> Change-Id: Ide1ca748551a280efe8286b4ac1e46787b108443

Nice improvement.

> -
> +
>  ;;;
>  ;;; Waiting for X11.

These ^L characters are page breaks, which are useful when navigating
through the file; please preserve them.

> +(define (wayland-shepherd-service config)

[...]

> +         (respawn? #t)
> +         (respawn-limit (home-wayland-configuration-tries config))
> +         (respawn-delay 1)

I believe =E2=80=98home-wayland-configuration-tries=E2=80=99 does not exist.

But I think you can remove these three lines because respawning only
applies to services that start a daemon, which is not the case here.

> +              (define (socket? directory regex)
> +                (find (match-lambda
> +                        ((or "." "..") #f)
> +                        (name
> +                         (let ((name (in-vicinity directory
> +                                                  name)))
> +                           (and (string-match regex name)
> +                                (access? name O_RDWR)))))
> +                      ;; Wayland names its sockets `wayland-n`. With
> +                      ;; `reverse`, we pick up on the last Wayland insta=
nce
> +                      ;; created (essentially what we always want to do).
> +                      (or (reverse (scandir directory)) '())))

I think =E2=80=98find-socket=E2=80=99 would be a better name than =E2=80=98=
socket?=E2=80=99.

Nitpick: prefer 'straight quotes' or =E2=80=98curly quotes=E2=80=99 in comm=
ents.

> +(define-public home-wayland-service-type

Please use plain =E2=80=98define=E2=80=99 and add to the export list at the=
 top.

> +  (service-type
> +   (name 'home-wayland-display)
> +   (extensions (list (service-extension home-shepherd-service-type
> +                                        wayland-shepherd-service)))
> +   (default-value 10)

I believe this value is unused.  Maybe set it to #f for clarity.

One last thing: could you add a note in =E2=80=98doc/guix.texi=E2=80=99 abo=
ut this
service, right after =E2=80=98home-x11-service-type=E2=80=99?

Thanks in advance!

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#76060; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Feb 2025 21:44:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 04 16:44:45 2025
Received: from localhost ([127.0.0.1]:46990 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tfQir-0003tR-4H
	for submit <at> debbugs.gnu.org; Tue, 04 Feb 2025 16:44:45 -0500
Received: from lists.gnu.org ([2001:470:142::17]:59516)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sisiutl@HIDDEN>)
 id 1tfQio-0003t9-6D
 for submit <at> debbugs.gnu.org; Tue, 04 Feb 2025 16:44:42 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sisiutl@HIDDEN>)
 id 1tfQii-0007KP-Bq
 for guix-patches@HIDDEN; Tue, 04 Feb 2025 16:44:36 -0500
Received: from 132.86.120.78.rev.sfr.net ([78.120.86.132]
 helo=fujo.egregore.fun) by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <sisiutl@HIDDEN>) id 1tfQig-0004yr-O8
 for guix-patches@HIDDEN; Tue, 04 Feb 2025 16:44:36 -0500
Received: from localhost (unknown [192.168.1.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1)
 server-digest SHA256) (No client certificate requested)
 (Authenticated sender: sisiutl@HIDDEN)
 by fujo.egregore.fun (Postfix) with ESMTPSA id CA7EE6D77A;
 Mon,  3 Feb 2025 13:45:25 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=egregore.fun;
 s=fujo; t=1738586725;
 bh=TerQRcPRUZEqe10jRat8NnYzOGfBYa2aaM5nc5h/P7E=;
 h=From:To:Cc:Subject:Date;
 b=pkAeA33pvjwJKGrvT5pz/nmuJyK8u1JLHC+2iD2+HIxukqZjC41E6cVc4q91kp6lS
 eb5mgKh1VhcvRRbwD8tKmrFzzPuiuATWzPSrYdVnvHM8snSlmGKiMvyT9VmDXSsd3U
 1vD3TYTmWRB9bxakIzpxXbxrEaMxuXGvTYjJ0ffc=
From: Sisiutl <sisiutl@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: home: services: Add 'wayland-display' service.
Date: Mon,  3 Feb 2025 13:45:13 +0100
Message-ID: <20250203124518.11531-1-sisiutl@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=78.120.86.132; envelope-from=sisiutl@HIDDEN;
 helo=fujo.egregore.fun
X-Spam_score_int: 56
X-Spam_score: 5.6
X-Spam_bar: +++++
X-Spam_report: (5.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499,
 FROM_SUSPICIOUS_NTLD_FP=1.999, PDS_OTHER_BAD_TLD=0.872, RCVD_IN_PBL=3.335,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 TVD_RCVD_IP=0.001 autolearn=no autolearn_force=no
X-Spam_action: reject
X-Spam-Score: 4.3 (++++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * gnu/home/services/desktop.scm (wayland-shepherd-service):
 New procedure. (home-wayland-service-type): New variable. Change-Id:
 Ide1ca748551a280efe8286b4ac1e46787b108443
 --- gnu/home/services/desktop.scm | 68 +++++++++++++++++++++++++++++++++--
 1 file changed, 66 insertions(+), 2 deletions(-) 
 Content analysis details:   (4.3 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 0.9 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: egregore.fun (fun)]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
 2.0 FROM_SUSPICIOUS_NTLD_FP From abused NTLD
 0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
X-Debbugs-Envelope-To: submit
Cc: Sisiutl <sisiutl@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * gnu/home/services/desktop.scm (wayland-shepherd-service):
    New procedure. (home-wayland-service-type): New variable. Change-Id: Ide1ca748551a280efe8286b4ac1e46787b108443
    --- gnu/home/services/desktop.scm | 68 +++++++++++++++++++++++++++++++++--
    1 file changed, 66 insertions(+), 2 deletions(-) 
 
 Content analysis details:   (1.3 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [2001:470:142:0:0:0:0:17 listed in]
                             [list.dnswl.org]
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
  0.9 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: egregore.fun (fun)]
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

* gnu/home/services/desktop.scm (wayland-shepherd-service): New procedure.
(home-wayland-service-type): New variable.

Change-Id: Ide1ca748551a280efe8286b4ac1e46787b108443
---
 gnu/home/services/desktop.scm | 68 +++++++++++++++++++++++++++++++++--
 1 file changed, 66 insertions(+), 2 deletions(-)

diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index fc96ce9295..34321409f7 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -48,7 +48,7 @@ (define-module (gnu home services desktop)
 
             home-startx-command-service-type))
 
-
+
 ;;;
 ;;; Waiting for X11.
 ;;;
@@ -121,7 +121,71 @@ (define home-x11-service-type
 during that time, the @code{x11-display} service is marked as failing to
 start.")))
 
-
+
+;;;
+;;; Waiting for Wayland.
+;;;
+
+(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 (home-wayland-configuration-tries config))
+         (respawn-delay 1)
+         (start
+          #~(lambda* (#:optional (env-wayland-display (getenv "WAYLAND_DISPLAY")))
+
+              (define wayland-socket-regex "wayland-[0-9]+$")
+
+              (define (socket? directory regex)
+                (find (match-lambda
+                        ((or "." "..") #f)
+                        (name
+                         (let ((name (in-vicinity directory
+                                                  name)))
+                           (and (string-match regex name)
+                                (access? name O_RDWR)))))
+                      ;; Wayland names its sockets `wayland-n`. With
+                      ;; `reverse`, we pick up on the last Wayland instance
+                      ;; created (essentially what we always want to do).
+                      (or (reverse (scandir directory)) '())))
+
+              (define wayland-display
+                (or env-wayland-display
+                    (socket? %user-runtime-dir "wayland-[0-9]+$")))
+
+              (when wayland-display
+                (format #t "Wayland display found at ~s.~%" wayland-display)
+                ;; Note: 'make-forkexec-constructor' calls take their
+                ;; default #:environment-variables value before this service
+                ;; is started and are thus unaffected by the 'setenv' call
+                ;; below.  Users of this service have to explicitly query
+                ;; its value.
+                (setenv "WAYLAND_DISPLAY" wayland-display))
+              wayland-display))
+         (stop #~(lambda (_)
+                   (unsetenv "WAYLAND_DISPLAY")
+                   #f)))))
+
+(define-public home-wayland-service-type
+  (service-type
+   (name 'home-wayland-display)
+   (extensions (list (service-extension home-shepherd-service-type
+                                        wayland-shepherd-service)))
+   (default-value 10)
+   (description
+    "Create a @code{wayland-display} Shepherd service that waits for a Wayland
+compositor to be up and running, up to a configurable delay, and sets the
+@code{WAYLAND_DISPLAY} environment variable of @command{shepherd} itself
+accordingly.  If no accessible Wayland server shows up during that time, the
+@code{wayland-display} service is marked as failing to start.")))
+
+
 ;;;
 ;;; Redshift.
 ;;;
-- 
2.48.1





Acknowledgement sent to Sisiutl <sisiutl@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#76060; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 16 Feb 2025 07:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.