From: Sergey Trofimov <sarg@sarg.org.ru>
To: 62281@debbugs.gnu.org
Cc: Sergey Trofimov <sarg@sarg.org.ru>,
paren@disroot.org, andrew@trop.in, ludo@gnu.org
Subject: [bug#62281] [PATCH] home: Add home-xorg-server-service-type.
Date: Sun, 19 Mar 2023 22:54:09 +0100 [thread overview]
Message-ID: <20230319215409.26714-1-sarg@sarg.org.ru> (raw)
* 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))
\f
;;;
@@ -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
next reply other threads:[~2023-03-19 21:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 21:54 Sergey Trofimov [this message]
2023-03-21 21:32 ` [bug#62281] [PATCH] home: Add home-xorg-server-service-type Sergey Trofimov
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230319215409.26714-1-sarg@sarg.org.ru \
--to=sarg@sarg.org.ru \
--cc=62281@debbugs.gnu.org \
--cc=andrew@trop.in \
--cc=ludo@gnu.org \
--cc=paren@disroot.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).