GNU bug report logs - #61458
[PATCH] services: xorg-wrapper: Support xorg server input

Previous Next

Package: guix-patches;

Reported by: Roman Scherer <roman.scherer <at> burningswell.com>

Date: Sun, 12 Feb 2023 19:17:02 UTC

Severity: normal

Tags: moreinfo, patch

Done: 宋文武 <iyzsong <at> envs.net>

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 61458 in the body.
You can then email your comments to 61458 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 guix-patches <at> gnu.org:
bug#61458; Package guix-patches. (Sun, 12 Feb 2023 19:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Roman Scherer <roman.scherer <at> burningswell.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 12 Feb 2023 19:17:02 GMT) Full text and rfc822 format available.

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

From: Roman Scherer <roman.scherer <at> burningswell.com>
To: Guix Patches <guix-patches <at> gnu.org>
Subject: [PATCH] services: xorg-wrapper: Support xorg server input
Date: Sun, 12 Feb 2023 19:52:40 +0100
[Message part 1 (text/plain, inline)]
Hello Guix,

I would like to replace the Mesa package in my Xorg configuration. I
tried to do this with the following snippet:

```
(modify-services %desktop-services
  (slim-service-type config =>
                     (slim-configuration
                      (inherit config)
                      (xorg-configuration
                       (xorg-configuration
                        (server (replace-mesa xorg-server)))))))
```

But this unfortunately does not work, because the xorg-wrapper uses
static paths for the mesa, xkbcomp and xkeyboard-config packages in the
derivation.

The xserver starts now with the replaced mesa, but some paths still
point to the hard coded packages in Guix itself (and not the
replacement), which cause some things to not work.

This patch changes this to lookup the paths from the inputs of the
server field of the xorg-configuration instead. That way the correct
paths are setup in the xor-wrapper script. If those inputs are not found
for some reason it falls back to the current behavior, using the
packages from Guix.

Could you please review this?

Thanks, Roman.

