Subject: Re: [PATCH v6 1/3] services: greetd: Improve greeter configurations.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 06 Feb 2025 22:07:32 +0900

Hello,

muradm <[email-masked]> writes:

[...]

> +@item @code{extra-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 terminal session is graphical greeter.

Neat!  According to git-grep, the most common name for this field is
'shepherd-requirement', followed by 'shepherd-requirements'.  I think we
should standardize on the former (shepherd-requirement), as this gets
passed as the 'requirement' field value of the underlying
`shepherd-service' record.

Also, perhaps s/when terminal session is graphical greeter/when *the*
terminal session is *a* graphical greeter/ ?

The rest LGTM.  I think I'll merge it with this fixup commit of my small
cosmetic changes:

--8<---------------cut here---------------start------------->8---
2 files changed, 23 insertions(+), 18 deletions(-)
doc/guix.texi         | 33 ++++++++++++++++++---------------
gnu/services/base.scm |  8 +++++---

modified   doc/guix.texi
@@ -20571,10 +20571,11 @@ Base Services
 @item @code{greetd} (default: @code{greetd})
 The greetd package to use.
 
-@item @code{extra-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 terminal session is graphical greeter.
+@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
@@ -20606,12 +20607,13 @@ Base Services
 @end deftp
 
 @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.  Users should prefer POSIX shell commands
-like @command{bash}, which can start an actual user terminal shell, window
-manager or desktop environment with its own mechanism, which would
-be @file{~/.bashrc} in case of @command{bash}.
+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{command} (default: @code{(file-append bash "/bin/bash")})
@@ -20625,7 +20627,8 @@ Base Services
 
 @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 @file{.bashrc} or similar).
+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
@@ -20640,7 +20643,7 @@ Base Services
 
 @table @asis
 @item @code{agreety} (default: @code{greetd})
-The package with @command{agreety} command.
+The package providing the @command{agreety} command.
 
 @item @code{command} (default: @code{(greetd-user-session)})
 Command to be started by @command{agreety} on successful login, an
@@ -20693,7 +20696,7 @@ Base Services
 prepended to the mandatory part of the configuration.
 
 @item @code{wlgreet} (default: @code{wlgreet})
-The package with the @command{wlgreet} command.
+The package providing the @command{wlgreet} command.
 
 @item @code{wlgreet-configuration} (default: @code{(greetd-wlgreet-configuration)})
 Configuration of @code{wlgreet} represented
@@ -20714,7 +20717,7 @@ Base Services
    (terminals
     (list (greetd-terminal-configuration
            ;; Sway requires seatd service.
-           (extra-shepherd-requirement '(seatd))
+           (shepherd-requirement '(seatd))
            (terminal-vt "1")
            (terminal-switch #t)
            (default-session-command
@@ -20736,7 +20739,7 @@ Base Services
    (terminals
     (list (greetd-terminal-configuration
            ;; Sway requires seatd service.
-           (extra-shepherd-requirement '(seatd))
+           (shepherd-requirement '(seatd))
            (terminal-vt "1")
            (terminal-switch #t)
            (default-session-command
modified   gnu/services/base.scm
@@ -3750,7 +3750,7 @@ (define-record-type* <greetd-terminal-configuration>
   greetd-terminal-configuration make-greetd-terminal-configuration
   greetd-terminal-configuration?
   (greetd greetd-package (default greetd))
-  (extra-shepherd-requirement greetd-extra-shepherd-requirement (default '()))
+  (shepherd-requirement greetd-shepherd-requirement (default '()))
   (config-file-name greetd-config-file-name (thunked)
                     (default (default-config-file-name this-record)))
   (log-file-name greetd-log-file-name (thunked)
@@ -3875,7 +3875,9 @@ (define (greetd-pam-service config)
            pam))))))
 
 (define (greetd-run-user-activation config)
-  #~(let ((d "/run/user")) (mkdir d #o755) (chmod d #o755)))
+  #~(let ((d "/run/user"))
+      (mkdir d #o755)
+      (chmod d #o755)))
 
 (define (greetd-shepherd-services config)
   (map
@@ -3885,7 +3887,7 @@ (define (greetd-shepherd-services config)
           (greetd-conf (make-greetd-terminal-configuration-file tc))
           (greetd-log (greetd-log-file-name tc))
           (greetd-vt (greetd-terminal-vt tc))
-          (greetd-requirement (greetd-extra-shepherd-requirement tc)))
+          (greetd-requirement (greetd-shepherd-requirement tc)))
        (shepherd-service
         (documentation "Minimal and flexible login manager daemon")
         (requirement `(pam user-processes host-name udev virtual-terminal

--8<---------------cut here---------------end--------------->8---

-- 
Thanks,
Maxim