GNU bug report logs - #62281
[PATCH] home: Add home-xorg-server-service-type.

Previous Next

Package: guix-patches;

Reported by: Sergey Trofimov <sarg <at> sarg.org.ru>

Date: Sun, 19 Mar 2023 21:55:02 UTC

Severity: normal

Tags: patch, wontfix

Done: Sergey Trofimov <sarg <at> sarg.org.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62281 in the body.
You can then email your comments to 62281 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to paren <at> disroot.org, andrew <at> trop.in, ludo <at> gnu.org, guix-patches <at> gnu.org:
bug#62281; Package guix-patches. (Sun, 19 Mar 2023 21:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sergey Trofimov <sarg <at> sarg.org.ru>:
New bug report received and forwarded. Copy sent to paren <at> disroot.org, andrew <at> trop.in, ludo <at> gnu.org, guix-patches <at> gnu.org. (Sun, 19 Mar 2023 21:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: guix-patches <at> gnu.org
Cc: Sergey Trofimov <sarg <at> sarg.org.ru>
Subject: [PATCH] home: Add home-xorg-server-service-type.
Date: Sun, 19 Mar 2023 22:54:09 +0100
* gnu/home/services/desktop.scm
(home-xorg-server-service-type): New variable.
* gnu/services/xorg.scm (xorg-server-wrapper-package):
Rename from xorg-server-profile-server and export.
* doc/guix.texi: Document home-xorg-server-service-type.
---
 doc/guix.texi                 | 27 +++++++++++++++++++
 gnu/home/services/desktop.scm | 17 +++++++++++-
 gnu/services/xorg.scm         | 51 ++++++++++++++++++-----------------
 3 files changed, 69 insertions(+), 26 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index fa9ea5a6ec..9c1df5d1b5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -42661,6 +42661,33 @@ The list of expressions to be read by @code{xmodmap} on service startup.
 @end table
 @end deftp
 
+@defvar home-xorg-server-service-type
+This is the service type to run rootless @code{xorg-server}.  It takes
+@code{xorg-configuration} which is used to generate the Xorg server
+start script.
+
+@lisp
+(service home-xorg-server-service-type
+         (xorg-configuration
+          (modules (list xf86-video-intel xf86-input-libinput))
+          (drivers (list "intel"))))
+@end lisp
+
+Xorg can be started after logging in the console using @command{xinit}
+or @command{sx}.  This could also be automated by adding auto-start
+launcher to the shell's rc file.
+
+@lisp
+(simple-service
+ 'sx-autostart home-bash-service-type
+ (home-bash-extension
+  (bash-profile
+   (list (plain-file
+          "bash-sx-autostart"
+          "[[ ! $DISPLAY && $(tty) == /dev/tty1 ]] && exec sx")))))
+@end lisp
+@end defvar
+
 @node Guix Home Services
 @subsection Guix Home Services
 
diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm
index fb1cd44060..cfb2dd52fa 100644
--- a/gnu/home/services/desktop.scm
+++ b/gnu/home/services/desktop.scm
@@ -25,6 +25,7 @@ (define-module (gnu home services desktop)
   #:autoload   (gnu packages glib)    (dbus)
   #:autoload   (gnu packages xdisorg) (redshift unclutter)
   #:autoload   (gnu packages xorg) (setxkbmap xmodmap)
+  #:use-module (gnu services xorg)
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
@@ -37,7 +38,11 @@ (define-module (gnu home services desktop)
             home-dbus-service-type
 
             home-unclutter-configuration
-            home-unclutter-service-type))
+            home-unclutter-service-type
+
+            home-xorg-server-service-type)
+
+  #:re-export (xorg-configuration))
 
 
 ;;;
@@ -332,3 +337,13 @@ (define home-xmodmap-service-type
    (default-value (home-xmodmap-configuration))
    (description "Run the @code{xmodmap} utility to modify keymaps and pointer
 buttons under the Xorg display server via user-defined expressions.")))
+
+(define home-xorg-server-service-type
+  (service-type
+   (name 'xorg-server)
+   (extensions
+    (list (service-extension home-profile-service-type
+                             (compose list xorg-server-wrapper-package))))
+   (default-value (xorg-configuration))
+   (description "Add @command{X} to the home profile, to be used with
+@command{sx} or @command{xinit}.")))
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index c4745cecf5..0e8f352926 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -84,6 +84,7 @@ (define-module (gnu services xorg)
             xorg-wrapper
             xorg-start-command
             xinitrc
+            xorg-server-wrapper-package
             xorg-server-service-type
 
             %default-slim-theme
@@ -506,37 +507,37 @@ (define-syntax handle-xorg-configuration
                       (xorg-configuration xorg-configuration))
                      config)))))))
 
