From patchwork Wed Jan 1 22:53:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 36358 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 979DF27BBEC; Wed, 1 Jan 2025 22:54:29 +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 3256E27BBE2 for ; Wed, 1 Jan 2025 22:54:28 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tT7bK-00014E-KN; Wed, 01 Jan 2025 17:54:06 -0500 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 1tT7bH-00013B-Pa for guix-patches@gnu.org; Wed, 01 Jan 2025 17:54:05 -0500 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 1tT7bH-0006Xm-HN; Wed, 01 Jan 2025 17:54:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=cJBhLSVcA8x0OwpvLhBQX2NHb4ZsULty4ObNuN2Q1IE=; b=G+PRtmSZPcj5bzFZdS/PCOe34n+lC7z39RBqm1CREfZ/lHOw9wTy/SZB9GGjKrHCcj1EHPz+3bIS6l3QX7/+jeOTaQGCKgP257uUFtkNa6gI9KMgJ+Bh2NTLaHfI76oy/VaHfIjVjXJ8jzh6MVfsc80u4b436GJMhUDzHbZ2sQtOHW+nqvBEAWHhk6owBJmaQ5gNVfOyH7eITL3fMvXtn+XyD4iDzwh5HX/rBzlF/daR7Gb7S5Lp4BTN0k7bzE2txz4GO/L0KMxzfavwGHwZOO4wOuBx2niEGsr8QfRwjdsq8beLw3Sn8n4FdRmb1OWDa0g7CEh+3Gq6gLbsuqFjRw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tT7bH-0001qr-Bu; Wed, 01 Jan 2025 17:54:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Wed, 01 Jan 2025 22:54:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75270 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75270@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 75270-submit@debbugs.gnu.org id=B75270.17357720117058 (code B ref 75270); Wed, 01 Jan 2025 22:54:03 +0000 Received: (at 75270) by debbugs.gnu.org; 1 Jan 2025 22:53:31 +0000 Received: from localhost ([127.0.0.1]:40811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tT7aj-0001pf-JF for submit@debbugs.gnu.org; Wed, 01 Jan 2025 17:53:31 -0500 Received: from nomad-cl1.muradm.net ([139.162.159.157]:39252) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tT7af-0001oz-9H for 75270@debbugs.gnu.org; Wed, 01 Jan 2025 17:53:27 -0500 Received: from localhost ([127.0.0.1]:50660) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1tT7Wu-0008NF-06 for 75270@debbugs.gnu.org; Wed, 01 Jan 2025 22:49:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cJBhLSVcA8x0OwpvLhBQX2NHb4ZsULty4ObNuN2Q1IE=; b=CjNw3NnwTjU53gP5j3k2bteWw+ lVg4cvEt3BNmuKWrFWbSUa/Yb5pDgKX4CmB8gnXan/sZzhnrhJC4YyOztXfNMrwf0Flef7uU8pkxj ObSuU5r2FOEyIyCtoxeab6JE96VxciVvUuyAvWAAHBcm4OXq5sBxBR1a4pM7WQrvYW4yLAqbfBaxJ UOZcequKUoPNunH68UBpcpu7xqXs+/TlxGqB2I8ZZ3mtErznTS+WJmefpqzFaFoWAqu2dku4lyOGM VANrhReKRL3FIcEG1wrZ2JjVDomjYg1Tr95Pb4ccQo5tuRK6D86VDbZaQoGrJgYeJDicBqjjeTGio JLZgze+OstNy1Y2meHApmU9trearksnn0VHi3qCC0/fzQjUVTSR2SkelJo0nxzGQoA0PuJlLQdcra 1OjpAVeT2eGqbr75GtTDo1tIAOCx5S53Y4C05Z9sSN1Bt3oEn7vveO8AJT7/Ib6SbVO5QO5mYg3xz +IyiPuHnsYn1dW27bEgvSgb1; Received: from muradm by localhost with local (Exim 4.98) (envelope-from ) id 1tT7aY-000000004fb-2CY4 for 75270@debbugs.gnu.org; Thu, 02 Jan 2025 01:53:18 +0300 From: muradm Date: Thu, 2 Jan 2025 01:53:13 +0300 Message-ID: <8ea5f949f8b473c3ec68e7d2f5f40c1152c6c631.1735771462.git.mail@muradm.net> X-Mailer: git-send-email 2.47.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 This improvement focuses on providing common user session scripts for use by multiple greeters. It also fixes incorrect use of `XDG_RUNTIME_DIR` for `wlgreet`. `wlgreet` requires compositor to run. We provide common sway based greeter script, which can be shared by other graphical greeters. * gnu/services/base.scm (): Common user session factored-out, for shared use by multiple greeters. (): Switch to common user session. (): New record, `wlgreet` color holder. (): Refactor `wlgreet` configuration. (): Switch to common user session. * gnu/tests/desktop.scm (%minimal-services): Reflect configuration changes. * doc/guix.texi (Base Services): Document refactoring changes. Change-Id: Id53d993b453f464abf842b2767ec3ce25ed4348a --- doc/guix.texi | 115 ++++++++++++------ gnu/services/base.scm | 264 ++++++++++++++++++++++-------------------- gnu/tests/desktop.scm | 14 ++- 3 files changed, 229 insertions(+), 164 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 924f13f0f6..6d0c349b1a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20510,13 +20510,21 @@ Base Services (terminal-vt "2") (default-session-command (greetd-agreety-session - (extra-env '(("MY_VAR" . "1"))) - (xdg-env? #f)))) + (command + (greetd-user-session + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))))) ;; we can use different shell instead of default bash (greetd-terminal-configuration (terminal-vt "3") (default-session-command - (greetd-agreety-session (command (file-append zsh "/bin/zsh"))))) + (greetd-agreety-session + (command + (greetd-user-session + (command (file-append zsh "/bin/zsh")) + (command-args '()) + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))))) ;; we can use any other executable command as greeter (greetd-terminal-configuration (terminal-vt "4") @@ -20584,19 +20592,20 @@ Base Services The user to use for running the greeter. @item @code{default-session-command} (default: @code{(greetd-agreety-session)}) -Can be either instance of @code{greetd-agreety-session} configuration or +Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session} or @code{gexp->script} like object to use as greeter. @end table @end deftp -@deftp {Data Type} greetd-agreety-session -Configuration record for the agreety greetd greeter. +@deftp {Data Type} greetd-user-session +Configuration record for the user session command. Greeters require user command +to be specified in some or another way. @code{greetd-user-session} provides a +common command for that. User should prefer stable shell command like @code{bash}, +which can start actual user terminal shell, window manager or desktop environment +with its own mechanism, which would be @code{~/.bashrc} in case of @code{bash}. @table @asis -@item @code{agreety} (default: @code{greetd}) -The package with @command{/bin/agreety} command. - @item @code{command} (default: @code{(file-append bash "/bin/bash")}) Command to be started by @command{/bin/agreety} on successful login. @@ -20606,6 +20615,10 @@ Base Services @item @code{extra-env} (default: @code{'()}) Extra environment variables to set on login. +@item @code{xdg-session-type} (default: @code{"tty"}) +Specify the value of @code{XDG_SESSION_TYPE}. User environment may +adapt depending on its value (normaly by @code{.bashrc} or similar). + @item @code{xdg-env?} (default: @code{#t}) If true @code{XDG_RUNTIME_DIR} and @code{XDG_SESSION_TYPE} will be set before starting command. One should note that, @code{extra-env} variables @@ -20614,60 +20627,86 @@ Base Services @end table @end deftp -@deftp {Data Type} greetd-wlgreet-session -Generic configuration record for the wlgreet greetd greeter. +@deftp {Data Type} greetd-agreety-session +Configuration record for the agreety greetd greeter. @table @asis -@item @code{wlgreet} (default: @code{wlgreet}) -The package with the @command{/bin/wlgreet} command. +@item @code{agreety} (default: @code{greetd}) +The package with @command{/bin/agreety} command. -@item @code{command} (default: @code{(file-append sway "/bin/sway")}) -Command to be started by @command{/bin/wlgreet} on successful login. +@item @code{command} (default: @code{(greetd-user-session)}) +Command to be started by @command{/bin/agreety} on successful login. +Normally should be a variation of @code{greetd-user-session}, but could +be any @code{gexp->script} like object. -@item @code{command-args} (default: @code{'()}) -Command arguments to pass to command. +@end table +@end deftp + +@deftp {Data Type} greetd-wlgreet-color + +@table @asis +@item @code{red} +Value of red. + +@item @code{green} +Value of green. + +@item @code{blue} +Value of blue. + +@item @code{opacity} +Value of opacity. + +@end table +@end deftp + +@deftp {Data Type} greetd-wlgreet-configuration +@table @asis @item @code{output-mode} (default: @code{"all"}) Option to use for @code{outputMode} in the TOML configuration file. @item @code{scale} (default: @code{1}) Option to use for @code{scale} in the TOML configuration file. -@item @code{background} (default: @code{'(0 0 0 0.9)}) +@item @code{background} (default: @code{(greetd-wlgreet-color (red 0) (green 0) (blue 0) (opacity 0.9))}) RGBA list to use as the background colour of the login prompt. -@item @code{headline} (default: @code{'(1 1 1 1)}) +@item @code{headline} (default: @code{(greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1))}) RGBA list to use as the headline colour of the UI popup. -@item @code{prompt} (default: @code{'(1 1 1 1)}) +@item @code{prompt} (default: @code{(greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1))}) RGBA list to use as the prompt colour of the UI popup. -@item @code{prompt-error} (default: @code{'(1 1 1 1)}) +@item @code{prompt-error} (default: @code{(greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1))}) RGBA list to use as the error colour of the UI popup. -@item @code{border} (default: @code{'(1 1 1 1)}) +@item @code{border} (default: @code{(greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1))}) RGBA list to use as the border colour of the UI popup. -@item @code{extra-env} (default: @code{'()}) -Extra environment variables to set on login. - @end table @end deftp @deftp {Data Type} greetd-wlgreet-sway-session -Sway-specific configuration record for the wlgreet greetd greeter. +Configuration record for the in sway wlgreet greetd greeter. @table @asis -@item @code{wlgreet-session} (default: @code{(greetd-wlgreet-session)}) -A @code{greetd-wlgreet-session} record for generic wlgreet configuration, -on top of the Sway-specific @code{greetd-wlgreet-sway-session}. - @item @code{sway} (default: @code{sway}) -The package providing the @command{/bin/sway} command. +The package with @command{/bin/sway} and @command{/bin/swaymsg} commands. -@item @code{sway-configuration} (default: #f) -File-like object providing an additional Sway configuration file to be -prepended to the mandatory part of the configuration. +@item @code{sway-config} (default: @code{(plain-file "greetd-wlgreet-sway-config" "")}) +Extra configuration for sway to be included before executing greeter. + +@item @code{wlgreet} (default: @code{wlgreet}) +The package with the @command{/bin/wlgreet} command. + +@item @code{wlgreet-config} (default: @code{(greetd-wlgreet-configuration)}) +Configuration of @code{wlgreet} represented by @code{greetd-wlgreet-configuration}. + +@item @code{command} (default: @code{(greetd-user-session)}) +Command to be started by @command{/bin/agreety} on successful login. +Normally should be a variation of @code{greetd-user-session}, but could +be any @code{gexp->script} like object. @end table @@ -20675,8 +20714,7 @@ Base Services @lisp (greetd-configuration - ;; We need to give the greeter user these permissions, otherwise - ;; Sway will crash on launch. + ;; Graphical greeter require additional group membership. (greeter-supplementary-groups (list "video" "input" "seat")) (terminals (list (greetd-terminal-configuration @@ -20685,7 +20723,10 @@ Base Services (default-session-command (greetd-wlgreet-sway-session (sway-configuration - (local-file "sway-greetd.conf")))))))) + (local-file "sway-greetd.conf")) ;; optional extra sway configuration + (command + (greetd-user-session + (xdg-session-type "wayland"))))))))) @end lisp @end deftp diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 75ce4e8fe5..b12c352954 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -16,7 +16,7 @@ ;;; Copyright © 2021 qblade ;;; Copyright © 2021 Hui Lu ;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer -;;; Copyright © 2021 muradm +;;; Copyright © 2021, 2025 muradm ;;; Copyright © 2022 Guillaume Le Vaillant ;;; Copyright © 2022 Justin Veilleux ;;; Copyright © 2022 ( @@ -274,8 +274,10 @@ (define-module (gnu services base) greetd-service-type greetd-configuration greetd-terminal-configuration + greetd-user-session greetd-agreety-session - greetd-wlgreet-session + greetd-wlgreet-color + greetd-wlgreet-configuration greetd-wlgreet-sway-session %base-services)) @@ -3381,161 +3383,175 @@ (define %qemu-static-networking ;;; greetd-service-type -- minimal and flexible login manager daemon ;;; -(define-record-type* - greetd-agreety-session make-greetd-agreety-session - greetd-agreety-session? - (agreety greetd-agreety (default greetd)) - (command greetd-agreety-command (default (file-append bash "/bin/bash"))) - (command-args greetd-agreety-command-args (default '("-l"))) - (extra-env greetd-agreety-extra-env (default '())) - (xdg-env? greetd-agreety-xdg-env? (default #t))) - -(define (greetd-agreety-tty-session-command config) - (match-record config +(define-record-type* + greetd-user-session make-greetd-user-session + greetd-user-session? + (command greetd-user-session-command (default (file-append bash "/bin/bash"))) + (command-args greetd-user-session-command-args (default '("-l"))) + (extra-env greetd-user-session-extra-env (default '())) + (xdg-session-type greetd-user-session-xdg-session-type (default "tty")) + (xdg-env? greetd-user-session-xdg-env? (default #t))) + +(define (make-greetd-user-session-command config) + (match-record config (command command-args extra-env) (program-file - "agreety-tty-session-command" + "greetd-user-session-command" #~(begin (use-modules (ice-9 match)) (for-each (match-lambda ((var . val) (setenv var val))) (quote (#$@extra-env))) (apply execl #$command #$command (list #$@command-args)))))) -(define (greetd-agreety-tty-xdg-session-command config) - (match-record config - (command command-args extra-env) +(define (make-greetd-xdg-user-session-command config) + (match-record config + (command command-args extra-env xdg-session-type) (program-file - "agreety-tty-xdg-session-command" + "greetd-xdg-user-session-command" #~(begin (use-modules (ice-9 match)) (let* ((username (getenv "USER")) (useruid (passwd:uid (getpwuid username))) (useruid (number->string useruid))) - (setenv "XDG_SESSION_TYPE" "tty") + (setenv "XDG_SESSION_TYPE" #$xdg-session-type) (setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid))) (for-each (match-lambda ((var . val) (setenv var val))) (quote (#$@extra-env))) (apply execl #$command #$command (list #$@command-args)))))) +(define-gexp-compiler (greetd-user-session-compiler + (session ) + system target) + (lower-object + ((if (greetd-user-session-xdg-env? session) + make-greetd-xdg-user-session-command + make-greetd-user-session-command) session))) + +(define-record-type* + greetd-agreety-session make-greetd-agreety-session + greetd-agreety-session? + (agreety greetd-agreety (default greetd)) + (command greetd-agreety-command (default (greetd-user-session)))) + (define-gexp-compiler (greetd-agreety-session-compiler (session ) system target) - (let ((agreety (file-append (greetd-agreety session) - "/bin/agreety")) - (command ((if (greetd-agreety-xdg-env? session) - greetd-agreety-tty-xdg-session-command - greetd-agreety-tty-session-command) - session))) + (let ((agreety (file-append (greetd-agreety session) "/bin/agreety")) + (command (greetd-agreety-command session))) (lower-object - (program-file "agreety-command" - #~(execl #$agreety #$agreety "-c" #$command))))) - -(define-record-type* - greetd-wlgreet-session make-greetd-wlgreet-session - greetd-wlgreet-session? - (wlgreet greetd-wlgreet (default wlgreet)) - (command greetd-wlgreet-command - (default (file-append sway "/bin/sway"))) - (command-args greetd-wlgreet-command-args (default '())) - (output-mode greetd-wlgreet-output-mode (default "all")) - (scale greetd-wlgreet-scale (default 1)) - (background greetd-wlgreet-background (default '(0 0 0 0.9))) - (headline greetd-wlgreet-headline (default '(1 1 1 1))) - (prompt greetd-wlgreet-prompt (default '(1 1 1 1))) - (prompt-error greetd-wlgreet-prompt-error (default '(1 1 1 1))) - (border greetd-wlgreet-border (default '(1 1 1 1))) - (extra-env greetd-wlgreet-extra-env (default '()))) - -(define (greetd-wlgreet-wayland-session-command session) - (program-file "wlgreet-session-command" - #~(let* ((username (getenv "USER")) - (useruid (number->string - (passwd:uid (getpwuid username)))) - (command #$(greetd-wlgreet-command session))) - (use-modules (ice-9 match)) - (setenv "XDG_SESSION_TYPE" "wayland") - (setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid)) - (for-each (lambda (env) (setenv (car env) (cdr env))) - '(#$@(greetd-wlgreet-extra-env session))) - (apply execl command command - (list #$@(greetd-wlgreet-command-args session)))))) - -(define (make-wlgreet-config-color section-name color) - (match color - ((red green blue opacity) - (string-append - "[" section-name "]\n" - "red = " (number->string red) "\n" - "green = " (number->string green) "\n" - "blue = " (number->string blue) "\n" - "opacity = " (number->string opacity) "\n")))) - -(define (make-wlgreet-configuration-file session) - (let ((command (greetd-wlgreet-wayland-session-command session)) - (output-mode (greetd-wlgreet-output-mode session)) - (scale (greetd-wlgreet-scale session)) - (background (greetd-wlgreet-background session)) - (headline (greetd-wlgreet-headline session)) - (prompt (greetd-wlgreet-prompt session)) - (prompt-error (greetd-wlgreet-prompt-error session)) - (border (greetd-wlgreet-border session))) - (mixed-text-file "wlgreet.toml" - "command = \"" command "\"\n" - "outputMode = \"" output-mode "\"\n" - "scale = " (number->string scale) "\n" - (apply string-append - (map (match-lambda - ((section-name . color) - (make-wlgreet-config-color section-name color))) - `(("background" . ,background) - ("headline" . ,headline) - ("prompt" . ,prompt) - ("prompt-error" . ,prompt-error) - ("border" . ,border))))))) + (program-file "agreety-wrapper" #~(execl #$agreety #$agreety "-c" #$command))))) + +(define (make-greetd-sway-greeter-command sway sway-config) + (let ((sway-bin (file-append sway "/bin/sway"))) + (program-file + "greeter-sway-command" + #~(begin + (let* ((username (getenv "USER")) + (useruid (passwd:uid (getpwuid username))) + (useruid (number->string useruid)) + ;; /run/user/ won't exist yet + ;; this will contain WAYLAND_DISPLAY socket file + ;; and log-file below + (user-xdg-runtime-dir "/tmp/greeter-xdg-rt") + (log-file (string-append (number->string (getpid)) ".log")) + (log-file (string-append user-xdg-runtime-dir "/" log-file))) + (mkdir user-xdg-runtime-dir #o700) + (setenv "XDG_RUNTIME_DIR" user-xdg-runtime-dir) + (sleep 1) ;; give time to elogind or seatd + (dup2 + (open-fdes + log-file + (logior O_CREAT O_WRONLY O_APPEND) + #o640) + 1) + (dup2 1 2) + (execl #$sway-bin #$sway-bin "-d" "-c" #$sway-config)))))) + +(define-record-type* + greetd-wlgreet-color make-greetd-wlgreet-color greetd-wlgreet-color? + (red greetd-wlgreet-color-red) + (green greetd-wlgreet-color-green) + (blue greetd-wlgreet-color-blue) + (opacity greetd-wlgreet-color-opacity)) + +(define (greetd-wlgreet-color-for-section section-name color) + (match-record color + (red green blue opacity) + (string-append + "[" section-name "]\n" + "red = " (number->string red) "\n" + "green = " (number->string green) "\n" + "blue = " (number->string blue) "\n" + "opacity = " (number->string opacity) "\n"))) + +(define-record-type* + greetd-wlgreet-configuration make-greetd-wlgreet-configuration + greetd-wlgreet-configuration? + (output-mode greetd-wlgreet-configuration-output-mode (default "all")) + (scale greetd-wlgreet-configuration-scale (default 1)) + (background greetd-wlgreet-configuration-background + (default (greetd-wlgreet-color (red 0) (green 0) (blue 0) (opacity 0.9)))) + (headline greetd-wlgreet-configuration-headline + (default (greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1)))) + (prompt greetd-wlgreet-configuration-prompt + (default (greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1)))) + (prompt-error greetd-wlgreet-configuration-prompt-error + (default (greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1)))) + (border greetd-wlgreet-configuration-border + (default (greetd-wlgreet-color (red 1) (green 1) (blue 1) (opacity 1))))) + +(define (make-greetd-wlgreet-configuration command color) + (match-record color + (output-mode scale background headline prompt prompt-error border) + (mixed-text-file + "wlgreet.toml" + "command = \"" command "\"\n" + "outputMode = \"" output-mode "\"\n" + "scale = " (number->string scale) "\n" + (apply string-append + (map (match-lambda + ((section-name . color) + (greetd-wlgreet-color-for-section section-name color))) + `(("background" . ,background) + ("headline" . ,headline) + ("prompt" . ,prompt) + ("prompt-error" . ,prompt-error) + ("border" . ,border))))))) (define-record-type* greetd-wlgreet-sway-session make-greetd-wlgreet-sway-session greetd-wlgreet-sway-session? - (wlgreet-session greetd-wlgreet-sway-session-wlgreet-session ; - (default (greetd-wlgreet-session))) - (sway greetd-wlgreet-sway-session-sway (default sway)) ; - (sway-configuration greetd-wlgreet-sway-session-sway-configuration ;file-like - (default (plain-file "wlgreet-sway-config" "")))) - -(define (make-wlgreet-sway-configuration-file session) - (let* ((wlgreet-session (greetd-wlgreet-sway-session-wlgreet-session session)) - (wlgreet-config (make-wlgreet-configuration-file wlgreet-session)) - (wlgreet (file-append (greetd-wlgreet wlgreet-session) "/bin/wlgreet")) - (sway-config (greetd-wlgreet-sway-session-sway-configuration session)) - (swaymsg (file-append (greetd-wlgreet-sway-session-sway session) - "/bin/swaymsg"))) - (mixed-text-file "wlgreet-sway.conf" - "include " sway-config "\n" - "xwayland disable\n" - "exec \"" wlgreet " --config " wlgreet-config "; " - swaymsg " exit\"\n"))) + (sway greetd-wlgreet-sway-session-sway (default sway)) + (sway-config greetd-wlgreet-sway-session-sway-config + (default (plain-file "greetd-wlgreet-sway-config" ""))) + (wlgreet greetd-wlgreet-sway-session-wlgreet (default wlgreet)) + (wlgreet-config greetd-wlgreet-sway-session-wlgreet-config + (default (greetd-wlgreet-configuration))) + (command greetd-wlgreet-sway-session-command (default (greetd-user-session)))) + +(define make-greetd-wlgreet-sway-session-sway-config + (match-lambda + (($ sway sway-config wlgreet wlgreet-config command) + (let ((wlgreet-bin (file-append wlgreet "/bin/wlgreet")) + (wlgreet-config-file + (make-greetd-wlgreet-configuration command wlgreet-config)) + (swaymsg-bin (file-append sway "/bin/swaymsg"))) + (mixed-text-file + "wlgreet-sway-config" + "include " sway-config "\n" + "xwayland disable\n" + "exec \"" wlgreet-bin " --config " wlgreet-config-file "; " swaymsg-bin " exit\"\n"))))) (define-gexp-compiler (greetd-wlgreet-sway-session-compiler (session ) system target) - (let ((sway (file-append (greetd-wlgreet-sway-session-sway session) - "/bin/sway")) - (config (make-wlgreet-sway-configuration-file session))) + (match-record session + (sway) (lower-object - (program-file "wlgreet-sway-session-command" - #~(let* ((log-file (open-output-file - (string-append "/tmp/sway-greeter." - (number->string (getpid)) - ".log"))) - (username (getenv "USER")) - (useruid (number->string (passwd:uid (getpwuid username))))) - ;; redirect stdout/err to log-file - (dup2 (fileno log-file) 1) - (dup2 1 2) - (sleep 1) ;give seatd/logind some time to start up - (setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid)) - (execl #$sway #$sway "-d" "-c" #$config)))))) + (make-greetd-sway-greeter-command + sway + (make-greetd-wlgreet-sway-session-sway-config session))))) (define-record-type* greetd-terminal-configuration make-greetd-terminal-configuration diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm index ef30442886..1693bbcebf 100644 --- a/gnu/tests/desktop.scm +++ b/gnu/tests/desktop.scm @@ -141,13 +141,21 @@ (define %minimal-services (terminal-vt "2") (default-session-command (greetd-agreety-session - (extra-env '(("MY_VAR" . "1"))) - (xdg-env? #f)))) + (command + (greetd-user-session + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))))) ;; we can use different shell instead of default bash (greetd-terminal-configuration (terminal-vt "3") (default-session-command - (greetd-agreety-session (command (file-append zsh "/bin/zsh"))))) + (greetd-agreety-session + (command + (greetd-user-session + (command (file-append zsh "/bin/zsh")) + (command-args '()) + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))))) ;; we can use any other executable command as greeter (greetd-terminal-configuration (terminal-vt "4") From patchwork Wed Jan 1 22:53:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 36359 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 0AD3F27BBE2; Wed, 1 Jan 2025 22:54:30 +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 3D47D27BBEA for ; Wed, 1 Jan 2025 22:54:29 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tT7bJ-00013F-6l; Wed, 01 Jan 2025 17:54:05 -0500 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 1tT7bG-00012Y-KD for guix-patches@gnu.org; Wed, 01 Jan 2025 17:54:02 -0500 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 1tT7bG-0006XM-CO for guix-patches@gnu.org; Wed, 01 Jan 2025 17:54:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=jPWqyNDZ8vdmjjl8ak9VhVeNS5wOIAUWfZJXHWcK5Rw=; b=RF9VhuryzioFxxIACLaTUnWrK6zTa1oH8Ogc1TtpPdq4EbOts5qEEL/GoRA2uOPlhsnHI3rXyangypSlQ2KIgQcZSYQXykMhCy6vnm4LH85bl5rtS91R0JkbVRhXRPw1PZtuF9+6bzHoa51KHtzfXxkbxrUlygeRRZwGSrXai7Z1hDVyqg2vtDgdydS2/Yl31Ne6NlfgPBRepYQFaA7p9Hz6ECz+fjMfWtkp0flIOYtxLlZHQWOmwVW+eIaJJEVtMNTbwBQmGYx+fmxBWwTzC4RA6IPChv7SKPnzn6dP3CX5ktb+AKazUWudM5iZr771moDVScOGY3Q0xbPWlxXE8g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tT7bG-0001qZ-6z; Wed, 01 Jan 2025 17:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75270] [PATCH 2/3] gnu: Add gtkgreet. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: sharlatanus@gmail.com, guix-patches@gnu.org Resent-Date: Wed, 01 Jan 2025 22:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75270 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75270@debbugs.gnu.org Cc: Sharlatan Hellseher X-Debbugs-Original-Xcc: Sharlatan Hellseher Received: via spool by 75270-submit@debbugs.gnu.org id=B75270.17357720097043 (code B ref 75270); Wed, 01 Jan 2025 22:54:02 +0000 Received: (at 75270) by debbugs.gnu.org; 1 Jan 2025 22:53:29 +0000 Received: from localhost ([127.0.0.1]:40807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tT7ai-0001pV-Eb for submit@debbugs.gnu.org; Wed, 01 Jan 2025 17:53:28 -0500 Received: from nomad-cl1.muradm.net ([139.162.159.157]:39258) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tT7af-0001p1-Jl for 75270@debbugs.gnu.org; Wed, 01 Jan 2025 17:53:27 -0500 Received: from localhost ([127.0.0.1]:55138) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1tT7Wu-0008NI-2i for 75270@debbugs.gnu.org; Wed, 01 Jan 2025 22:49:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jPWqyNDZ8vdmjjl8ak9VhVeNS5wOIAUWfZJXHWcK5Rw=; b=vkAkiFPu8yeboaCLitlDlyMmCL OZzkyZB3mZIH/tvERquwo/RirERlI1TW2xXj46ST1iCL9DjJBysDYZXQ18la4Lg176X98nv+jBKhI 45/+RRFJEd/S1bS0vfwIWbk/9WsfWv/LxqPlEgSm1chZmVz9EQd45g2O5yY8SM4MwZBt4ssWlFQoy JXtYgQP1CDTLCBHRj0m+rVJQGKVK5+yh2n26Ec7XxQP5+1tlumbpfsHZY2gZI794SPFNLlCmHFqnv P2AnavnhxeIqVpx0l4FWo5ak6W18ILfjdhlq9ZBxq4DdmA2HBvu2kONNg7sfr9rskTeluqgDvC1QP S0tNBqJjk4rIS47PIxKSqbkjhBkWj5UyYf67CWfi8wCiXGaNxEC2jMYPqy7f8dYHVY0N5Yw+snByu OnJTPkr96teDfxeKdQH35KQWqjhUKGkWQwgkPPeg0B9iOJ05cIZlezBW/AS5mNtO7G/MZsjeauxSz ZXL4yH+RmdZwkSCpT7rdOh2h; Received: from muradm by localhost with local (Exim 4.98) (envelope-from ) id 1tT7aZ-000000004fs-1N5i for 75270@debbugs.gnu.org; Thu, 02 Jan 2025 01:53:19 +0300 From: muradm Date: Thu, 2 Jan 2025 01:53:14 +0300 Message-ID: <9ce12983110cdfc1b9bc29c309aa0a639a2a0966.1735771462.git.mail@muradm.net> X-Mailer: git-send-email 2.47.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 * gnu/packages/admin.scm (gtkgreet): New variable. Change-Id: I1ba56f77dc4059ac17d1f8e9f0d89fd0f65cb008 --- gnu/packages/admin.scm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index dce93e4f3a..e28b59d51c 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -44,7 +44,7 @@ ;;; Copyright © 2021 WinterHound ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2021 Maxime Devos -;;; Copyright © 2021 muradm +;;; Copyright © 2021, 2025 muradm ;;; Copyright © 2021 pineapples ;;; Copyright © 2021 Petr Hodina ;;; Copyright © 2021-2024 Artyom V. Poptsov @@ -5827,6 +5827,29 @@ (define-public wlgreet on a GUI toolkit.") (license license:gpl3)))) +(define-public gtkgreet + (package + (name "gtkgreet") + (version "0.8") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url "https://git.sr.ht/~kennylevinsen/gtkgreet") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0bqxz39lc8vh6bkirvrbn2lgf1qz5b04lfwgp5xa1ki1bnm5i80q")))) + (build-system meson-build-system) + (native-inputs (list pkg-config scdoc)) + (inputs (list gtk+ gtk-layer-shell json-c)) + (synopsis "GTK based greeter for greetd") + (description + "GTK based greeter for greetd, to be run under cage or similar.") + (home-page "https://git.sr.ht/~kennylevinsen/gtkgreet") + (license license:gpl3+))) + (define-public libseat (package (name "libseat") From patchwork Wed Jan 1 22:53:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 36360 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 7951627BBE9; Wed, 1 Jan 2025 22:54:31 +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 63E9627BBE2 for ; Wed, 1 Jan 2025 22:54:30 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tT7bJ-00013P-Ig; Wed, 01 Jan 2025 17:54:05 -0500 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 1tT7bH-00012k-76 for guix-patches@gnu.org; Wed, 01 Jan 2025 17:54:03 -0500 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 1tT7bG-0006XW-Un; Wed, 01 Jan 2025 17:54:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=kumm07NwKd1q9BgoCMc0ce5/073p3/80Y9ltrNiedcQ=; b=fqjb3ULfyFzLeFY+8uKDcr2kdo6tuYZsicKRUryii9/WWuWDLnDss5NmuFjBVxAOwW9OimDJHU1auyx4OqU5OA5sy1sb1CHJym2P8kgki95lcpM8GW9MlNo1P/LAM8bYtodxFFbtCwE1XEGg+AbdoqMz39aH1JxWrtXPf8+yr6Vt61HpSJSeSugSC3MZ+jA9YabVFUAmkHpdcoJkiaa3fFn+PgeBdOPSj0kVJvJBqLRm7a/CP5u1hkltuucBFERPammdCcMqKwbNOC2HHalOzjDRLphdeCokEpm37yTSJWsw8nwKn1C1xk9otdqbz/wrw2h1nOomFJTZx4viEw8wIw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tT7bG-0001qh-Ot; Wed, 01 Jan 2025 17:54:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75270] [PATCH 3/3] services: greetd: Add new gtkgreet greeter. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Wed, 01 Jan 2025 22:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75270 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75270@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 75270-submit@debbugs.gnu.org id=B75270.17357720097050 (code B ref 75270); Wed, 01 Jan 2025 22:54:02 +0000 Received: (at 75270) by debbugs.gnu.org; 1 Jan 2025 22:53:29 +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 1tT7ai-0001pY-U7 for submit@debbugs.gnu.org; Wed, 01 Jan 2025 17:53:29 -0500 Received: from nomad-cl1.muradm.net ([139.162.159.157]:39268) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tT7ag-0001p2-90 for 75270@debbugs.gnu.org; Wed, 01 Jan 2025 17:53:27 -0500 Received: from localhost ([127.0.0.1]:55150) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1tT7Wv-0008NL-1i for 75270@debbugs.gnu.org; Wed, 01 Jan 2025 22:49:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=kumm07NwKd1q9BgoCMc0ce5/073p3/80Y9ltrNiedcQ=; b=a8yYA40DGC/pcs/FzPOr3GeB7r CMg8zNSW71iEdxbKdtwhYln8qT+Uanstnov/7+vB44/jFp4uRHO/P8W37hnNClX7Ku6xqHu9VkE+r 3JEThXzN48LQYz5AbSDjdB3fvLGloS/yQvihCc46raqTx/efYgoxMyvZKy/nLYOEVd9Eezz4IAjxt l4Xrww2ZMJxrr0tD0SGf8d8zgX4gI2cXPrTt824ihm6YJz5sS8Fzzg7Kr8x6XsodmfRpWWHvoHQQR 822PcbM7QMkaycfswaajCHiDi0VhDGFvHghQfQmEb444ed4cvx5Sp1eN1aRE35R51VJWnquYu7fcU x9jIGXQ4K5GzldbI5HUa8e51befCLiWHSz/J9yqgcx8I86Nju5kd752gdhl+lrjLuVPOq8H39g965 IurOapVd8R4L8otrirjtmYyPx0tvSGFWbF9TjKxdo4Sb05UsI2jHmL6reD5hH8AoVYngeRiOYWPO0 5Nl12gxRPnC6ZcqeHVF/uHHX; Received: from muradm by localhost with local (Exim 4.98) (envelope-from ) id 1tT7aa-000000004g9-0AEd for 75270@debbugs.gnu.org; Thu, 02 Jan 2025 01:53:20 +0300 From: muradm Date: Thu, 2 Jan 2025 01:53:15 +0300 Message-ID: X-Mailer: git-send-email 2.47.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 * gnu/services/base.scm (): New record, represents `gtkgreet` greeter session configuration. * doc/guix.texi (Base Services): Document new `gtkgreet` greeter. Change-Id: I0445eac35aa685d676ab7208a125e46058dc6b1b --- doc/guix.texi | 38 ++++++++++++++++++++++++++++++++++++++ gnu/services/base.scm | 31 +++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 6d0c349b1a..819d1de79f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20642,6 +20642,44 @@ Base Services @end table @end deftp +@deftp {Data Type} greetd-gtkgreet-sway-session +Configuration record for the gtkgreet greetd greeter. Can be used as +following: + +@lisp + (greetd-configuration + ;; Graphical greeter require additional group membership. + (greeter-supplementary-groups (list "video" "input" "seat")) + (terminals + (list (greetd-terminal-configuration + (terminal-vt "1") + (terminal-switch #t) + (default-session-command + (greetd-gtkgreet-sway-session + (command + (greetd-user-session + ;; signal to our .bashrc that we want wayland compositor + (xdg-session-type "wayland"))))))))) +@end lisp + +@table @asis +@item @code{sway} (default: @code{sway}) +The package with @command{/bin/sway} and @command{/bin/swaymsg} commands. + +@item @code{sway-config} (default: @code{(plain-file "greetd-wlgreet-sway-config" "")}) +Extra configuration for sway to be included before executing greeter. + +@item @code{gtkgreet} (default: @code{gtkgreet}) +The package with @command{/bin/gtkgreet} command. + +@item @code{command} (default: @code{(greetd-user-session)}) +Command to be started by @command{/bin/agreety} on successful login. +Normally should be a variation of @code{greetd-user-session}, but could +be any @code{gexp->script} like object. + +@end table +@end deftp + @deftp {Data Type} greetd-wlgreet-color @table @asis diff --git a/gnu/services/base.scm b/gnu/services/base.scm index b12c352954..444b959d2d 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -276,6 +276,7 @@ (define-module (gnu services base) greetd-terminal-configuration greetd-user-session greetd-agreety-session + greetd-gtkgreet-sway-session greetd-wlgreet-color greetd-wlgreet-configuration greetd-wlgreet-sway-session @@ -3468,6 +3469,36 @@ (define (make-greetd-sway-greeter-command sway sway-config) (dup2 1 2) (execl #$sway-bin #$sway-bin "-d" "-c" #$sway-config)))))) +(define-record-type* + greetd-gtkgreet-sway-session make-greetd-gtkgreet-sway-session + greetd-gtkgreet-sway-session? + (sway greetd-gtkgreet-sway-session-sway (default sway)) + (sway-config greetd-wlgreet-sway-session-sway-config + (default (plain-file "greetd-wlgreet-sway-config" ""))) + (gtkgreet greetd-gtkgreet-sway-session-gtkgreet (default gtkgreet)) + (command greetd-gtkgreet-sway-session-command (default (greetd-user-session)))) + +(define make-greetd-gtkgreet-sway-session-sway-config + (match-lambda + (($ sway sway-config gtkgreet command) + (let ((gtkgreet-bin (file-append gtkgreet "/bin/gtkgreet")) + (swaymsg-bin (file-append sway "/bin/swaymsg"))) + (mixed-text-file + "gtkgreet-sway-config" + "include " sway-config "\n" + "xwayland disable\n" + "exec \"" gtkgreet-bin " -l -c " command "; " swaymsg-bin " exit\"\n"))))) + +(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler + (session ) + system target) + (match-record session + (sway) + (lower-object + (make-greetd-sway-greeter-command + sway + (make-greetd-gtkgreet-sway-session-sway-config session))))) + (define-record-type* greetd-wlgreet-color make-greetd-wlgreet-color greetd-wlgreet-color? (red greetd-wlgreet-color-red)