[0001-services-xorg-wrapper-Support-xorg-server-input-tran.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

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

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

From: 宋文武 <iyzsong <at> envs.net>
To: Roman Scherer <roman.scherer <at> burningswell.com>
Cc: 61458 <at> debbugs.gnu.org
Subject: Re: bug#61458: [PATCH] services: xorg-wrapper: Support xorg server
 input
Date: Tue, 07 Mar 2023 09:30:01 +0800
Roman Scherer <roman.scherer <at> burningswell.com> writes:

> Hello Guix,
>
> I would like to replace the Mesa package in my Xorg configuration. I
> tried to do this with the following snippet:
>
> ```
> (modify-services %desktop-services
>   (slim-service-type config =>
>                      (slim-configuration
>                       (inherit config)
>                       (xorg-configuration
>                        (xorg-configuration
>                         (server (replace-mesa xorg-server)))))))
> ```
>
> But this unfortunately does not work, because the xorg-wrapper uses
> static paths for the mesa, xkbcomp and xkeyboard-config packages in the
> derivation.
>
> The xserver starts now with the replaced mesa, but some paths still
> point to the hard coded packages in Guix itself (and not the
> replacement), which cause some things to not work.
>
> This patch changes this to lookup the paths from the inputs of the
> server field of the xorg-configuration instead. That way the correct
> paths are setup in the xor-wrapper script. If those inputs are not found
> for some reason it falls back to the current behavior, using the
> packages from Guix.
>
> Could you please review this?
>
> Thanks, Roman.

Sorry for a long deley..
>
> From d035c99ed4703da0e3e9b62299c390560c074a17 Mon Sep 17 00:00:00 2001
> From: r0man <roman <at> burningswell.com>
> Date: Sat, 11 Feb 2023 19:36:16 +0100
> Subject: [PATCH] services: xorg-wrapper: Support xorg server input
>  transformations.

I think it's better add some explaination to commit message like:
The xorg-wrapper uses [...]
This patch [...]

Should be good.
>
> * gnu/services/xorg.scm (xorg-wrapper): Support xorg server input transformations.
> ---
>  gnu/services/xorg.scm | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
> index 5f073d05d3..92735e6004 100644
> --- a/gnu/services/xorg.scm
> +++ b/gnu/services/xorg.scm
> @@ -355,6 +355,21 @@ (define files
>                                   files)
>                         #t))))
>  
> +(define (xorg-configuration-append-input config input default-input path)
> +  (let ((server (xorg-configuration-server config)))
> +    (file-append (or (lookup-package-direct-input server input) default-input)
> +                 path)))
I'm not sure about the procedure name, maybe add a docstring explain
it's function?


Otherwise, look good to me, thank you!




Information forwarded to guix-patches <at> gnu.org:
bug#61458; Package guix-patches. (Fri, 10 Mar 2023 15:34:01 GMT) Full text and rfc822 format available.

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

From: Roman Scherer <roman.scherer <at> burningswell.com>
To: 宋文武 <iyzsong <at> envs.net>
Cc: 61458 <at> debbugs.gnu.org
Subject: Re: bug#61458: [PATCH] services: xorg-wrapper: Support xorg server
 input
Date: Fri, 10 Mar 2023 16:32:28 +0100
[Message part 1 (text/plain, inline)]
Hi 宋文武,

thanks for taking a look. I messed up my system, but will update the
patch once I got everyting working again.

Roman

宋文武 <iyzsong <at> envs.net> writes:

> Roman Scherer <roman.scherer <at> burningswell.com> writes:
>
>> Hello Guix,
>>
>> I would like to replace the Mesa package in my Xorg configuration. I
>> tried to do this with the following snippet:
>>
>> ```
>> (modify-services %desktop-services
>>   (slim-service-type config =>
>>                      (slim-configuration
>>                       (inherit config)
>>                       (xorg-configuration
>>                        (xorg-configuration
>>                         (server (replace-mesa xorg-server)))))))
>> ```
>>
>> But this unfortunately does not work, because the xorg-wrapper uses
>> static paths for the mesa, xkbcomp and xkeyboard-config packages in the
>> derivation.
>>
>> The xserver starts now with the replaced mesa, but some paths still
>> point to the hard coded packages in Guix itself (and not the
>> replacement), which cause some things to not work.
>>
>> This patch changes this to lookup the paths from the inputs of the
>> server field of the xorg-configuration instead. That way the correct
>> paths are setup in the xor-wrapper script. If those inputs are not found
>> for some reason it falls back to the current behavior, using the
>> packages from Guix.
>>
>> Could you please review this?
>>
>> Thanks, Roman.
>
> Sorry for a long deley..
>>
>> From d035c99ed4703da0e3e9b62299c390560c074a17 Mon Sep 17 00:00:00 2001
>> From: r0man <roman <at> burningswell.com>
>> Date: Sat, 11 Feb 2023 19:36:16 +0100
>> Subject: [PATCH] services: xorg-wrapper: Support xorg server input
>>  transformations.
>
> I think it's better add some explaination to commit message like:
> The xorg-wrapper uses [...]
> This patch [...]
>
> Should be good.
>>
>> * gnu/services/xorg.scm (xorg-wrapper): Support xorg server input transformations.
>> ---
>>  gnu/services/xorg.scm | 22 +++++++++++++++++++---
>>  1 file changed, 19 insertions(+), 3 deletions(-)
>>
>> diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
>> index 5f073d05d3..92735e6004 100644
>> --- a/gnu/services/xorg.scm
>> +++ b/gnu/services/xorg.scm
>> @@ -355,6 +355,21 @@ (define files
>>                                   files)
>>                         #t))))
>>
>> +(define (xorg-configuration-append-input config input default-input path)
>> +  (let ((server (xorg-configuration-server config)))
>> +    (file-append (or (lookup-package-direct-input server input) default-input)
>> +                 path)))
> I'm not sure about the procedure name, maybe add a docstring explain
> it's function?
>
>
> Otherwise, look good to me, thank you!
[signature.asc (application/pgp-signature, inline)]

Added tag(s) moreinfo. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 16 Mar 2023 11:07:01 GMT) Full text and rfc822 format available.

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

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

