GNU bug report logs - #77266
[PATCH] gnu: Merge xorg configurations when extending.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Ian Eure <ian@HIDDEN>; Keywords: patch; dated Wed, 26 Mar 2025 04:25:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Mar 2025 04:24:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 26 00:24:18 2025
Received: from localhost ([127.0.0.1]:40809 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1txIJN-0006jr-L1
	for submit <at> debbugs.gnu.org; Wed, 26 Mar 2025 00:24:18 -0400
Received: from lists.gnu.org ([2001:470:142::17]:46608)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <ian@HIDDEN>) id 1txIJH-0006jU-Ci
 for submit <at> debbugs.gnu.org; Wed, 26 Mar 2025 00:24:14 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ian@HIDDEN>) id 1txIJA-0001Jk-Kh
 for guix-patches@HIDDEN; Wed, 26 Mar 2025 00:24:05 -0400
Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ian@HIDDEN>) id 1txIJ8-0005AK-H9
 for guix-patches@HIDDEN; Wed, 26 Mar 2025 00:24:04 -0400
Received: from phl-compute-11.internal (phl-compute-11.phl.internal
 [10.202.2.51])
 by mailfhigh.phl.internal (Postfix) with ESMTP id 392DB1140151;
 Wed, 26 Mar 2025 00:23:59 -0400 (EDT)
Received: from phl-mailfrontend-01 ([10.202.2.162])
 by phl-compute-11.internal (MEProxy); Wed, 26 Mar 2025 00:23:59 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=retrospec.tv; h=
 cc:cc:content-transfer-encoding:content-type:date:date:from:from
 :in-reply-to:message-id:mime-version:reply-to:subject:subject:to
 :to; s=fm1; t=1742963039; x=1743049439; bh=jE66/fGQ+XwDQ+QTJXQjH
 C5ip0xRJPzZkR7/E2NM2BY=; b=fztgO4Rw1pwBsojqbaVJdknBsaMp851KGiGGJ
 dFhUrYC0mEMCmzGf2/GNxI7wjWwwLLxULfP9CWDjl1Te2En+rOA/fTPtxLy8tc4B
 HBfya6+CXtBHC7KSFlzCQ/QKmuMw/gDTlTzbpihPbuV+HzSRt68KyfSPw7cQmyhV
 /chhCimsTPJbd8hrfJQUOLJM7u+JsAML0sWSk9F/01nkUVFbn4TcfyF9j4ab4fxQ
 Wz9DV/ROuLOdKi0vKjdw6XFkWBEpGU4n9eFxczttb0cHmalGQuVvv3EqLMKuCgXF
 hGlNlL98VTZjriBVa3gFUx7HZs27QRuvDyC1jfwntcMm83yOQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:message-id:mime-version:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=
 1742963039; x=1743049439; bh=jE66/fGQ+XwDQ+QTJXQjHC5ip0xRJPzZkR7
 /E2NM2BY=; b=V3+RqiZC6HyYFI3u6k6r2fdJZV3K5qJXSWHTq0mhjuq5h/3RjqP
 DJfLKhHbH+oY0IQxB5Offtm73qsEtKGiJrRKzcGzXyIbD+iq2iNzg9x7Ldqz4gUU
 HZVVhI/sG44ugyWY0P4zuAsbJe1Jns24c38WWobZrxJT/veban/Ss0nOsGaZn5zG
 oJU/K5NQvafnZMTA6NuVWVyxF0MXvFFp8rGUrRmyG2soRHYtQKqS8/w+RLDsFFL2
 c9DCSXzIPdqr+3VRuigK1lep9Olul0Yx/8QOlkruI+3uowzeph0swQBXCFFq9Wsu
 szCbkD+nxhWvcnUOHAHbeA17rZ3j2Kp5LCw==
X-ME-Sender: <xms:XoHjZ9AifThhiW9JJOPAQmthU5BKOPFbmGH6g7wGnhyQMVmOkDmmeA>
 <xme:XoHjZ7jORDpsjB6w2T0CId2OUjQSbjy5jMrsysniKbCTJNelUYbqoHyhvmm6emx2l
 vNjPK9vamSbViFaVQ>