-(define (xorg-server-profile-service config)
-  ;; XXX: profile-service-type only accepts <package> objects.
-  (list
-   (package
-     (name "xorg-wrapper")
-     (version (package-version xorg-server))
-     (source (xorg-wrapper config))
-     (build-system trivial-build-system)
-     (arguments
-      '(#:modules ((guix build utils))
-        #:builder
-        (begin
-          (use-modules (guix build utils))
-          (let* ((source (assoc-ref %build-inputs "source"))
-                 (out (assoc-ref %outputs "out"))
-                 (bin (string-append out "/bin")))
-            (mkdir-p bin)
-            (symlink source (string-append bin "/X"))
-            (symlink source (string-append bin "/Xorg"))
-            #t))))
-     (home-page (package-home-page xorg-server))
-     (synopsis (package-synopsis xorg-server))
-     (description (package-description xorg-server))
-     (license (package-license xorg-server)))))
+(define (xorg-server-wrapper-package config)
+  "Return a package with @command{X} and @command{Xorg} commands launching
+xorg-server with provided @var{config}."
+  (package
+    (name "xorg-wrapper")
+    (version (package-version xorg-server))
+    (source (xorg-wrapper config))
+    (build-system trivial-build-system)
+    (arguments
+     '(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let* ((source (assoc-ref %build-inputs "source"))
+                (out (assoc-ref %outputs "out"))
+                (bin (string-append out "/bin")))
+           (mkdir-p bin)
+           (symlink source (string-append bin "/X"))
+           (symlink source (string-append bin "/Xorg"))
+           #t))))
+    (home-page (package-home-page xorg-server))
+    (synopsis (package-synopsis xorg-server))
+    (description (package-description xorg-server))
+    (license (package-license xorg-server))))
 
 (define xorg-server-service-type
   (service-type
    (name 'xorg-server)
    (extensions
     (list (service-extension profile-service-type
-                             xorg-server-profile-service)))
+                             (compose list xorg-server-wrapper-package))))
    (default-value (xorg-configuration))
    (description "Add @command{X} to the system profile, to be used with
 @command{sx} or @command{xinit}.")))
-- 
2.39.2





Information forwarded to guix-patches <at> gnu.org:
bug#62281; Package guix-patches. (Tue, 21 Mar 2023 21:37:02 GMT) Full text and rfc822 format available.

Message #8 received at 62281 <at> debbugs.gnu.org (full text, mbox):

From: Sergey Trofimov <sarg <at> sarg.org.ru>
To: 62281 <at> debbugs.gnu.org
Subject: Re: [bug#62281] [PATCH] home: Add home-xorg-server-service-type.
Date: Tue, 21 Mar 2023 22:32:40 +0100
This is not needed. Xorg config should be a part of the 
operating-system and guix already has xorg-server-service-type for 
that. Autostart of sx could be done in the home-environment using 
this code:

(define (sx-autostart-on tty)
 (simple-service
  'sx-autostart home-shell-profile-service-type
  (list (mixed-text-file
         "sx-autostart"
         "[[ ! $DISPLAY && $(tty) == /dev/" tty " ]] && "
         "exec " (@ (gnu packages xdisorg) sx) "/bin/sx"))))




Added tag(s) wontfix. Request was from Sergey Trofimov <sarg <at> sarg.org.ru> to control <at> debbugs.gnu.org. (Tue, 21 Mar 2023 21:38:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 62281 <at> debbugs.gnu.org and Sergey Trofimov <sarg <at> sarg.org.ru> Request was from Sergey Trofimov <sarg <at> sarg.org.ru> to control <at> debbugs.gnu.org. (Tue, 21 Mar 2023 21:38:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 19 Apr 2023 11:24:21 GMT) Full text and rfc822 format available.

This bug report was last modified 343 days ago.

Previous Next


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