xorg: honor xorg-configuration-server in xorg-configuration->file

Fixes <https://bugs.gnu.org/40806>.

Previously the xorg-server package specified in the configuration was ignored
entirely in xorg-configuration->file.  This had the effect that while the X
program of the configured package would be executed, the modules of the
configured package would be ignored in favor of the default xorg-server
package's modules.  This fixes that.

* gnu/services/xorg.scm (xorg-configuration->file): honor
  xorg-configuration-server.
This commit is contained in:
Caleb Ristvedt 2020-06-02 06:28:46 -05:00
parent 0266094531
commit 8b158e8b2c
No known key found for this signature in database
GPG key ID: C166AA495F7F189C

View file

@ -180,31 +180,32 @@ (define-record-type* <xorg-configuration>
(define (xorg-configuration->file config) (define (xorg-configuration->file config)
"Compute an Xorg configuration file corresponding to CONFIG, an "Compute an Xorg configuration file corresponding to CONFIG, an
<xorg-configuration> record." <xorg-configuration> record."
(define all-modules (let ((xorg-server (xorg-configuration-server config)))
;; 'xorg-server' provides 'fbdevhw.so' etc. (define all-modules
(append (xorg-configuration-modules config) ;; 'xorg-server' provides 'fbdevhw.so' etc.
(list xorg-server))) (append (xorg-configuration-modules config)
(list xorg-server)))
(define build (define build
#~(begin #~(begin
(use-modules (ice-9 match) (use-modules (ice-9 match)
(srfi srfi-1) (srfi srfi-1)
(srfi srfi-26)) (srfi srfi-26))
(call-with-output-file #$output (call-with-output-file #$output
(lambda (port) (lambda (port)
(define drivers (define drivers
'#$(xorg-configuration-drivers config)) '#$(xorg-configuration-drivers config))
(define (device-section driver) (define (device-section driver)
(string-append " (string-append "
Section \"Device\" Section \"Device\"
Identifier \"device-" driver "\" Identifier \"device-" driver "\"
Driver \"" driver "\" Driver \"" driver "\"
EndSection")) EndSection"))
(define (screen-section driver resolutions) (define (screen-section driver resolutions)
(string-append " (string-append "
Section \"Screen\" Section \"Screen\"
Identifier \"screen-" driver "\" Identifier \"screen-" driver "\"
Device \"device-" driver "\" Device \"device-" driver "\"
@ -218,8 +219,8 @@ (define (screen-section driver resolutions)
EndSubSection EndSubSection
EndSection")) EndSection"))
(define (input-class-section layout variant model options) (define (input-class-section layout variant model options)
(string-append " (string-append "
Section \"InputClass\" Section \"InputClass\"
Identifier \"evdev keyboard catchall\" Identifier \"evdev keyboard catchall\"
MatchIsKeyboard \"on\" MatchIsKeyboard \"on\"
@ -243,69 +244,69 @@ (define (input-class-section layout variant model options)
Driver \"evdev\" Driver \"evdev\"
EndSection\n")) EndSection\n"))
(define (expand modules) (define (expand modules)
;; Append to MODULES the relevant /lib/xorg/modules ;; Append to MODULES the relevant /lib/xorg/modules
;; sub-directories. ;; sub-directories.
(append-map (lambda (module) (append-map (lambda (module)
(filter-map (lambda (directory) (filter-map (lambda (directory)
(let ((full (string-append module (let ((full (string-append module
directory))) directory)))
(and (file-exists? full) (and (file-exists? full)
full))) full)))
'("/lib/xorg/modules/drivers" '("/lib/xorg/modules/drivers"
"/lib/xorg/modules/input" "/lib/xorg/modules/input"
"/lib/xorg/modules/multimedia" "/lib/xorg/modules/multimedia"
"/lib/xorg/modules/extensions"))) "/lib/xorg/modules/extensions")))
modules)) modules))
(display "Section \"Files\"\n" port) (display "Section \"Files\"\n" port)
(for-each (lambda (font) (for-each (lambda (font)
(format port " FontPath \"~a\"~%" font)) (format port " FontPath \"~a\"~%" font))
'#$(xorg-configuration-fonts config)) '#$(xorg-configuration-fonts config))
(for-each (lambda (module) (for-each (lambda (module)
(format port (format port
" ModulePath \"~a\"~%" " ModulePath \"~a\"~%"
module)) module))
(append (expand '#$all-modules) (append (expand '#$all-modules)
;; For fbdevhw.so and so on. ;; For fbdevhw.so and so on.
(list #$(file-append xorg-server (list #$(file-append xorg-server
"/lib/xorg/modules")))) "/lib/xorg/modules"))))
(display "EndSection\n" port) (display "EndSection\n" port)
(display " (display "
Section \"ServerFlags\" Section \"ServerFlags\"
Option \"AllowMouseOpenFail\" \"on\" Option \"AllowMouseOpenFail\" \"on\"
EndSection\n" port) EndSection\n" port)
(display (string-join (map device-section drivers) "\n") (display (string-join (map device-section drivers) "\n")
port) port)
(newline port) (newline port)
(display (string-join (display (string-join
(map (cut screen-section <> (map (cut screen-section <>
'#$(xorg-configuration-resolutions config)) '#$(xorg-configuration-resolutions config))
drivers) drivers)
"\n") "\n")
port) port)
(newline port) (newline port)
(let ((layout #$(and=> (xorg-configuration-keyboard-layout config) (let ((layout #$(and=> (xorg-configuration-keyboard-layout config)
keyboard-layout-name)) keyboard-layout-name))
(variant #$(and=> (xorg-configuration-keyboard-layout config) (variant #$(and=> (xorg-configuration-keyboard-layout config)
keyboard-layout-variant)) keyboard-layout-variant))
(model #$(and=> (xorg-configuration-keyboard-layout config) (model #$(and=> (xorg-configuration-keyboard-layout config)
keyboard-layout-model)) keyboard-layout-model))
(options '#$(and=> (xorg-configuration-keyboard-layout config) (options '#$(and=> (xorg-configuration-keyboard-layout config)
keyboard-layout-options))) keyboard-layout-options)))
(when layout (when layout
(display (input-class-section layout variant model options) (display (input-class-section layout variant model options)
port) port)
(newline port))) (newline port)))
(for-each (lambda (config) (for-each (lambda (config)
(display config port)) (display config port))
'#$(xorg-configuration-extra-config config)))))) '#$(xorg-configuration-extra-config config))))))
(computed-file "xserver.conf" build)) (computed-file "xserver.conf" build)))
(define (xorg-configuration-directory modules) (define (xorg-configuration-directory modules)
"Return a directory that contains the @code{.conf} files for X.org that "Return a directory that contains the @code{.conf} files for X.org that