From patchwork Sun Mar 19 21:54:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Trofimov X-Patchwork-Id: 48131 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 7B11D16F2C; Sun, 19 Mar 2023 21:55:17 +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,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 D2E5316F21 for ; Sun, 19 Mar 2023 21:55:15 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pe0za-0006bG-F8; Sun, 19 Mar 2023 17:55: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 1pe0zY-0006b1-8s for guix-patches@gnu.org; Sun, 19 Mar 2023 17:55:04 -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 1pe0zX-0005E5-2b; Sun, 19 Mar 2023 17:55:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pe0zW-0003Bf-HA; Sun, 19 Mar 2023 17:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62281] [PATCH] home: Add home-xorg-server-service-type. Resent-From: Sergey Trofimov Original-Sender: "Debbugs-submit" Resent-CC: paren@disroot.org, andrew@trop.in, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Sun, 19 Mar 2023 21:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62281 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62281@debbugs.gnu.org Cc: Sergey Trofimov , paren@disroot.org, andrew@trop.in, ludo@gnu.org X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: paren@disroot.org, andrew@trop.in, ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167926285612187 (code B ref -1); Sun, 19 Mar 2023 21:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Mar 2023 21:54:16 +0000 Received: from localhost ([127.0.0.1]:52918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pe0yl-0003AU-Fo for submit@debbugs.gnu.org; Sun, 19 Mar 2023 17:54:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:40372) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pe0yj-0003AN-Pi for submit@debbugs.gnu.org; Sun, 19 Mar 2023 17:54: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 1pe0yj-0006Wm-0g for guix-patches@gnu.org; Sun, 19 Mar 2023 17:54:13 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pe0yg-000578-Hj for guix-patches@gnu.org; Sun, 19 Mar 2023 17:54:12 -0400 Received: by mail-ed1-x536.google.com with SMTP id er8so28103027edb.0 for ; Sun, 19 Mar 2023 14:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sarg.org.ru; s=google; t=1679262847; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/YGzMYlliv/SDo32YERrr8tZAxQDY1bdEEY5eNljogs=; b=Mocafhgqrjh77dt5vbASVXwZzFwIhPuaBLQpgK2T59QBoUURM34cjvC8lJA+nxHtn9 kcKJTfiCEZsLUJwCHwpJsA8Xey67dGuoMJIOgpV03SENYkNRBl20/cIoqkNNwe+6/dAw 9QsMybdTtzEj6vkSyMfzeodp/5knQiIYNxd3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679262847; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/YGzMYlliv/SDo32YERrr8tZAxQDY1bdEEY5eNljogs=; b=U9iOXJbDJTeAVCPFfBHSu+WjvusFB448PwWvpnNwcJZSwKQVCi28gAu8EHPQE25XJS IvjdbMl9xUUDmo/Mn0NjR+RUqXGkDjjzKKaByIrK7JVtu2C7d0bbfwB9bQJO+67R9WGU 6nT8AOM2Yi7D6neXlHfFelM7eiKpLa/Uru4gifqo/NE5W48FxZa353/YnJt2bcbBQZ+W sTKAXqmmtuPmf2kjyWGPFFiIPTVDzYdYoiULipXPoHfXFU4rUmPMnK6p280OIbIURiYL 4NuQQ8nLNcfahJLngw9hvFTZYo6gOSDiLx1+3jhr/fuxjYyKZebdqfqQ6bZbSat1yDp5 M36w== X-Gm-Message-State: AO0yUKV8HRAvvqFaLugguhhSHLqSHDSUJPYsS9XUDqkflgr884f4RxGC JpYa9zxyfIFCO+bxLFphOA6Zxju7ZweJImeU1EA= X-Google-Smtp-Source: AK7set//q0miyFCMkktnnk/2x80jW/ozr3A37p0BjsipL9UkPvMbEwkeOh31+5kfElTln1UsfKsGcQ== X-Received: by 2002:a17:907:1691:b0:933:48df:84db with SMTP id hc17-20020a170907169100b0093348df84dbmr5570795ejc.11.1679262847189; Sun, 19 Mar 2023 14:54:07 -0700 (PDT) Received: from localhost ([95.168.147.255]) by smtp.gmail.com with ESMTPSA id m20-20020a170906721400b00922b009fc79sm3598390ejk.164.2023.03.19.14.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 14:54:06 -0700 (PDT) From: Sergey Trofimov Date: Sun, 19 Mar 2023 22:54:09 +0100 Message-Id: <20230319215409.26714-1-sarg@sarg.org.ru> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: none client-ip=2a00:1450:4864:20::536; envelope-from=sarg@sarg.org.ru; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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 * gnu/home/services/desktop.scm (home-xorg-server-service-type): New variable. * gnu/services/xorg.scm (xorg-server-wrapper-package): Rename from xorg-server-profile-server and export. * doc/guix.texi: Document home-xorg-server-service-type. --- doc/guix.texi | 27 +++++++++++++++++++ gnu/home/services/desktop.scm | 17 +++++++++++- gnu/services/xorg.scm | 51 ++++++++++++++++++----------------- 3 files changed, 69 insertions(+), 26 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index fa9ea5a6ec..9c1df5d1b5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -42661,6 +42661,33 @@ The list of expressions to be read by @code{xmodmap} on service startup. @end table @end deftp +@defvar home-xorg-server-service-type +This is the service type to run rootless @code{xorg-server}. It takes +@code{xorg-configuration} which is used to generate the Xorg server +start script. + +@lisp +(service home-xorg-server-service-type + (xorg-configuration + (modules (list xf86-video-intel xf86-input-libinput)) + (drivers (list "intel")))) +@end lisp + +Xorg can be started after logging in the console using @command{xinit} +or @command{sx}. This could also be automated by adding auto-start +launcher to the shell's rc file. + +@lisp +(simple-service + 'sx-autostart home-bash-service-type + (home-bash-extension + (bash-profile + (list (plain-file + "bash-sx-autostart" + "[[ ! $DISPLAY && $(tty) == /dev/tty1 ]] && exec sx"))))) +@end lisp +@end defvar + @node Guix Home Services @subsection Guix Home Services diff --git a/gnu/home/services/desktop.scm b/gnu/home/services/desktop.scm index fb1cd44060..cfb2dd52fa 100644 --- a/gnu/home/services/desktop.scm +++ b/gnu/home/services/desktop.scm @@ -25,6 +25,7 @@ (define-module (gnu home services desktop) #:autoload (gnu packages glib) (dbus) #:autoload (gnu packages xdisorg) (redshift unclutter) #:autoload (gnu packages xorg) (setxkbmap xmodmap) + #:use-module (gnu services xorg) #:use-module (guix records) #:use-module (guix gexp) #:use-module (srfi srfi-1) @@ -37,7 +38,11 @@ (define-module (gnu home services desktop) home-dbus-service-type home-unclutter-configuration - home-unclutter-service-type)) + home-unclutter-service-type + + home-xorg-server-service-type) + + #:re-export (xorg-configuration)) ;;; @@ -332,3 +337,13 @@ (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-xorg-server-service-type + (service-type + (name 'xorg-server) + (extensions + (list (service-extension home-profile-service-type + (compose list xorg-server-wrapper-package)))) + (default-value (xorg-configuration)) + (description "Add @command{X} to the home profile, to be used with +@command{sx} or @command{xinit}."))) diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index c4745cecf5..0e8f352926 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -84,6 +84,7 @@ (define-module (gnu services xorg) xorg-wrapper xorg-start-command xinitrc + xorg-server-wrapper-package xorg-server-service-type %default-slim-theme @@ -506,37 +507,37 @@ (define-syntax handle-xorg-configuration (xorg-configuration xorg-configuration)) config))))))) -(define (xorg-server-profile-service config) - ;; XXX: profile-service-type only accepts objects. - (list - (package - (name "xorg-wrapper") - (version (package-version xorg-server)) - (source (xorg-wrapper config)) - (build-system trivial-build-system) - (arguments - '(#:modules ((guix build utils)) - #:builder - (begin - (use-modules (guix build utils)) - (let* ((source (assoc-ref %build-inputs "source")) - (out (assoc-ref %outputs "out")) - (bin (string-append out "/bin"))) - (mkdir-p bin) - (symlink source (string-append bin "/X")) - (symlink source (string-append bin "/Xorg")) - #t)))) - (home-page (package-home-page xorg-server)) - (synopsis (package-synopsis xorg-server)) - (description (package-description xorg-server)) - (license (package-license xorg-server))))) +(define (xorg-server-wrapper-package config) + "Return a package with @command{X} and @command{Xorg} commands launching +xorg-server with provided @var{config}." + (package + (name "xorg-wrapper") + (version (package-version xorg-server)) + (source (xorg-wrapper config)) + (build-system trivial-build-system) + (arguments + '(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let* ((source (assoc-ref %build-inputs "source")) + (out (assoc-ref %outputs "out")) + (bin (string-append out "/bin"))) + (mkdir-p bin) + (symlink source (string-append bin "/X")) + (symlink source (string-append bin "/Xorg")) + #t)))) + (home-page (package-home-page xorg-server)) + (synopsis (package-synopsis xorg-server)) + (description (package-description xorg-server)) + (license (package-license xorg-server)))) (define xorg-server-service-type (service-type (name 'xorg-server) (extensions (list (service-extension profile-service-type - xorg-server-profile-service))) + (compose list xorg-server-wrapper-package)))) (default-value (xorg-configuration)) (description "Add @command{X} to the system profile, to be used with @command{sx} or @command{xinit}.")))