From: Roman Scherer <roman@burningswell.com>
To: 61458@debbugs.gnu.org
Cc: r0man <roman@burningswell.com>, iyzsong@envs.net
Subject: [bug#61458] [PATCH v2 1/1] services: xorg-wrapper: Support xorg server input rewriting.
Date: Tue, 21 Mar 2023 20:11:41 +0100 [thread overview]
Message-ID: <af690c2b48f456fda57a00bb2622b571df15aec9.1679425545.git.roman@burningswell.com> (raw)
In-Reply-To: <cover.1679425545.git.roman@burningswell.com>
From: r0man <roman@burningswell.com>
* gnu/services/xorg.scm (xorg-wrapper): Support xorg server input rewriting.
This patch adds support for proper xorg server input rewriting. It uses the
lookup-package-direct-input procedure to configure the X server paths
dynamically, instead of always using the hard coded package. Something like
this is now possible:
(define other-mesa
(package-input-rewriting/spec `(("mesa" . ,(const other-mesa)))))
(xorg-configuration
(xorg-configuration
(server (other-mesa xorg-server))))
Without this patch the X server would still be configured with mesa (causing
version issues), and not with other-mesa (as per the input rewrite).
---
gnu/services/xorg.scm | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index c4745cecf5..7295a45b59 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -358,6 +358,22 @@ (define (xorg-configuration-directory modules)
files)
#t))))
+(define (xorg-configuration-server-package-path config input path)
+ "Lookup the direct @var{input} in the xorg server package of @var{config}
+and append @var{path} to it."
+ (let* ((server (xorg-configuration-server config))
+ (package (lookup-package-direct-input server input)))
+ (when package (file-append package path))))
+
+(define (xorg-configuration-dri-driver-path config)
+ (xorg-configuration-server-package-path config "mesa" "/lib/dri"))
+
+(define (xorg-configuration-xkb-bin-dir config)
+ (xorg-configuration-server-package-path config "xkbcomp" "/bin"))
+
+(define (xorg-configuration-xkb-dir config)
+ (xorg-configuration-server-package-path config "xkeyboard-config" "/share/X11/xkb"))
+
(define* (xorg-wrapper #:optional (config (xorg-configuration)))
"Return a derivation that builds a script to start the X server with the
given @var{config}. The resulting script should be used in place of
@@ -365,12 +381,13 @@ (define* (xorg-wrapper #:optional (config (xorg-configuration)))
(define exp
;; Write a small wrapper around the X server.
#~(begin
- (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri"))
- (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin"))
+ (setenv "XORG_DRI_DRIVER_PATH"
+ #$(xorg-configuration-dri-driver-path config))
+ (setenv "XKB_BINDIR" #$(xorg-configuration-xkb-bin-dir config))
(let ((X (string-append #$(xorg-configuration-server config) "/bin/X")))
(apply execl X X
- "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb")
+ "-xkbdir" #$(xorg-configuration-xkb-dir config)
"-config" #$(xorg-configuration->file config)
"-configdir" #$(xorg-configuration-directory
(xorg-configuration-modules config))
--
2.39.1
next prev parent reply other threads:[~2023-03-21 19:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-12 18:52 [bug#61458] [PATCH] services: xorg-wrapper: Support xorg server input Roman Scherer
2023-03-07 1:30 ` 宋文武 via Guix-patches via
2023-03-10 15:32 ` Roman Scherer
2023-03-21 19:11 ` [bug#61458] [PATCH v2 0/1] Support xorg server input rewriting Roman Scherer
2023-03-21 19:11 ` Roman Scherer [this message]
2023-03-25 2:11 ` bug#61458: [PATCH] services: xorg-wrapper: Support xorg server input 宋文武 via Guix-patches via
2023-03-25 7:56 ` [bug#61458] " Roman Scherer
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=af690c2b48f456fda57a00bb2622b571df15aec9.1679425545.git.roman@burningswell.com \
--to=roman@burningswell.com \
--cc=61458@debbugs.gnu.org \
--cc=iyzsong@envs.net \
/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).