GNU logs - #76659, boring messages


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#76659] [PATCH] gnu: home: services: Add 'wayland-display' service.
Resent-From: Sisiutl <sisiutl@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sat, 01 Mar 2025 14:03:03 +0000
Resent-Message-ID: <handler.76659.B.174083777811112 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 76659
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 76659 <at> debbugs.gnu.org
Cc: Sisiutl <sisiutl@HIDDEN>
X-Debbugs-Original-To: guix-patches@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.174083777811112
          (code B ref -1); Sat, 01 Mar 2025 14:03:03 +0000
Received: (at submit) by debbugs.gnu.org; 1 Mar 2025 14:02:58 +0000
Received: from localhost ([127.0.0.1]:35948 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toNQf-0002t9-Dc
	for submit <at> debbugs.gnu.org; Sat, 01 Mar 2025 09:02:57 -0500
Received: from lists.gnu.org ([2001:470:142::17]:55342)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <sisiutl@HIDDEN>)
 id 1toNQc-0002sj-Hq
 for submit <at> debbugs.gnu.org; Sat, 01 Mar 2025 09:02:55 -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 1toNQV-0007nV-Fg
 for guix-patches@HIDDEN; Sat, 01 Mar 2025 09:02:48 -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 1toNQT-0004OG-Gl
 for guix-patches@HIDDEN; Sat, 01 Mar 2025 09:02:47 -0500
Received: from localhost (2a02-8428-4716-0c01-0a11-96ff-fe51-cd64.rev.sfr.net
 [IPv6:2a02:8428:4716:c01:a11:96ff:fe51:cd64])
 (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 DC0116739C;
 Sat,  1 Mar 2025 15:02:40 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=egregore.fun;
 s=fujo; t=1740837760;
 bh=fACWnzanfJ5OBcwsbAnY8n+1nAJNs4d1L2ZYsedR0NY=;
 h=From:To:Cc:Subject:Date;
 b=rc3wmdtobDvGr4K8WYHX8raq2sh99vcPUgWo7o8AjAWB3kg0B9Nc2TzHDGjx51iuc
 sfScHysLE7PTVNcJlyRwuG4/w704gSWjHY45pNlOBwxyEfb+MRvf+B+ZolIbOQsIoI
 YZ2DGiduZR+UVfHyEYua1gzfEoG0lsuEQ6q7Gtfw=
From: Sisiutl <sisiutl@HIDDEN>
Date: Sat,  1 Mar 2025 15:01:19 +0100
Message-ID: <20250301140222.32470-1-sisiutl@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
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: 55
X-Spam_score: 5.5
X-Spam_bar: +++++
X-Spam_report: (5.5 / 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.773, 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.2 (++++)
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. * doc/guix.texi
 (Desktop Home Services): Document it. Change-Id:
 I052f871c9ebefe60a71154d590376b86884a1c9f
 --- doc/guix.texi | 36 ++++++++++++++++ gnu/home/services/desktop.scm | 78
 +++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) 
 Content analysis details:   (4.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.8 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: egregore.fun (fun)]
 1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -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-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.2 (+)
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. * doc/guix.texi
    (Desktop Home Services): Document it. Change-Id: I052f871c9ebefe60a71154d590376b86884a1c9f
    --- doc/guix.texi | 36 ++++++++++++++++ gnu/home/services/desktop.scm | 78
    +++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) 
 
 Content analysis details:   (1.2 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.8 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: egregore.fun (fun)]
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  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.
* doc/guix.texi (Desktop Home Services): Document it.

Change-Id: I052f871c9ebefe60a71154d590376b86884a1c9f
---
 doc/guix.texi                 | 36 ++++++++++++++++
 gnu/home/services/desktop.scm | 78 +++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index bb5f29277f..36b86cffe1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -47839,6 +47839,42 @@ In the example above, @code{x11-display} is instructed to set
 @env{DISPLAY} to @code{:3}.
 @end defvar
 
