[PATCH] home: Add home-xorg-server-service-type.

  • Done
  • quality assurance status badge
Details
One participant
  • Sergey Trofimov
Owner
unassigned
Submitted by
Sergey Trofimov
Severity
normal
S
S
Sergey Trofimov wrote on 19 Mar 2023 22:54
(address . guix-patches@gnu.org)(name . Sergey Trofimov)(address . sarg@sarg.org.ru)
20230319215409.26714-1-sarg@sarg.org.ru
* 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(-)

Toggle diff (154 lines)
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
S
S
Sergey Trofimov wrote on 21 Mar 2023 22:32
(address . 62281@debbugs.gnu.org)
87a605hjmk.fsf@sarg.org.ru
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"))))
S
S
Sergey Trofimov wrote on 21 Mar 2023 22:38
control message for bug #62281
(address . control@debbugs.gnu.org)
be8c886422a25378907355c91eb88a34.sarg@sarg.org.ru
tags 62281 wontfix
close 62281
quit
?
Your comment

This issue is archived.

To comment on this conversation send an email to 62281@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 62281
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch