diff options
author | muradm <mail@muradm.net> | 2025-02-05 16:09:14 +0300 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2025-02-06 22:26:45 +0900 |
commit | ee0d1b144c1572433c9475c32c74d61c3be9c058 (patch) | |
tree | 65f04098a52a789fa37f129f59e514b032ec175f /doc | |
parent | 7786b4e477b888cda42cffd764aacea705631dc1 (diff) |
services: greetd: Improve greeter configurations.
This improvement focuses on providing common user session scripts
for use by multiple greeters. Now user session entry point is
factored out into '<greetd-user-session>', which can be reused
as is with different greeters. By default it uses 'bash' as
first user process. Then user normally starts additional programs
with '.profile' or '.bashrc'. Using 'command', 'command-args' and
'extra-env' one can specify something else, which could be
'dbus-session' wrapped process, some desktop environment or else.
While the above is possible, one is still encouraged to use
'.bashrc', '.profile' or similar.
It also fixes incorrect use of 'XDG_RUNTIME_DIR' for 'wlgreet'.
'wlgreet' requires a compositor to run. We provide common sway based
greeter script, which can be shared by other graphical greeters.
* gnu/services/base.scm (<greetd-user-session>): Common user session
factored out, for shared use by multiple greeters.
(<greetd-agreety-session>): Switch to common user session.
(<greetd-wlgreet-configuration>): Refactor 'wlgreet' configuration.
(<greetd-wlgreet-sway-session>): Switch to common user session.
(<greetd-terminal-configuration>): Add 'extra-shepherd-requirement'
for establishing configurable Shepherd service dependency.
* gnu/tests/desktop.scm (%minimal-services): Reflect configuration
changes.
* doc/guix.texi (Base Services): Document refactoring changes.
Change-Id: I9d45a592b355eb9c438be5b1d4d15555ce4956fa
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/guix.texi | 87 |
1 files changed, 62 insertions, 25 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 4fcddb98cb..00d3dba316 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20512,13 +20512,21 @@ Here is an example of switching from @code{mingetty-service-type} to (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 '("-l")) + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))))) ;; we can use any other executable command as greeter (greetd-terminal-configuration (terminal-vt "4") @@ -20563,6 +20571,12 @@ Configuration record for per terminal greetd daemon service. @item @code{greetd} (default: @code{greetd}) The greetd package to use. +@item @code{shepherd-requirement} (default: @code{'()}) +This option can be used to provide a list of additional symbols naming +Shepherd services that this service will depend on, such as +@code{'seatd} or @code{'elogind} when the terminal session is a +graphical greeter. + @item @code{config-file-name} Configuration file name to use for greetd daemon. Generally, autogenerated derivation based on @code{terminal-vt} value. @@ -20586,21 +20600,24 @@ exist. 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 the +user command to be specified in some or another way. +@code{greetd-user-session} provides a common command for that. Users +should prefer POSIX shell commands like @command{bash}, which can start +an actual user terminal shell, window manager or desktop environment +with their own mechanism, for example via @file{~/.bashrc} in the case +of 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. +Command to be started by @command{agreety} on successful login. @item @code{command-args} (default: @code{'("-l")}) Command arguments to pass to command. @@ -20608,27 +20625,37 @@ Command arguments to pass to command. @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}. The user environment may +adapt depending on its value (normally by using @file{.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 +before starting command. One should note that, @code{extra-env} variables are set right after mentioned variables, so that they can be overridden. @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 providing the @command{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{agreety} on successful login, an +instance of @code{greetd-user-session}. -@item @code{command-args} (default: @code{'()}) -Command arguments to pass to command. +@end table +@end deftp +@deftp {Data Type} greetd-wlgreet-configuration +Generic configuration record for the wlgreet greetd greeter. + +@table @asis @item @code{output-mode} (default: @code{"all"}) Option to use for @code{outputMode} in the TOML configuration file. @@ -20650,9 +20677,6 @@ RGBA list to use as the error colour of the UI popup. @item @code{border} (default: @code{'(1 1 1 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 @@ -20665,28 +20689,41 @@ 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 providing the @command{sway} command. @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{wlgreet} (default: @code{wlgreet}) +The package providing the @command{wlgreet} command. + +@item @code{wlgreet-configuration} (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{wlgreet} on successful login, an +instance of @code{greetd-user-session}. + @end table Here is an example of a greetd configuration that uses wlgreet and Sway: @lisp (greetd-configuration - ;; We need to give the greeter user these permissions, otherwise - ;; Sway will crash on launch. + ;; The graphical greeter requires additional group membership. (greeter-supplementary-groups (list "video" "input" "seat")) (terminals (list (greetd-terminal-configuration + ;; Sway requires seatd service. + (extra-shepherd-requirement '(seatd)) (terminal-vt "1") (terminal-switch #t) (default-session-command (greetd-wlgreet-sway-session (sway-configuration + ;; Optional extra sway configuration. (local-file "sway-greetd.conf")))))))) @end lisp @end deftp |