From: Roman Scherer <roman <at> burningswell.com>
To: 61458 <at> debbugs.gnu.org
Cc: Roman Scherer <roman <at> burningswell.com>, iyzsong <at> envs.net
Subject: [PATCH v2 0/1] Support xorg server input rewriting
Date: Tue, 21 Mar 2023 20:11:40 +0100
Hi 宋文武,

I'm back on track. Here's an improved version of the patch. It was indeed way
too complicated. :)

Can you have another look please?

Thanks, Roman.

r0man (1):
  services: xorg-wrapper: Support xorg server input rewriting.

 gnu/services/xorg.scm | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

--
2.39.1




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

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

From: Roman Scherer <roman <at> burningswell.com>
To: 61458 <at> debbugs.gnu.org
Cc: r0man <roman <at> burningswell.com>, iyzsong <at> envs.net
Subject: [PATCH v2 1/1] services: xorg-wrapper: Support xorg server input
 rewriting.
Date: Tue, 21 Mar 2023 20:11:41 +0100
From: r0man <roman <at> 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





Reply sent to 宋文武 <iyzsong <at> envs.net>:
You have taken responsibility. (Sat, 25 Mar 2023 02:11:02 GMT) Full text and rfc822 format available.

Notification sent to Roman Scherer <roman.scherer <at> burningswell.com>:
bug acknowledged by developer. (Sat, 25 Mar 2023 02:11:02 GMT) Full text and rfc822 format available.

Message #24 received at 61458-done <at> debbugs.gnu.org (full text, mbox):

From: 宋文武 <iyzsong <at> envs.net>
To: Roman Scherer <roman <at> burningswell.com>
Cc: 61458-done <at> debbugs.gnu.org
Subject: Re: bug#61458: [PATCH] services: xorg-wrapper: Support xorg server
 input
Date: Sat, 25 Mar 2023 10:11:04 +0800
Roman Scherer <roman <at> burningswell.com> writes:

>   services: xorg-wrapper: Support xorg server input rewriting.

Pushed with some commit description added:

    * gnu/services/xorg.scm (xorg-configuration-server-package-path)
    (xorg-configuration-dri-driver-path, xorg-configuration-xkb-bin-dir)
    (xorg-configuration-xkb-dir): New procedures.
    (xorg-wrapper): Use them for dri and xkb paths.

Thank you!




Information forwarded to guix-patches <at> gnu.org:
bug#61458; Package guix-patches. (Sat, 25 Mar 2023 13:02:02 GMT) Full text and rfc822 format available.

Message #27 received at 61458-done <at> debbugs.gnu.org (full text, mbox):

From: Roman Scherer <roman.scherer <at> burningswell.com>
To: 宋文武 <iyzsong <at> envs.net>
Cc: 61458-done <at> debbugs.gnu.org
Subject: Re: bug#61458: [PATCH] services: xorg-wrapper: Support xorg server
 input
Date: Sat, 25 Mar 2023 08:56:46 +0100
[Message part 1 (text/plain, inline)]
Thank you 宋文武!

宋文武 <iyzsong <at> envs.net> writes:

> Roman Scherer <roman <at> burningswell.com> writes:
>
>>   services: xorg-wrapper: Support xorg server input rewriting.
>
> Pushed with some commit description added:
>
>     * gnu/services/xorg.scm (xorg-configuration-server-package-path)
>     (xorg-configuration-dri-driver-path, xorg-configuration-xkb-bin-dir)
>     (xorg-configuration-xkb-dir): New procedures.
>     (xorg-wrapper): Use them for dri and xkb paths.
>
> Thank you!
[signature.asc (application/pgp-signature, inline)]

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

This bug report was last modified 1 year and 3 days ago.

Previous Next


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