+@defvar home-wayland-service-type
+This is the service type representing a Wayland compositor.  It
+functions as an equivalent of @code{x11-service-type} for Wayland.
+
+Like X11, Wayland compositors are started by services like
+@code{gdm-service-type}, described in the system configuration.  At the
+level of Guix Home, as an unprivileged user, we cannot start our Wayland
+compositor; all we can do is check whether it is running.   This is what
+this service does.
+
+As a user, you probably don't need to worry or explicitly instantiate
+@code{home-wayland-service-type}.  Services that require an Wayland
+graphical display instantiate this service and depend on its
+corresponding @code{wayland-display} Shepherd service (@pxref{Shepherd
+Home Service}).
+
+If you're writing a Shepherd service that requires the presence of a
+Wayland compositor, you need to depend on this service to ensure Wayland
+is accessible from your service.
+
+When the Wayland compositor is running, the @code{wayland-display}
+Shepherd service starts and sets the @env{WAYLAND_DISPLAY} environment
+variable of the @command{shepherd} process, using its original value if
+it was already set; otherwise, it fails to start.
+
+The service can also be forced to use a given value for
+@env{WAYLAND_DISPLAY}, like so:
+
+@example
+herd start wayland-display wayland-2
+@end example
+
+In the example above, @code{wayland-display} is instructed to set
+@env{WAYLAND_DISPLAY} to @code{wayland-2}.
+@end defvar
+
 @defvar home-redshift-service-type
 This is the service type for @uref{https://github.com/jonls/redshift,
 Redshift}, a program that adjusts the display color temperature
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index fc96ce9295..3bfa9997b8 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -33,6 +33,8 @@ (define-module (gnu home services desktop)
   #:use-module (ice-9 match)
   #:export (home-x11-service-type
 
+            home-wayland-service-type
+
             home-redshift-configuration
             home-redshift-configuration?
             home-redshift-service-type
@@ -121,6 +123,82 @@ (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 delay)
+  (list (shepherd-service
+         (provision '(wayland-display))
+         (modules '((ice-9 ftw)
+                    (ice-9 regex)
+                    (ice-9 match)
+                    (srfi srfi-1)
+                    (shepherd support)))
+         (start
+          #~(lambda* (#:optional (env-wayland-display (getenv "WAYLAND_DISPLAY")))
+
+              (define wayland-socket-regex "wayland-[0-9]+$")
+
+              (define (find-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 (find-display delay)
+                (let loop ((attempts delay))
+
+                  (define wayland-display
+                    (or env-wayland-display
+                        (find-socket %user-runtime-dir "wayland-[0-9]+$")))
+
+                  (unless wayland-display
+                    (unless (zero? attempts)
+                      (sleep 1)
+                      (loop (- attempts 1)))
+
+                    (format (current-error-port)
+                            "Wayland server did not show up; giving up.\n"))
+
+                  wayland-display))
+
+              (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))
+         (respawn? #f))))
+
+(define home-wayland-service-type
+  (service-type
+   (name 'home-wayland-display)
+   (extensions (list (service-extension home-shepherd-service-type
+                                        wayland-shepherd-service)))
+   (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





Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Sisiutl <sisiutl@HIDDEN>
Subject: bug#76659: Acknowledgement ([PATCH] gnu: home: services: Add
 'wayland-display' service.)
Message-ID: <handler.76659.B.174083777811112.ack <at> debbugs.gnu.org>
References: <20250301140222.32470-1-sisiutl@HIDDEN>
X-Gnu-PR-Message: ack 76659
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 76659 <at> debbugs.gnu.org
Date: Sat, 01 Mar 2025 14:03:03 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 76659 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
76659: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76659
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


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


Received: (at control) by debbugs.gnu.org; 2 Mar 2025 04:37:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 01 23:37:37 2025
Received: from localhost ([127.0.0.1]:50068 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tob57-00054l-GG
	for submit <at> debbugs.gnu.org; Sat, 01 Mar 2025 23:37:37 -0500
Received: from mx.boiledscript.com ([2a01:4f8:10b:392::42]:40348)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <hako@HIDDEN>)
 id 1tob55-000544-Ar
 for control <at> debbugs.gnu.org; Sat, 01 Mar 2025 23:37:36 -0500
Date: Sun, 02 Mar 2025 12:37:23 +0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space;
 s=mail; t=1740890253;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=WqIaNOx6+D/mVPR1Oac0ZxAPgpJwxPPpKuaL7bZqVfg=;
 b=ihqWDDbBK0HjGtvZsrsP2kHn6f+6QPm4jOR3lxGUjVBuKEVFsM7IKSryuEKfHnB9Hzx+iv
 dZaXHmMuAlkNrKwe+jlOjXNf5LO8lDVvA118XfL15nOQ4yNLZKUrPVqt/U/Sx4J1fhliQ3
 CJNsX2duSSn5B1Wwh8SLcVOqQpxWwc81YMjGr0rNO3z5rexBVkyANwMsJQHhOnEBRAKrck
 Tv9jTO/sLQ58/VI1TAT5zjVrZF+vJyufvGvXRjkKjMcg8iAEJPm+gETgzCxc0XrzVRQs0L
 RZf6fExU0G0en9sd/f4bkChkJWitzz04nlphONVx3xv8yioSY22mCwPrE0z7UQ==
Message-ID: <878qpo2gl8.wl-hako@HIDDEN>
From: Hilton Chain <hako@HIDDEN>
To: control <at> debbugs.gnu.org
Subject: Control message
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
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.0 (-)

severity 76057 normal
merge 76057 76619 76659 76667
quit





Last modified: Sun, 2 Mar 2025 04:45:04 UTC

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