From patchwork Tue Mar 21 19:11:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Scherer X-Patchwork-Id: 11521 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 774BC16F87; Tue, 21 Mar 2023 19:13: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=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS 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 02E2416F80 for ; Tue, 21 Mar 2023 19:13:20 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pehPx-00082O-IF; Tue, 21 Mar 2023 15:13:09 -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 1pehPr-0007yn-CH for guix-patches@gnu.org; Tue, 21 Mar 2023 15:13:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pehPr-0004UY-3d for guix-patches@gnu.org; Tue, 21 Mar 2023 15:13:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pehPq-00066G-VV for guix-patches@gnu.org; Tue, 21 Mar 2023 15:13:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#61458] [PATCH v2 1/1] services: xorg-wrapper: Support xorg server input rewriting. Resent-From: Roman Scherer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 21 Mar 2023 19:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61458 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch moreinfo To: 61458@debbugs.gnu.org Cc: r0man , iyzsong@envs.net Received: via spool by 61458-submit@debbugs.gnu.org id=B61458.167942594323380 (code B ref 61458); Tue, 21 Mar 2023 19:13:02 +0000 Received: (at 61458) by debbugs.gnu.org; 21 Mar 2023 19:12:23 +0000 Received: from localhost ([127.0.0.1]:60699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pehPD-000651-B3 for submit@debbugs.gnu.org; Tue, 21 Mar 2023 15:12:23 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]:39865) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pehPA-00064c-Lx for 61458@debbugs.gnu.org; Tue, 21 Mar 2023 15:12:21 -0400 Received: by mail-wm1-f43.google.com with SMTP id i5-20020a05600c354500b003edd24054e0so4936507wmq.4 for <61458@debbugs.gnu.org>; Tue, 21 Mar 2023 12:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burningswell-com.20210112.gappssmtp.com; s=20210112; t=1679425935; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PjWUSwnBzJVkDRgazEARRYOVduH/UNd/SN8rsqwZeLU=; b=FI6HqHxuKtFxvRAG/mzoM7Q4DnfcbPZBUNJvGGdgIMNvgBje1bnKKhWKk8Cmf2BhCw Mj49QIF3USIPfmu//vR8nDLx91zNHDVOiRifW/zBU9UNXvuwdMm2ZWc7LCRXPMBHBIDn b0C5O3pdQXJDono4jqZxQx6wUSrffzO6gy1i5EamwDj9MQV1VbKgtTV6R5CG/Nc+Hj6F VSU/5abr95Qrem/Y1e37M/igqAjMPSuu/wASVervqWW+HPfZOIw4UztYBGxP7A+sYlqn MqozfVfxkJeTINJ55UXZvuWmxJcJ2VDY76aq//WBcxJjN8m7ohssnW4YEhCgp2CAHVY/ K/sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679425935; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PjWUSwnBzJVkDRgazEARRYOVduH/UNd/SN8rsqwZeLU=; b=dKqtD1D397CJVImyFFhBLphA19jwG20tfbYlzNJ4A0nSu31+282VpL3cyVQSZb8N9z Ko+cysIDceoRcU20iIqBWFlAJ32ZIlA1/cRD7NwfuKdWdaa9TIKrGHXjlvy87voYwaEg wtjE7uvH3vIlRq+0N1hKoD8KHxgJR//vMrRbpLJ3mMqQiAX9SQtSyS8m5Quim9EzrJ45 Jn0QWxfGHCDoAR4gR1vh09uwxJKGx2V3AXObQvEAmknNm//ym8a7jqu40yLZ5d/tn1wv HYR1Cy/oC6CR99fj/ezRdhfI9LNiVJVdzy41PKmXpYP4PY97lLTl8Hq1tixh+dcLzsR8 MNTg== X-Gm-Message-State: AO0yUKUBxpbsQGqV9vWd5wzRp1eS1Jg3XtIjlfKozJaJcWzJcmwvCq3Q N1MLklcobLby/Un/6q49FhZ8K7Xf31SkD9Ncvs4= X-Google-Smtp-Source: AK7set/VzpVakjSipPxSLisdxwY5Uo2Bu5d2j3GW04RPEN7i3alvrxMtEOXXzFepXThoxEYDOxfwqA== X-Received: by 2002:a7b:c845:0:b0:3ed:df74:bac7 with SMTP id c5-20020a7bc845000000b003eddf74bac7mr3094663wml.21.1679425934831; Tue, 21 Mar 2023 12:12:14 -0700 (PDT) Received: from localhost.localdomain ([2a01:598:b1af:cb71:ef:b0c6:7178:9dc0]) by smtp.gmail.com with ESMTPSA id j19-20020a05600c191300b003eddc6aa5fasm8807634wmq.39.2023.03.21.12.12.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 12:12:14 -0700 (PDT) From: Roman Scherer Date: Tue, 21 Mar 2023 20:11:41 +0100 Message-Id: X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 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 From: r0man * gnu/services/xorg.scm (xorg-wrapper): Support xorg server input rewriting. This patch adds support for proper xorg server input rewriting. It uses the lookup-package-direct-input procedure to configure the X server paths dynamically, instead of always using the hard coded package. Something like this is now possible: (define other-mesa (package-input-rewriting/spec `(("mesa" . ,(const other-mesa))))) (xorg-configuration (xorg-configuration (server (other-mesa xorg-server)))) Without this patch the X server would still be configured with mesa (causing version issues), and not with other-mesa (as per the input rewrite). --- gnu/services/xorg.scm | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index c4745cecf5..7295a45b59 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -358,6 +358,22 @@ (define (xorg-configuration-directory modules) files) #t)))) +(define (xorg-configuration-server-package-path config input path) + "Lookup the direct @var{input} in the xorg server package of @var{config} +and append @var{path} to it." + (let* ((server (xorg-configuration-server config)) + (package (lookup-package-direct-input server input))) + (when package (file-append package path)))) + +(define (xorg-configuration-dri-driver-path config) + (xorg-configuration-server-package-path config "mesa" "/lib/dri")) + +(define (xorg-configuration-xkb-bin-dir config) + (xorg-configuration-server-package-path config "xkbcomp" "/bin")) + +(define (xorg-configuration-xkb-dir config) + (xorg-configuration-server-package-path config "xkeyboard-config" "/share/X11/xkb")) + (define* (xorg-wrapper #:optional (config (xorg-configuration))) "Return a derivation that builds a script to start the X server with the given @var{config}. The resulting script should be used in place of @@ -365,12 +381,13 @@ (define* (xorg-wrapper #:optional (config (xorg-configuration))) (define exp ;; Write a small wrapper around the X server. #~(begin - (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri")) - (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin")) + (setenv "XORG_DRI_DRIVER_PATH" + #$(xorg-configuration-dri-driver-path config)) + (setenv "XKB_BINDIR" #$(xorg-configuration-xkb-bin-dir config)) (let ((X (string-append #$(xorg-configuration-server config) "/bin/X"))) (apply execl X X - "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb") + "-xkbdir" #$(xorg-configuration-xkb-dir config) "-config" #$(xorg-configuration->file config) "-configdir" #$(xorg-configuration-directory (xorg-configuration-modules config))