Subject: [PATCH] services: xorg: Filter modules based on system
From: shtwzrd <[email-masked]>
To: [email-masked]
Cc: shtwzrd <[email-masked]>
Date: Sun, 09 Feb 2020 21:31:09 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Fixes <https://bugs.gnu.org/39402>.
Reported by shtwzrd <[email-masked]>.

* gnu/services/xorg.scm (xorg-configuration):
  Apply a filter over %default-xorg-modules packages, excluding
  those for which the %current-system is not among the package's
  supported-systems.

This patch makes it possible to use xorg-configuration on systems
other than x86_64 and i686, as without it, xf86-video-intel would
be pulled in on the unsupported architecture and fail.
---
 gnu/services/xorg.scm | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 9c84f7413f..edb421ada6 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -152,7 +152,12 @@
   xorg-configuration make-xorg-configuration
   xorg-configuration?
   (modules          xorg-configuration-modules    ;list of packages
-                    (default %default-xorg-modules))
+                    ; filter out modules not supported on current system
+                    (default (filter
+                              (lambda (p)
+                                (member (%current-system)
+                                        (package-supported-systems p)))
+                              %default-xorg-modules)))
   (fonts            xorg-configuration-fonts      ;list of packges
                     (default %default-xorg-fonts))
   (drivers          xorg-configuration-drivers    ;list of strings
@@ -356,7 +361,7 @@ in @var{config}, are available.  The result should be used in place of
     #~(apply execl #$X #$X ;; Second #$X is for argv[0].
              "-logverbose" "-verbose" "-terminate"
              #$@(xorg-configuration-server-arguments config)
-              (cdr (command-line))))
+             (cdr (command-line))))
 
   (program-file "startx" exp))
 
@@ -477,7 +482,7 @@ desktop session from the system or user profile will be used."
   (auto-login? slim-configuration-auto-login?
                (default #f))
   (default-user slim-configuration-default-user
-                (default ""))
+    (default ""))
   (theme slim-configuration-theme
          (default %default-slim-theme))
   (theme-name slim-configuration-theme-name
@@ -870,10 +875,10 @@ the GNOME desktop environment.")
                    "Enable=" (if (gdm-configuration-debug? config)
                                  "true"
                                  "false") "\n"
-                   "\n"
-                   "[security]\n"
-                   "#DisallowTCP=true\n"
-                   "#AllowRemoteAutoLogin=false\n"))
+                                 "\n"
+                                 "[security]\n"
+                                 "#DisallowTCP=true\n"
+                                 "#AllowRemoteAutoLogin=false\n"))
 
 (define (gdm-pam-service config)
   "Return a PAM service for @command{gdm}."
-- 
2.11.0