X-ME-Received: <xmr:XoHjZ4msBbrkuIZmrsOvtFNGJvlbYGEFGiIC0EYeyrWC2ucTyZIB9PQp8iRG-Jtc5LivOXvaZKmMAEU9Co3RHVni5GOEe40YMw83GfCCw6vIlQRargTWxg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduieegheeiucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
 pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf
 evufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefkrghnucfguhhrvgcuoehirghn
 sehrvghtrhhoshhpvggtrdhtvheqnecuggftrfgrthhtvghrnhephfeiveeliedukeffhe
 fhleeijedtveelleetgefggfehkeeljeehtdeguddvvefgnecuvehluhhsthgvrhfuihii
 vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihgrnhesrhgvthhrohhsphgvtgdrth
 hvpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehg
 uhhigidqphgrthgthhgvshesghhnuhdrohhrghdprhgtphhtthhopehirghnsehrvghtrh
 hoshhpvggtrdhtvh
X-ME-Proxy: <xmx:XoHjZ3z4nG6kN2UwXxCU4tRfHUcYBW406KWVNCbLOp6xkaGv9-YnMg>
 <xmx:XoHjZyT5qPZbRJXXtmcDL8p1CyhlCm6WHW-9j2XX5boe-VIbUU7BBg>
 <xmx:XoHjZ6YI3zvLSt50F774z1WRAgZRctJfI9aGmYIIEmS1ecq2ufHpDg>
 <xmx:XoHjZzRkYT8smNtYydpJHrV1PDMPc1SRxOb3epCaTPd4M_fzHZsZxg>
 <xmx:X4HjZ9eGhNkl8bxwAbkOq1gExgCbwNcI2EcFUb7NpzaI2zvRbljeAJuG>
Feedback-ID: id9014242:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 26 Mar 2025 00:23:58 -0400 (EDT)
From: Ian Eure <ian@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: Merge xorg configurations when extending.
Date: Tue, 25 Mar 2025 21:23:54 -0700
Message-ID: <20250326042354.14033-1-ian@HIDDEN>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=103.168.172.155; envelope-from=ian@HIDDEN;
 helo=fhigh-a4-smtp.messagingengine.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
Cc: Ian Eure <ian@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)

Configuration for xorg is embedded in the various display-manager
configuration records, and extension support is factored out into the
`handle-xorg-configuration' macro.  However, the extension mechanism replaces
the existing xorg-configuration with the supplied one, making it impossible to
compose configuration from multiple sources.  This patch adds a procedure to
merge two xorg-configuration records, and calls it within
handle-xorg-configuration, allowing the config to be built piecemeal.

* gnu/services/xorg.scm (merge-xorg-configurations): New variable.
(handle-xorg-configuration): Merge xorg configs.

Change-Id: I20e9db911eef5d4efe98fdf382f3084e4defc1ba
---
 gnu/services/xorg.scm | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index bef05b9bb9..dbd1513cc8 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -209,6 +209,34 @@ (define-record-type* <xorg-configuration>
   (server-arguments xorg-configuration-server-arguments ;list of strings
                     (default %default-xorg-server-arguments)))
 
+(define (merge-xorg-configurations a b)
+  (let ((configs (list a b)))
+    (xorg-configuration
+     (modules
+      (delete-duplicates (append-map xorg-configuration-modules configs)))
+     (fonts
+      (delete-duplicates (append-map xorg-configuration-fonts configs)))
+     (drivers
+      (delete-duplicates (append-map xorg-configuration-drivers configs)))
+     (resolutions
+      (delete-duplicates (append-map xorg-configuration-resolutions configs)))
+     (extra-config (append-map xorg-configuration-extra-config configs))
+     ;; Prefer the more recently set layout.
+     (keyboard-layout (or (xorg-configuration-keyboard-layout b)
+                          (xorg-configuration-keyboard-layout a)
+                          #f))
+     (server
+      ;; Prefer the non-default server.
+      (if (eq? xorg-server (xorg-configuration-server a))
+          (xorg-configuration-server b)
+          (xorg-configuration-server a)))
+     (server-arguments
+      ;; Prefer the non-default arguments.
+      (if (eq? %default-xorg-server-arguments
+             (xorg-configuration-server-arguments a))
+          (xorg-configuration-server-arguments b)
+          (xorg-configuration-server-arguments a))))))
+
 (define (xorg-configuration->file config)
   "Compute an Xorg configuration file corresponding to CONFIG, an
 <xorg-configuration> record."
@@ -628,10 +656,7 @@ (define-syntax handle-xorg-configuration
     ((_ configuration-record service-type-definition)
      (service-type
        (inherit service-type-definition)
-       (compose (lambda (extensions)
-                  (match extensions
-                    (() #f)
-                    ((config . _) config))))
+       (compose (cut reduce merge-xorg-configurations #f <>))
        (extend (lambda (config xorg-configuration)
                  (if xorg-configuration
                      (configuration-record
-- 
2.48.1





Acknowledgement sent to Ian Eure <ian@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#77266; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 26 Mar 2025 04:30:03 UTC

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