From patchwork Sat May 11 13:26:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 64338 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 E148427BBEA; Sat, 11 May 2024 14:28:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no 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 440ED27BBE9 for ; Sat, 11 May 2024 14:28:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5mlj-00083T-LG; Sat, 11 May 2024 09:28:07 -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 1s5mlh-00081U-BJ for guix-patches@gnu.org; Sat, 11 May 2024 09:28:05 -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 1s5mlg-0001yW-6Y; Sat, 11 May 2024 09:28:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s5mle-000771-H0; Sat, 11 May 2024 09:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#68289] [PATCH v2 1/3] services: xorg: Add xorg-start-command-xinit procedure. References: <4fdf0d9993bb3375797ca807d894f66920bd81d2.1704553618.git.~@wolfsden.cz> In-Reply-To: <4fdf0d9993bb3375797ca807d894f66920bd81d2.1704553618.git.~@wolfsden.cz> Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: pelzflorian@pelzflorian.de, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Sat, 11 May 2024 13:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68289 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68289@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Florian Pelz , Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 68289-submit@debbugs.gnu.org id=B68289.171543407927320 (code B ref 68289); Sat, 11 May 2024 13:28:02 +0000 Received: (at 68289) by debbugs.gnu.org; 11 May 2024 13:27:59 +0000 Received: from localhost ([127.0.0.1]:48364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s5mlb-00076Y-49 for submit@debbugs.gnu.org; Sat, 11 May 2024 09:27:59 -0400 Received: from wolfsden.cz ([37.205.8.62]:50972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1s5mlX-00076D-Ox for 68289@debbugs.gnu.org; Sat, 11 May 2024 09:27:57 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 2655D287B77; Sat, 11 May 2024 13:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715434074; bh=kFJZSer9CFhYedqtwpROWs6QdH1hOKy/ROas61wnOO4=; h=From:To:Cc:Subject:Date; b=K6jSpn5HTSMYxLM2rf4/nc+2dh9DbcgyFnN4gsbjUir6VbCT6SpXnDAnXdYVBwNQL L+7qxPlRRFwYJ5Lt8iDQRBmf45llRyj6lU4ZRONpQtOT1usy2hPHYteQj0znPoq5NW oYez/fSb50C3VsKw3Wn4zAcFqueQcC7trcKWGOSOnyJLEVNq/otWcfaP0lVAMRz5pu eOBWbwALzORVmt4k3LO8f74z7Zg+FuNyPaNoD7WfKelYdIHkOL9bLtLx+SNlFmt4Pe 2cxziL7nL4tTCAPdnbXb55eBosjx98KWmbQFWiWn7AJJvoNQCQp2MXVhA3G2t9BFDc sSBl48PTR8B2lawJhrRIRKtn02jLNsAnxMH6qlXJM8Mpszzq7pMIJJCYhdQ3fWc+QV q1L49Al+6EQMzJ8yR3bXqYz3MaqTNGYv9i9AZAa8LVhTev7gWLco2UuYCRHBBLOX+y O9Zdr8mkPTlZ18gNMSOv5MsuecBSgItaqWVhArC0DAcROQuEw2nMQCEcEIDKpEN3ur 71NjgBS2NCZOy3zCwM2vmr3KtbaBddvfNbTCqnAjkHmMGF/VVF9Rwh4Tg0dn0hwKQQ fD45ysFjPsRskhtvxHAQwnpanSwU8TySagQFWN+dA87uiaeKzyfr1D3W7tr4u/rFrx GBHRHP9QjJ+u2cvA4zCfmz8M= Received: from localhost (unknown [193.32.127.155]) by wolfsden.cz (Postfix) with ESMTPSA id 41E802895BC; Sat, 11 May 2024 13:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715434073; bh=kFJZSer9CFhYedqtwpROWs6QdH1hOKy/ROas61wnOO4=; h=From:To:Cc:Subject:Date; b=LcSYRHtiTE7+9tQkvu+KlFaiw9PP02hf/Vh/4Lp1STJVQbD8r6vjJ30DBYavrxLcU GSAd0hKzYVcktCT82EBLMgt6dIMSXfVGiQnC8jNXY3wmxPgVZGVM2n56qhDIV1mgZY NGZCwFtsdEIQYSLxeJf2gG9j6B72Yobt9Rpm8Er9Q3oY0g9RhtR6jXlr/wk9a0c15k nZHp38aigeOZLRGHkv+7640259sPaRLiHPnEEvDJNT2+7KBiUxS+SNi+H2VuUWqsgw PaEUyYXnu1fgGFtTW1+gU1tEFeBV/l1STTN/iLMVo5EkSHH92qpeM6xas3JWsQsSNt AqvO57XpHdbxsYGESpMtSCufmHgnVDOvhqt6WuD3O+QzLzSJ2UCczjAjk9a1CwvunW iUzl/M9LWPTkbyuHl5VBgyqJOt/fb0dZtREXJw6WnLufQt/e1TPztmT7KorJC7lIlb i8GyLxNjY7UbkAv5DWHLDSTzq0uqRfv+NooqVW5Ui3uLPOCStW8DN+HiWMrsbFkv+d ybt9dYuKK7Op0cJJRpIGqSI7kH7j9XELv9BxvwiZgRlHq8iHpQn+q/80Br71Cvk9yL GrNXxYDVerQ+3sAwJ4V7ajXuZTM8JAa9GAikpoyxTVt1N/NpyeToiQsiZinEVwYMt0 djD2PSjRhmHPGqrsuSzZBGBw= From: Tomas Volf <~@wolfsden.cz> Date: Sat, 11 May 2024 15:26:23 +0200 Message-ID: <5197b347747fd3fb3d51a2c05b5cb676d387de8d.1715433985.git.~@wolfsden.cz> X-Mailer: git-send-email 2.41.0 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 When user does not use any desktop environment, the typical sequence is to log in and then type `startx' into the tty to get a window manager running. Most distributions do provide startx by default, but Guix has only xorg-start-command, that is not suitable for this type of task. This commit adds second procedure, xorg-start-command-xinit, that correctly picks virtual terminal to use, sets up XAUTHORITY and starts xinit with correct arguments. That should make running Guix without any desktop environment more approachable. * gnu/services/xorg.scm (xorg-start-command-xinit): New procedure. (define-module): Export it. * doc/guix.texi (X Window): Document it. Change-Id: I17cb16093d16a5c6550b1766754700d4fe014ae9 --- v2: * Use invoke instead of checked-system*. * Use file-append instead of string-append. doc/guix.texi | 18 ++++++++++ gnu/services/xorg.scm | 80 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) -- 2.41.0 diff --git a/doc/guix.texi b/doc/guix.texi index f20208f94f..c47b6fdd9c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -23561,6 +23561,24 @@ X Window Usually the X server is started by a login manager. @end deffn +@deffn {Procedure} xorg-start-command-xinit [config] +Return a @code{startx} script in which the modules, fonts, +etc. specified in @var{config}, are available. The result should be +used in place of @code{startx}. Compared to the +@code{xorg-start-command} it calls xinit, therefore it works well when +executed from tty. If you are using a desktop environment, you are +unlikely to have a need for this procedure. + +The resulting file should be invoked by user from the tty after login, +common name for the program would be @code{startx}. Convenience link +can be created by (for example) this home service: + +@lisp +(simple-service 'home-files home-files-service-type + `(("bin/startx" ,(xorg-start-command-xinit)))) +@end lisp +@end deffn + @defvar screen-locker-service-type Type for a service that adds a package for a screen locker or screen diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 51d704439e..11b9c36995 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -54,11 +54,13 @@ (define-module (gnu services xorg) #:use-module (gnu packages gnome) #:use-module (gnu packages admin) #:use-module (gnu packages bash) + #:use-module (gnu packages linux) #:use-module (gnu system shadow) #:use-module (guix build-system glib-or-gtk) #:use-module (guix build-system trivial) #:use-module (guix gexp) #:use-module (guix store) + #:use-module ((guix modules) #:select (source-module-closure)) #:use-module (guix packages) #:use-module (guix derivations) #:use-module (guix records) @@ -86,6 +88,7 @@ (define-module (gnu services xorg) xorg-wrapper xorg-start-command + xorg-start-command-xinit xinitrc xorg-server-service-type @@ -416,6 +419,83 @@ (define* (xorg-start-command #:optional (config (xorg-configuration))) (program-file "startx" exp)) +(define* (xorg-start-command-xinit #:optional (config (xorg-configuration))) + "Return a @code{startx} script in which the modules, fonts, etc. specified +in @var{config}, are available. The result should be used in place of +@code{startx}. Compared to the @code{xorg-start-command} it calls xinit, +therefore it works well when executed from tty." + (define X + (xorg-wrapper config)) + + (define exp + ;; Small wrapper providing subset of functionality of typical startx + ;; script from distributions like alpine. + (with-imported-modules (source-module-closure '((guix build utils))) + #~(begin + (use-modules (guix build utils) + (ice-9 popen) + (ice-9 textual-ports)) + + (define (capture-stdout . prog+args) + (let* ((port (apply open-pipe* OPEN_READ prog+args)) + (data (get-string-all port))) + (if (= 0 (status:exit-val (close-pipe port))) + (string-trim-right data #\newline) + (error "command failed")))) + + (define (determine-unused-display n) + (let ((lock-file (format #f "/tmp/.X~a-lock" n)) + (sock-file (format #f "/tmp/.X11-unix/X~a" n))) + (if (or (file-exists? lock-file) + (false-if-exception + (eq? 'socket (stat:type (stat sock-file))))) + (determine-unused-display (+ n 1)) + (format #f ":~a" n)))) + (define (determine-vty) + (let ((fd0 (readlink "/proc/self/fd/0")) + (pref "/dev/tty")) + (if (string-prefix? pref fd0) + (string-append "vt" (substring fd0 (string-length pref))) + (error (format #f "Cannot determine VT from: ~a" fd0))))) + + (define (enable-xauth server-auth-file display) + ;; Configure and enable X authority + (or (getenv "XAUTHORITY") + (setenv "XAUTHORITY" (string-append (getenv "HOME") "/.Xauthority"))) + + (let* ((bin/xauth #$(file-append xauth "/bin/xauth")) + (bin/mcookie #$(file-append util-linux "/bin/mcookie")) + + (mcookie (capture-stdout bin/mcookie))) + (invoke bin/xauth "-qf" server-auth-file + "add" display "." mcookie) + (invoke bin/xauth "-q" + "add" display "." mcookie))) + + (let* ((xinit #$(file-append xinit "/bin/xinit")) + (display (determine-unused-display 0)) + (vty (determine-vty)) + (server-auth-port (mkstemp "/tmp/serverauth.XXXXXX")) + (server-auth-file (port-filename server-auth-port))) + (close-port server-auth-port) + (enable-xauth server-auth-file display) + (apply execl + xinit + xinit + "--" + #$X + display + vty + "-keeptty" + "-auth" server-auth-file + ;; These are set by xorg-start-command, so do the same to keep + ;; it consistent. + "-logverbose" "-verbose" "-terminate" + #$@(xorg-configuration-server-arguments config) + (cdr (command-line))))))) + + (program-file "startx" exp)) + (define* (xinitrc #:key fallback-session) "Return a system-wide xinitrc script that starts the specified X session, which should be passed to this script as the first argument. If not, the From patchwork Sat May 11 13:26:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 64339 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 B5D5F27BBE2; Sat, 11 May 2024 14:28:38 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no 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 4BB7627BBE2 for ; Sat, 11 May 2024 14:28:34 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5mlh-00081R-8m; Sat, 11 May 2024 09:28:05 -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 1s5mlg-000819-C4 for guix-patches@gnu.org; Sat, 11 May 2024 09:28:04 -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 1s5mlg-0001yV-30 for guix-patches@gnu.org; Sat, 11 May 2024 09:28:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s5mlf-000777-1p for guix-patches@gnu.org; Sat, 11 May 2024 09:28:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#68289] [PATCH v2 2/3] services: xorg: Add startx-command-service-type. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 11 May 2024 13:28:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68289 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68289@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz> Received: via spool by 68289-submit@debbugs.gnu.org id=B68289.171543408027327 (code B ref 68289); Sat, 11 May 2024 13:28:03 +0000 Received: (at 68289) by debbugs.gnu.org; 11 May 2024 13:28:00 +0000 Received: from localhost ([127.0.0.1]:48366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s5mlb-00076b-ML for submit@debbugs.gnu.org; Sat, 11 May 2024 09:28:00 -0400 Received: from wolfsden.cz ([37.205.8.62]:50974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1s5mlX-00076E-Ov for 68289@debbugs.gnu.org; Sat, 11 May 2024 09:27:57 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 67C4328885E; Sat, 11 May 2024 13:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715434074; bh=BpTPhVNFqgc8pHuYHOGv9f0jqtNiSBD4EzwDej5DyPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wzUxGu50k74AtYpm6nGCe41RMgkXZwZLLRyzq4sq3MEvM6ELSjnM9nYXd9qgqKZW1 J2K25QAySwnei8H+axAq9H7k10xnm3rsS6ow53oFCarlCQMcaUdq6At7+RrxZEICke yus5Ms6llwfRQKswrTzs0sEnlgzgTV4ymvIXkYZEplqAfq8uyj/PS2ZVq5/DGiBBfy UI3VmzODjGmvTDX17ktPTLCigjwawWNNvHua2oiHcrw/tw+e5GipaWuauE57vQt7cY gO6T7G5KyY6G2/OODOywxO6HB0qPJecQCcQSG7Gv3FzYIL1BQuat4KaldMVgP4AM9S uBnfq4xlRohHeC2GFeK0pa2zNhu4Jiy9jubKLY93UU9qWxmsWzNM6WeL3lTHcsb1E7 NSYoGLW+NdV7mUWlqAksAzhyJ4CTh5AK31EnyRGEM1xkrT5EWJSLAE82yK7cocOufI p9/KEVR00wKY4U4mZQHuRn4ONlk+U0qibQEYVy5akT6pQpHkvyrcfJAr4rVo7Jox5G jdXmRmGUWxpqxWiFdYCKOWhFpq5wtAYZa/n6bklEBNguM34R3g5y+tDxRIEKp6t4ek iAXN5SvkqBzFdDRbOAam13DITDEhBLm3iXGExGYWuzSU1gyZNCPnrFN2nQsaZwC7qH BBKsEXSqkg6t9/vUrGRFpzwQ= Received: from localhost (unknown [193.32.127.155]) by wolfsden.cz (Postfix) with ESMTPSA id 181212892C4; Sat, 11 May 2024 13:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715434074; bh=BpTPhVNFqgc8pHuYHOGv9f0jqtNiSBD4EzwDej5DyPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wzUxGu50k74AtYpm6nGCe41RMgkXZwZLLRyzq4sq3MEvM6ELSjnM9nYXd9qgqKZW1 J2K25QAySwnei8H+axAq9H7k10xnm3rsS6ow53oFCarlCQMcaUdq6At7+RrxZEICke yus5Ms6llwfRQKswrTzs0sEnlgzgTV4ymvIXkYZEplqAfq8uyj/PS2ZVq5/DGiBBfy UI3VmzODjGmvTDX17ktPTLCigjwawWNNvHua2oiHcrw/tw+e5GipaWuauE57vQt7cY gO6T7G5KyY6G2/OODOywxO6HB0qPJecQCcQSG7Gv3FzYIL1BQuat4KaldMVgP4AM9S uBnfq4xlRohHeC2GFeK0pa2zNhu4Jiy9jubKLY93UU9qWxmsWzNM6WeL3lTHcsb1E7 NSYoGLW+NdV7mUWlqAksAzhyJ4CTh5AK31EnyRGEM1xkrT5EWJSLAE82yK7cocOufI p9/KEVR00wKY4U4mZQHuRn4ONlk+U0qibQEYVy5akT6pQpHkvyrcfJAr4rVo7Jox5G jdXmRmGUWxpqxWiFdYCKOWhFpq5wtAYZa/n6bklEBNguM34R3g5y+tDxRIEKp6t4ek iAXN5SvkqBzFdDRbOAam13DITDEhBLm3iXGExGYWuzSU1gyZNCPnrFN2nQsaZwC7qH BBKsEXSqkg6t9/vUrGRFpzwQ= From: Tomas Volf <~@wolfsden.cz> Date: Sat, 11 May 2024 15:26:24 +0200 Message-ID: <147282c44ee8fb331aefd38a699b082c78e5b637.1715433985.git.~@wolfsden.cz> X-Mailer: git-send-email 2.41.0 In-Reply-To: <5197b347747fd3fb3d51a2c05b5cb676d387de8d.1715433985.git.~@wolfsden.cz> References: <5197b347747fd3fb3d51a2c05b5cb676d387de8d.1715433985.git.~@wolfsden.cz> 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 * gnu/services/xorg.scm (startx-command-profile-service), (startx-command-service-type): New variables. (define-module): Export startx-command-service-type. Change-Id: Ia2a7c3b2d5ebf6bcfff40cb2640b17d3baf6eba0 --- v2: New patch in v2. gnu/services/xorg.scm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) -- 2.41.0 diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 11b9c36995..51fa6f619c 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -91,6 +91,7 @@ (define-module (gnu services xorg) xorg-start-command-xinit xinitrc xorg-server-service-type + startx-command-service-type %default-slim-theme %default-slim-theme-name @@ -496,6 +497,39 @@ (define* (xorg-start-command-xinit #:optional (config (xorg-configuration))) (program-file "startx" exp)) +(define (startx-command-profile-service config) + ;; XXX: profile-service-type only accepts objects. + (list + (package + (name "startx-profile-package") + (version "0") + (source (xorg-start-command-xinit config)) + (build-system trivial-build-system) + (arguments + (list + #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + (let ((bin (string-append #$output "/bin"))) + (mkdir-p bin) + (symlink #$source (string-append bin "/startx")))))) + (home-page #f) + (synopsis #f) + (description #f) + (license #f)))) + +(define startx-command-service-type + (service-type + (name 'startx-command) + (extensions + (list (service-extension profile-service-type + startx-command-profile-service))) + (default-value (xorg-configuration)) + (description "Add @command{startx} to the system profile."))) + + + (define* (xinitrc #:key fallback-session) "Return a system-wide xinitrc script that starts the specified X session, which should be passed to this script as the first argument. If not, the From patchwork Sat May 11 13:26:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 64337 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 45B0727BBEA; Sat, 11 May 2024 14:28:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no 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 C61A227BBE9 for ; Sat, 11 May 2024 14:28:19 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s5mlh-00081T-AD; Sat, 11 May 2024 09:28:05 -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 1s5mlg-00081G-Lc for guix-patches@gnu.org; Sat, 11 May 2024 09:28:04 -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 1s5mlg-0001ye-Dj for guix-patches@gnu.org; Sat, 11 May 2024 09:28:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s5mlf-00077G-K9 for guix-patches@gnu.org; Sat, 11 May 2024 09:28:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#68289] [PATCH v2 3/3] home: services: Add home-startx-command-service-type. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: , guix-patches@gnu.org Resent-Date: Sat, 11 May 2024 13:28:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68289 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68289@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour X-Debbugs-Original-Xcc: ( , Andrew Tropin , Ludovic =?utf-8?q?Court=C3=A8s?= , Tanguy Le Carrour Received: via spool by 68289-submit@debbugs.gnu.org id=B68289.171543408027333 (code B ref 68289); Sat, 11 May 2024 13:28:03 +0000 Received: (at 68289) by debbugs.gnu.org; 11 May 2024 13:28:00 +0000 Received: from localhost ([127.0.0.1]:48368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s5mlc-00076i-2z for submit@debbugs.gnu.org; Sat, 11 May 2024 09:28:00 -0400 Received: from wolfsden.cz ([37.205.8.62]:50988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1s5mlX-00076F-Ow for 68289@debbugs.gnu.org; Sat, 11 May 2024 09:27:57 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 4ADFF289F0E; Sat, 11 May 2024 13:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715434075; bh=5CdtINwiPAlsYlazKNjJn7uhI7RE1DeiG6tsEtWE9SE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IG7UgVRmnZ1505niA1mTzCQDcoZj3j/2w5N6RczkJn9R+ITG89wVwre5LIsjc/KX8 7S7nrg3X1BdpnPEV3XGtBhX+LX9gu1SoKjVDPM4ddcfnKku1X7Xbow09ThyvNRUPMT 1E0LJbf55mScNNczm1+Lxmr0BTyMI4o7slYM1V3vsbfY4ti1djk2DywvAvG0FPLJwa sKV9/O4pmfgmM6jaHgDdTE3rUsHFiTzOTT6P1HSwWlWVt13VE7s/75ehOyrAwput8V uJJPpGjqLVpUnxaV8Mm0w6EEVamAFBd/YFq1gcEX+Dt0v4erWhxGKL9ChKDIeRzkeL 50pgwZz3JH3Bw2k/878vPP4ncu3jazfPAMsqWqOrY+LYi9RIa8QtPort3pZ8lTlEBz bC7NBhUjypcLnO3LaGkJiylV+gNNyiaoVCS4+L3NaZrZRrqFeO5Et1eJPhNQUIgkpc dxYGxdJ0LxsUaygxiivqlQ7LWD50mfJEt6FKbVgx19jGwYK1vstkWG4sANxsgY96Uv mC02usFTXyog8ApudWXfFo+QhmV2wyuGXylqYRqjRuVJa49c5dqkTiNrR9ztoi12Jl M1qfGehwpv+XF+pO9ZcbiUYpw8WWVCyr5bjgPNHkoFO3KKCaBt3Fho4HeyThC6BeSe FxSuKACv13k3MZlITGPhrCd4= Received: from localhost (unknown [193.32.127.155]) by wolfsden.cz (Postfix) with ESMTPSA id E12322897B5; Sat, 11 May 2024 13:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1715434075; bh=5CdtINwiPAlsYlazKNjJn7uhI7RE1DeiG6tsEtWE9SE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IG7UgVRmnZ1505niA1mTzCQDcoZj3j/2w5N6RczkJn9R+ITG89wVwre5LIsjc/KX8 7S7nrg3X1BdpnPEV3XGtBhX+LX9gu1SoKjVDPM4ddcfnKku1X7Xbow09ThyvNRUPMT 1E0LJbf55mScNNczm1+Lxmr0BTyMI4o7slYM1V3vsbfY4ti1djk2DywvAvG0FPLJwa sKV9/O4pmfgmM6jaHgDdTE3rUsHFiTzOTT6P1HSwWlWVt13VE7s/75ehOyrAwput8V uJJPpGjqLVpUnxaV8Mm0w6EEVamAFBd/YFq1gcEX+Dt0v4erWhxGKL9ChKDIeRzkeL 50pgwZz3JH3Bw2k/878vPP4ncu3jazfPAMsqWqOrY+LYi9RIa8QtPort3pZ8lTlEBz bC7NBhUjypcLnO3LaGkJiylV+gNNyiaoVCS4+L3NaZrZRrqFeO5Et1eJPhNQUIgkpc dxYGxdJ0LxsUaygxiivqlQ7LWD50mfJEt6FKbVgx19jGwYK1vstkWG4sANxsgY96Uv mC02usFTXyog8ApudWXfFo+QhmV2wyuGXylqYRqjRuVJa49c5dqkTiNrR9ztoi12Jl M1qfGehwpv+XF+pO9ZcbiUYpw8WWVCyr5bjgPNHkoFO3KKCaBt3Fho4HeyThC6BeSe FxSuKACv13k3MZlITGPhrCd4= From: Tomas Volf <~@wolfsden.cz> Date: Sat, 11 May 2024 15:26:25 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: <5197b347747fd3fb3d51a2c05b5cb676d387de8d.1715433985.git.~@wolfsden.cz> References: <5197b347747fd3fb3d51a2c05b5cb676d387de8d.1715433985.git.~@wolfsden.cz> 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 * gnu/home/services/desktop.scm (home-startx-command-service-type): New variable. (define-module): Export it. (startx-command-service-type): New service-type mapping. Change-Id: Id38b5dc7b9235e04e3a9a1b70a35b02e8fae95f0 --- v2: New patch in v2. gnu/home/services/desktop.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.41.0 diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index 91465bf168..679ba31c0f 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -23,6 +23,7 @@ (define-module (gnu home services desktop) #:use-module (gnu home services) #:use-module (gnu home services shepherd) #:use-module (gnu services configuration) + #:use-module (gnu services xorg) #:autoload (gnu packages glib) (dbus) #:autoload (gnu packages xdisorg) (redshift unclutter) #:autoload (gnu packages xorg) (setxkbmap xmodmap) @@ -43,7 +44,9 @@ (define-module (gnu home services desktop) home-unclutter-service-type home-xmodmap-configuration - home-xmodmap-service-type)) + home-xmodmap-service-type + + home-startx-command-service-type)) ;;; @@ -429,3 +432,12 @@ (define home-xmodmap-service-type (default-value (home-xmodmap-configuration)) (description "Run the @code{xmodmap} utility to modify keymaps and pointer buttons under the Xorg display server via user-defined expressions."))) + + +(define home-startx-command-service-type + (service-type + (inherit (system->home-service-type startx-command-service-type)) + (default-value (for-home (xorg-configuration))))) + +(define-service-type-mapping + startx-command-service-type => home-startx-command-service-type)