all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bruno Victal <mirai@makinata.eu>
To: 60756@debbugs.gnu.org
Cc: me@tobias.gr, Bruno Victal <mirai@makinata.eu>
Subject: [bug#60756] [PATCH v2 1/2] services: Add x11-socket-directory-service-type.
Date: Sat, 18 Feb 2023 15:19:31 +0000	[thread overview]
Message-ID: <156c8abd42d67c8174f274ca933bdc495efc1962.1676733543.git.mirai@makinata.eu> (raw)
In-Reply-To: <cover.1673537696.git.mirai@makinata.eu>

The x11-socket-directory-service misuses activation-service-type
to create directories. This kind of usage is incorrect since
activation-service-type does not depend of file-systems and incompatible
with user defined /tmp mount.

This commit turns x11-socket-directory-service into a shepherd one-shot
service by defining a new x11-socket-directory-service-type.

* gnu/services/desktop.scm (x11-socket-directory-service-type): New variable.
(x11-socket-directory-service): Deprecate variable.
(desktop-services-for-system): Use new service-type.
* gnu/tests/lightdm.scm: Use new service-type.
---
 gnu/services/desktop.scm | 44 ++++++++++++++++++++++++++++++----------
 gnu/tests/lightdm.scm    |  2 +-
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index fe1f0fd20a..b2983667b8 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2021, 2022 muradm <mail@muradm.net>
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -148,7 +149,8 @@ (define-module (gnu services desktop)
             xfce-desktop-service
             xfce-desktop-service-type
 
-            x11-socket-directory-service
+            x11-socket-directory-service ;deprecated
+            x11-socket-directory-service-type
 
             enlightenment-desktop-configuration
             enlightenment-desktop-configuration?
@@ -1496,18 +1498,38 @@ (define lxqt-desktop-service-type
 ;;; X11 socket directory service
 ;;;
 
-(define x11-socket-directory-service
+(define x11-socket-directory-service-type
+  (let ((x11-socket-directory-shepherd-service
+         (shepherd-service
+          (documentation "Create /tmp/.X11-unix for XWayland.")
+          (requirement '(file-systems))
+          (provision '(x11-socket-directory))
+          (one-shot? #t)
+          (start #~(lambda _
+                     (let ((directory "/tmp/.X11-unix"))
+                       (mkdir-p directory)
+                       (chmod directory #o1777)))))))
+    (service-type
+     (name 'x11-socket-directory-service)
+     (extensions
+      (list
+       (service-extension shepherd-root-service-type
+                          (compose
+                           list
+                           (const x11-socket-directory-shepherd-service)))))
+     (default-value #f) ; no default value required
+     (description
+      "Create @file{/tmp/.X11-unix} for XWayland.  When using X11, libxcb
+takes care of creating that directory however, when using XWayland, we
+need to create it beforehand."))))
+
+(define-deprecated x11-socket-directory-service
+  x11-socket-directory-service-type
   ;; Return a service that creates /tmp/.X11-unix.  When using X11, libxcb
   ;; takes care of creating that directory.  However, when using XWayland, we
   ;; need to create beforehand.  Thus, create it unconditionally here.
-  (simple-service 'x11-socket-directory
-                  activation-service-type
-                  (with-imported-modules '((guix build utils))
-                    #~(begin
-                        (use-modules (guix build utils))
-                        (let ((directory "/tmp/.X11-unix"))
-                          (mkdir-p directory)
-                          (chmod directory #o1777))))))
+  (service x11-socket-directory-service-type))
+
 \f
 ;;;
 ;;; Enlightenment desktop service.
@@ -1808,7 +1830,7 @@ (define* (desktop-services-for-system #:optional
 
          (service ntp-service-type)
 
-         x11-socket-directory-service
+         (service x11-socket-directory-service-type)
 
          (service pulseaudio-service-type)
          (service alsa-service-type)
diff --git a/gnu/tests/lightdm.scm b/gnu/tests/lightdm.scm
index 57d029a75a..d260d844d6 100644
--- a/gnu/tests/lightdm.scm
+++ b/gnu/tests/lightdm.scm
@@ -50,7 +50,7 @@ (define minimal-desktop-services
         (service polkit-service-type)
         (elogind-service)
         (dbus-service)
-        x11-socket-directory-service))
+        (service x11-socket-directory-service-type)))
 
 (define %lightdm-os
   (operating-system
-- 
2.39.1





  parent reply	other threads:[~2023-02-18 15:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-12 15:43 [bug#60756] [PATCH 0/2] Add x11-socket-directory-service-type Bruno Victal
2023-01-12 15:46 ` [bug#60756] [PATCH 1/2] services: " Bruno Victal
2023-01-12 15:46 ` [bug#60756] [PATCH 2/2] Revert "tests: Add gdm tests." Bruno Victal
2023-01-12 15:49 ` [bug#60756] (no subject) Bruno Victal
2023-02-18 15:19 ` Bruno Victal [this message]
2023-02-18 15:19   ` [bug#60756] [PATCH v2 2/2] tests: gdm: Remove tmpfs related tests Bruno Victal
2023-03-06 13:16   ` [bug#60756] [PATCH v2 1/2] services: Add x11-socket-directory-service-type Josselin Poiret via Guix-patches via
2023-03-06 12:35 ` [bug#60756] [PATCH v3 " Bruno Victal
2023-03-06 12:35   ` [bug#60756] [PATCH v3 2/2] tests: gdm: Remove tmpfs related tests Bruno Victal
2023-03-21 20:50   ` bug#60756: [PATCH 0/2] Add x11-socket-directory-service-type Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=156c8abd42d67c8174f274ca933bdc495efc1962.1676733543.git.mirai@makinata.eu \
    --to=mirai@makinata.eu \
    --cc=60756@debbugs.gnu.org \
    --cc=me@tobias.gr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.