From patchwork Wed Mar 26 04:23:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Eure X-Patchwork-Id: 40828 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5E18E27BBEA; Wed, 26 Mar 2025 04:25:22 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6E50D27BBE9 for ; Wed, 26 Mar 2025 04:25:21 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1txIK9-0001Qd-Vl; Wed, 26 Mar 2025 00:25:06 -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 ) id 1txIK7-0001O1-6i for guix-patches@gnu.org; Wed, 26 Mar 2025 00:25:03 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1txIK6-0005Hf-Sg for guix-patches@gnu.org; Wed, 26 Mar 2025 00:25:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=jE66/fGQ+XwDQ+QTJXQjHC5ip0xRJPzZkR7/E2NM2BY=; b=sTp0+zpGl3A/GTciX18ZQaDkYgidfEg4DImEu1CHOy7CjTwtlK+vjKrrOeabUyvxgMwuwLqQIIfG5wH31BHX7Tne2PuzhxPYEqOZbEBoXeQy+H9/AHyEMHdE5dPaRxQm13/Ml+Y8FiVWmQHDrqYDVTF1fhd8oRPYG4tT+EUG1CXcytbShyVaMaXNDSAe66cskBqlkLKKtWHLzQqBjAnQHMPDdVKGmqoqratUc+0b8/42EaHsoFPXk15u1NBaxVYBrZ/1ykV+u7YkoVd2Po+ukkVDFP61P9FLUQNqi7ZiqswGc4yN73Qg8fWuzvZ2m2mgJsqotaF9P0Z1P8xeGjrw/Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1txIK6-0006lB-J5 for guix-patches@gnu.org; Wed, 26 Mar 2025 00:25:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77266] [PATCH] gnu: Merge xorg configurations when extending. Resent-From: Ian Eure Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Mar 2025 04:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77266 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77266@debbugs.gnu.org Cc: Ian Eure X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.174296305825915 (code B ref -1); Wed, 26 Mar 2025 04:25:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Mar 2025 04:24:18 +0000 Received: from localhost ([127.0.0.1]:40809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1txIJN-0006jr-L1 for submit@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 ) id 1txIJH-0006jU-Ci for submit@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 ) id 1txIJA-0001Jk-Kh for guix-patches@gnu.org; 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 ) id 1txIJ8-0005AK-H9 for guix-patches@gnu.org; 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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduieegheeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf evufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefkrghnucfguhhrvgcuoehirghn sehrvghtrhhoshhpvggtrdhtvheqnecuggftrfgrthhtvghrnhephfeiveeliedukeffhe fhleeijedtveelleetgefggfehkeeljeehtdeguddvvefgnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihgrnhesrhgvthhrohhsphgvtgdrth hvpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehg uhhigidqphgrthgthhgvshesghhnuhdrohhrghdprhgtphhtthhopehirghnsehrvghtrh hoshhpvggtrdhtvh X-ME-Proxy: Feedback-ID: id9014242:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 26 Mar 2025 00:23:58 -0400 (EDT) From: Ian Eure Date: Tue, 25 Mar 2025 21:23:54 -0700 Message-ID: <20250326042354.14033-1-ian@retrospec.tv> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 Received-SPF: pass client-ip=103.168.172.155; envelope-from=ian@retrospec.tv; 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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* (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 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