Message ID | 20250326042354.14033-1-ian@retrospec.tv |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> 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 <patchwork@mira.cbaines.net>; 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 <guix-patches-bounces@gnu.org>) 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 <Debian-debbugs@debbugs.gnu.org>) 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 <Debian-debbugs@debbugs.gnu.org>) 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 <Debian-debbugs@debbugs.gnu.org>) 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 <ian@retrospec.tv> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 26 Mar 2025 04:25:02 +0000 Resent-Message-ID: <handler.77266.B.174296305825915@debbugs.gnu.org> 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 <ian@retrospec.tv> 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 <debbugs-submit-bounces@debbugs.gnu.org>) 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 <ian@retrospec.tv>) 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 <ian@retrospec.tv>) 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 <ian@retrospec.tv>) 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: <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@retrospec.tv> 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 Content-Transfer-Encoding: 8bit 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: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=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 |
Series |
[bug#77266] gnu: Merge xorg configurations when extending.
|
|
Commit Message
Ian Eure
March 26, 2025, 4:23 a.m. UTC
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(-)
Comments
Hi! Ian Eure <ian@retrospec.tv> skribis: > 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 Maybe you can add a word in the relevant part of the manual to give an idea of how configs are merged. Apart from, it LGTM. I can’t think of a scenario where it would break existing config or where the current setup is preferable. Thanks! Ludo’.
Hello, just wondering, wouldn't it make sense to inherit from the previous a or b in case someone added a field to xorg-configuration and forgot to change this service? Or is there some kind of a smart way how we can in Guix ensure stuff like that is properly checked? I can see someone forgetting about stuff like that... Rutherther
Hi Rutherther, Rutherther <rutherther@ditigal.xyz> writes: > Hello, just wondering, wouldn't it make sense to inherit from > the > previous a or b in case someone added a field to > xorg-configuration and > forgot to change this service? I considered using inherit, but since every field has to be set to the combined values of both records, saw no value in doing so. In the case you outline, both inheriting and not will produce an incorrect result -- inheriting will discard all but one user-specified’s value, while not inheriting discards all user-specified value and uses the default. Both are wrong, but I think the latter is more likely to get noticed (therefore fixed). Thanks, -- Ian
Ludovic Courtès <ludo@gnu.org> writes: > Hi! > > Ian Eure <ian@retrospec.tv> skribis: > >> 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 > > Maybe you can add a word in the relevant part of the manual to > give an > idea of how configs are merged. Definitely, do you want a look at the wording, or should I write that up and merge? Will send a v2 later today. Thanks, -- Ian
Hi Rutherther, Rutherther <rutherther@ditigal.xyz> writes: > Hi, > > Ian Eure <ian@retrospec.tv> writes: > >> Any other feedback on this? Does the manual wording look good? > > I am wondering about the "and must provide a complete > configuration." > part in documentation. Is that really so after this patch? You > can still > extend with other services, no? So it doesn't seem right to me > it would > be necessary to use only set-xorg-configuration, it can be > combined with > custom service that will append parts of the config. > At least if I am not missing anything here. > > Additionally, I am wondering why do we have that limitation of > just one > usage of set-xorg-configuration. I suppose the name > 'set-xorg-configuration' > implies you set it, not append it, etc., but that's not really > true > after changes from this patch. The limitation comes from the > name of the service > that is created. You can mix `set-xorg-configuration' and service extensions, but cannot call `set-xorg-configuration' more than once. As your note, it has a fixed service name, and having more than one service with the same name causes an error. > So why not allow a new key/optional argument to set name of > the service, so that it can be used multiple times, and default > it to > 'set-xorg-configuration? On the other hand this is probably not > so > important, I personally don't really see any gain in this > set-xorg-configuration when user's can just extend the > appropriate > service instead, so it doesn't seem to me that big of a deal to > change it. I agree with the latter half of your message: allowing a service name argument makes `set-xorg-configuration' basically the same as writing a `simple-service' definition. I don’t think it’s worth doing. I’ll clarify the docs and send a v3. A thing I dislike about all this stuff is how the display managers carry the xorg configuration, vs. having an xorg service which the DMs depend on. I suppose it’s the way it is because the DMs spawn the X server process, but it feels like it should be possible to disentangle things at least a bit more than they are now. The current setup also seems to preclude usecases like running gdm locally, while using sddm as an XDMCP greeter for other systems. Thanks, -- Ian
Ludovic Courtès <ludo@gnu.org> writes: > Hi, > > Ian Eure <ian@retrospec.tv> writes: > >> Change-Id: I20e9db911eef5d4efe98fdf382f3084e4defc1ba >> + (append >> + (list (service gdm-service-type) >> + %xorg-intel-service >> + %xorg-keyboard-service) > > Nitpick: indentation is off. :-) Do you have / know of a setup for editing Guile inside the documentation? I’ve been editing in a *scheme* scratch buffer in Emacs and pasting back into the docs, but this clearly doesn’t work very well. > I think ‘delete-duplicates’ should be used for drivers, modules, > and > fonts, but not for ‘extra-config’ (which is merely a string). > > Does that make sense? Makes perfect sense, updated patch coming soon. Thanks, -- Ian
Ian Eure <ian@retrospec.tv> writes: > Do you have / know of a setup for editing Guile inside the > documentation? I’ve been editing in a *scheme* scratch buffer in > Emacs and pasting back into the docs, but this clearly doesn’t work > very well. That’s what I do as well. Low-tech, but it’s also useful to test the example beforehand. Ludo’.
Hi Ludo’, Ludovic Courtès <ludo@chbouib.org> writes: > Hi, > > Ian Eure <ian@retrospec.tv> writes: > >>> (append (list (service gdm-service-type) >>> %xorg-intel-service >>> …) >>> @dots{}) >> >> Can make these changes, but I’m curious why (append (list ...) >> ...) is >> preferred over cons*. I default to the latter, because I like >> the >> removal of the extra level of indent. > > In most of the examples in the documentation, we went for > ‘append’ > because it less obscure to a newcomer than ‘cons*’ (or ‘cons’, > even). > > That’s also what the installer generates, and ‘guix home import’ > I > believe. Makes sense. I sent a v4 with these changes and some doc rewording. Thanks, -- Ian
Hi all, Any other feedback on this, or does it look ready to push? Thanks, -- Ian
Migrated this to a Codeberg PR: https://codeberg.org/guix/guix/pulls/21
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