guix_mirror_bot pushed a commit to branch fix-xorg-configuration-merging
in repository guix.

commit aeae5e50d006aabc32f748f8c6c990122baffb4d
Author: Ian Eure <[email protected]>
AuthorDate: Wed Dec 31 10:07:23 2025 -0800

    gnu: services: Fix xorg configuration merging.
    
    A bug in #21 causes the default configuration to be omitted from the xorg
    merging process.  This can cause users not using set-xorg-configuration or
    service extensions to end up with a broken configuration.
    
    Fixes #5267.
    
    * tests/services/xorg.scm: Add a regression test.
    * gnu/services/xorg.scm (handle-xorg-configuration): Include the
    xorg-configuration record from config in merges.
    
    Change-Id: I6bed8c109057cb9b5de36db68b78e3ccc88e6bcb
---
 gnu/services/xorg.scm   |  6 +++++-
 tests/services/xorg.scm | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 313023f38a..068ad68df5 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -685,7 +685,11 @@ a `service-extension', as used by 
`set-xorg-configuration'."
                  (configuration-record
                   (inherit config)
                   (xorg-configuration
-                    (merge-xorg-configurations xorg-configurations)))))))))
+                    (merge-xorg-configurations
+                     (cons ((record-accessor (record-type-descriptor config)
+                                             'xorg-configuration)
+                            config)
+                           xorg-configurations))))))))))
 
 (define (xorg-server-profile-service config)
   ;; XXX: profile-service-type only accepts <package> objects.
diff --git a/tests/services/xorg.scm b/tests/services/xorg.scm
index 0bb4a3e14c..d778d0c269 100644
--- a/tests/services/xorg.scm
+++ b/tests/services/xorg.scm
@@ -24,6 +24,8 @@
   #:use-module (gnu bootloader grub)
   #:use-module (gnu services)
   #:use-module (gnu services base)
+  #:use-module (gnu services desktop)
+  #:use-module (gnu services lightdm)
   #:use-module (gnu services xorg)
   #:use-module (gnu system)
   #:use-module (gnu system keyboard)
@@ -229,4 +231,37 @@
      (xorg-configuration (drivers %drivers-custom-1))
      (xorg-configuration (drivers %drivers-custom-2))))))
 
+;; regression tests.
+
+;; https://codeberg.org/guix/guix/issues/5267
+(test-equal "https://codeberg.org/guix/guix/issues/5267";
+  (xorg-configuration-keyboard-layout %config-xorg-keyboard-layout-1)
+  (let ((os (operating-system
+              (host-name "test")
+              (bootloader
+                (bootloader-configuration
+                  (bootloader grub-bootloader)
+                  (targets '("/dev/sdX"))))
+              (file-systems
+               (cons
+                (file-system
+                  (device (file-system-label "my-root"))
+                  (mount-point "/")
+                  (type "ext4"))
+                %base-file-systems))
+              (services
+               (cons*
+                (service lightdm-service-type
+                         (lightdm-configuration
+                           (xorg-configuration
+                             %config-xorg-keyboard-layout-1)))
+                (modify-services %desktop-services
+                  (delete gdm-service-type)))))))
+    (xorg-configuration-keyboard-layout
+     (lightdm-configuration-xorg-configuration
+      (service-value
+       (fold-services
+        (operating-system-services os)
+        #:target-type lightdm-service-type))))))
+
 (test-end "merge-xorg-configurations")

Reply via email to