[PATCH 0/3] services: greetd: Improve greeter configurations.

  • Done
  • quality assurance status badge
Details
6 participants
  • Timo Wilken
  • Ludovic Courtès
  • muradm
  • Maxim Cournoyer
  • Nicolas Graves
  • pelzflorian (Florian Pelz)
Owner
unassigned
Submitted by
muradm
Severity
normal

Debbugs page

muradm wrote 2 months ago
(address . guix-patches@gnu.org)
cover.1735771462.git.mail@muradm.net
Improves greeter configuration and adds new gtkgreet greeter.

muradm (3):
services: greetd: Improve greeter configurations.
gnu: Add gtkgreet.
services: greetd: Add new gtkgreet greeter.

doc/guix.texi | 153 +++++++++++++++------
gnu/packages/admin.scm | 25 +++-
gnu/services/base.scm | 295 ++++++++++++++++++++++++-----------------
gnu/tests/desktop.scm | 14 +-
4 files changed, 322 insertions(+), 165 deletions(-)


base-commit: 151865ada4afb70b57e5f44248fce5bda9080af5
--
2.47.1
muradm wrote 2 months ago
[PATCH 2/3] gnu: Add gtkgreet.
(address . 75270@debbugs.gnu.org)
9ce12983110cdfc1b9bc29c309aa0a639a2a0966.1735771462.git.mail@muradm.net
* gnu/packages/admin.scm (gtkgreet): New variable.

Change-Id: I1ba56f77dc4059ac17d1f8e9f0d89fd0f65cb008
---
gnu/packages/admin.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

Toggle diff (45 lines)
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 <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;; Copyright © 2021-2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -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")
--
2.47.1
muradm wrote 2 months ago
[PATCH 3/3] services: greetd: Add new gtkgreet greeter.
(address . 75270@debbugs.gnu.org)
a9e9abeaba9b341c9656bb1fca649b7a2fefa356.1735771462.git.mail@muradm.net
* gnu/services/base.scm (<greetd-gtkgreet-sway-session>): 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(+)

Toggle diff (100 lines)
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>
+ 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
+ (($ <greetd-gtkgreet-sway-session> 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 <greetd-gtkgreet-sway-session>)
+ system target)
+ (match-record session <greetd-gtkgreet-sway-session>
+ (sway)
+ (lower-object
+ (make-greetd-sway-greeter-command
+ sway
+ (make-greetd-gtkgreet-sway-session-sway-config session)))))
+
(define-record-type* <greetd-wlgreet-color>
greetd-wlgreet-color make-greetd-wlgreet-color greetd-wlgreet-color?
(red greetd-wlgreet-color-red)
--
2.47.1
muradm wrote 2 months ago
[PATCH 1/3] services: greetd: Improve greeter configurations.
(address . 75270@debbugs.gnu.org)
8ea5f949f8b473c3ec68e7d2f5f40c1152c6c631.1735771462.git.mail@muradm.net
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 (<greetd-user-session>): Common user session
factored-out, for shared use by multiple greeters.
(<greetd-agreety-session>): Switch to common user session.
(<greetd-wlgreet-color>): New record, `wlgreet` color holder.
(<greetd-wlgreet-configuration>): Refactor `wlgreet` configuration.
(<greetd-wlgreet-sway-session>): 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(-)

Toggle diff (444 lines)
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 <qblade@protonmail.com>
;;; Copyright © 2021 Hui Lu <luhuins@163.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 ( <paren@disroot.org>
@@ -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>
- 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 <greetd-agreety-session>
+(define-record-type* <greetd-user-session>
+ 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 <greetd-user-session>
(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 <greetd-agreety-session>
- (command command-args extra-env)
+(define (make-greetd-xdg-user-session-command config)
+ (match-record config <greetd-user-session>
+ (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 <greetd-user-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>
+ 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 <greetd-agreety-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>
- 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/<greeter-user-uid> 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>
+ 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 <greetd-wlgreet-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>
+ 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 <greetd-wlgreet-configuration>
+ (output-mode scale background headline prompt prompt-error border)
+ (mixed-text-file
+ "wlgreet.toml"
+ "command = \"" command "\"\n"
+ "outputMode = \"" output-mode "\"\n"
+ "scale = " (number->string scal
This message was truncated. Download the full message here.
muradm wrote 2 months ago
Re: [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations.
87msg85dxf.fsf@muradm.net
btw, this will solve 64112, 65769 and 70605.

muradm <mail@muradm.net> writes:

Toggle quote (16 lines)
> Improves greeter configuration and adds new gtkgreet greeter.
>
> muradm (3):
> services: greetd: Improve greeter configurations.
> gnu: Add gtkgreet.
> services: greetd: Add new gtkgreet greeter.
>
> doc/guix.texi | 153 +++++++++++++++------
> gnu/packages/admin.scm | 25 +++-
> gnu/services/base.scm | 295
> ++++++++++++++++++++++++-----------------
> gnu/tests/desktop.scm | 14 +-
> 4 files changed, 322 insertions(+), 165 deletions(-)
>
>
> base-commit: 151865ada4afb70b57e5f44248fce5bda9080af5
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmd3yzwACgkQ6M7O0mLO
BeLP2hAAtJV/xrG8KlZgpoQOWXq4Yd6wCycxlxHnBrpuZ8lPuc68A4Bx+CLtLG1v
SFLiJ0/KXYPWIsahLB1UBKBvNRmY1wXWi6NyLkcdxpi++P3YezV3RnBmzEXilDbP
uiJ+o3n7WQYPNIBt/ZaKXSJ+JK4E5qe2DrzHr9vklNdLxc47gy4rzpApb7IHDT3E
eo1SuA/Zg+Rk/UOOfL0Y/Aanvv6g+816G8QLTaAxAMn9owcQuIPZu/GFI1jED8w1
in7cjU3riXFlNtNFkZvAjV84uhFrTXiesbmGW1R99eAeH8SbUarYnAxgmw1gMOtB
ATRv2/rEUiGhCKeLkuMVPFng3xhIlFh5NYkBEHgWu0U9MyhlyR6M53CjQxi0FTBz
5Ycj138EmK8AIrXjvL3907SR08GgdIdFkGumRWbWInU29aniT6tkfk3y3nYVWG4Z
CxPLpkeiQW24+czRO+1rjnamYI/8puYBsVzJU6ei4BkEh2yemUgge0jdeCnt67/p
ZxI8GzQFrgD+P6aBYq5F9CDaRI/+6X7BONBLnNRt1BY2wN2gRRUZ67lVCWVPEaPX
VlRgNbSvMOh4DQMNk8Ocpfh/IOR0yhpPyZ2s9QuPAsnpWu8GorFuY8C8EI7JUrnf
aQP7BebHYBBAb9elr4o++oFbipDWmaU0F8ywlrEuE9VOm94eLDI=
=4+MS
-----END PGP SIGNATURE-----

Nicolas Graves wrote 2 months ago
Re: [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
87pll4owui.fsf@ngraves.fr
On 2025-01-02 01:53, muradm wrote:

Toggle quote (6 lines)
> 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.

[...]

Toggle quote (16 lines)
> +(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/<greeter-user-uid> 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)))

Could you explain why this is necessary? If I'm not mistaken, we didn't
used a special runtime dir in RDE, and it worked OK.

Toggle quote (11 lines)
> + (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)

Maybe also here a tiny comment on why this is better than the previous
fileno approach.

Toggle quote (2 lines)
> + (execl #$sway-bin #$sway-bin "-d" "-c" #$sway-config))))))

Also, what about the XDG_CURRENT_DESKTOP setting? Should it not be added
with xdg-env too?

--
Best regards,
Nicolas Graves
muradm wrote 2 months ago
(name . Nicolas Graves)(address . ngraves@ngraves.fr)
87ed1j6d0l.fsf@muradm.net
Nicolas Graves <ngraves@ngraves.fr> writes:

Toggle quote (37 lines)
> On 2025-01-02 01:53, muradm wrote:
>
>> 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.
>
> [...]
>
>> +(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/<greeter-user-uid> 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)))
>
> Could you explain why this is necessary? If I'm not mistaken,
> we didn't
> used a special runtime dir in RDE, and it worked OK.
>

When you start sway, it has to put WAYLAND_DISPLAY somewhere. By
default it is put to `/run/user/<uid>`. However greeter is special
limited user which is used to run without logging in. Because of
that, `/run/user/<uid>` is not created by PAM mount. For special
purpose we can use any XDG_RUNTIME_DIR. Sway does not support
specifying location of WAYLAND_DISPLAY as far as I remember (I was
opening an issue about it long ago, still was not resolved).

Toggle quote (16 lines)
>> + (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)
>
> Maybe also here a tiny comment on why this is better than the
> previous
> fileno approach.
>

dup2 takes file descriptor, open-fdes provides in one go.
Otherwise technically it does not matter how you acquire file
descriptor. This script I created long ago for greeters. This is
my recent version.

Toggle quote (7 lines)
>> + (execl #$sway-bin #$sway-bin "-d" "-c"
>> #$sway-config))))))
>
> Also, what about the XDG_CURRENT_DESKTOP setting? Should it not
> be added
> with xdg-env too?

You don't need it, to run single sway process with single greeter
application. Keep in mind that there is an "environment" to run
greeter, and another "envrionment" for user after the login. They
do not overlap. If you need XDG_CURRENT_DESKTOP for user after
login, it could be set by window manager, desktop environment,
manually in profile or manually in `extra-env` of
`greetd-user-session`.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmd4GZoACgkQ6M7O0mLO
BeJUbA/+OHhZQ4PMvGt59Wr5AFuFJrsPV48ei25m8ZX2bv1K8GHrR2ZzSGicb7o2
1h8vYVZpBRlQzVgTtgaVFvlaJuNbcBgdVSziPtxHQO900J3iQZAEHT158PQjrs6j
EBjcS5kBSl2zebasYoxi+P6dVlPana/xhS9MLv3k391Ksyy24jVYzAJh/I4uS9R+
7RpQsHUWn6xmuh/Pr04Nkg+MChLfK5oSrbOR/fKah2a5tZQRhpQLq7weeC0juP8k
QzIhPH1WP43i3nA5CmQFEC3849NNXFyodE1k8QovKWgZhRP2FEllibVMf3sUOz42
6WHZxXuyJOZvfX0trjaMomy5uJDJKjZEqdoROCqn/4bnYozRuL7Xe2R8hwh26PII
TApohuu0JUDl+c1TcVDF1qDqth7uyEqDhE9Xc2gLgi9bplQi8cn4CNGR84HlVOIy
KZeEf2kkqM+Vq6EeAEElHwB2N84/mJPJ/dVhipD4R+lYdzfEMAEEhevWmyZqUNfE
d77lu20pa5N2MRpRkRDgyvYYywIsU8viFRzC0S9+GR5PT7hluDaYSydjVV9BbfOt
k36wU8+yhl3P/17S2g4XZ0b5CsLVdifOp4l8jCm4N6aa+vlAAOocIJZMUpxRI6DG
QYptdzen2I9/TPZ5AXi4y1SxRhQRMHfN60fRgFW1jbf5bj70l9I=
=SoxH
-----END PGP SIGNATURE-----

Nicolas Graves wrote 2 months ago
(name . muradm)(address . mail@muradm.net)
87zfk6zw0t.fsf@ngraves.fr
On 2025-01-03 20:08, muradm wrote:

Toggle quote (47 lines)
> Nicolas Graves <ngraves@ngraves.fr> writes:
>
>> On 2025-01-02 01:53, muradm wrote:
>>
>>> 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.
>>
>> [...]
>>
>>> +(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/<greeter-user-uid> 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)))
>>
>> Could you explain why this is necessary? If I'm not mistaken,
>> we didn't
>> used a special runtime dir in RDE, and it worked OK.
>>
>
> When you start sway, it has to put WAYLAND_DISPLAY somewhere. By
> default it is put to `/run/user/<uid>`. However greeter is special
> limited user which is used to run without logging in. Because of
> that, `/run/user/<uid>` is not created by PAM mount. For special
> purpose we can use any XDG_RUNTIME_DIR. Sway does not support
> specifying location of WAYLAND_DISPLAY as far as I remember (I was
> opening an issue about it long ago, still was not resolved).

IIUC, it's because of PAM mount execution order that this happens? So
there's also no need for that for people that don't use PAM mount.
Maybe completing the comment as "/run/user/<greeter-user-uid> won't
exist yet due to PAM mount execution order" comment would make that
clearer?

Is the logfile here the one logging everything Sway? Could you make the
logfile configurable or is that not possible due to unguaranteed dir
existence due to PAM mount? We are making an extra effort to locate
logfiles in the same dir in RDE. (I could also try and make a symlink a
posteriori to the right dir).

--
Best regards,
Nicolas Graves
muradm wrote 2 months ago
(name . Nicolas Graves)(address . ngraves@ngraves.fr)
87pll2r99d.fsf@muradm.net
Nicolas Graves <ngraves@ngraves.fr> writes:

Toggle quote (67 lines)
> On 2025-01-03 20:08, muradm wrote:
>
>> Nicolas Graves <ngraves@ngraves.fr> writes:
>>
>>> On 2025-01-02 01:53, muradm wrote:
>>>
>>>> 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.
>>>
>>> [...]
>>>
>>>> +(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/<greeter-user-uid> 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)))
>>>
>>> Could you explain why this is necessary? If I'm not mistaken,
>>> we didn't
>>> used a special runtime dir in RDE, and it worked OK.
>>>
>>
>> When you start sway, it has to put WAYLAND_DISPLAY somewhere.
>> By
>> default it is put to `/run/user/<uid>`. However greeter is
>> special
>> limited user which is used to run without logging in. Because
>> of
>> that, `/run/user/<uid>` is not created by PAM mount. For
>> special
>> purpose we can use any XDG_RUNTIME_DIR. Sway does not support
>> specifying location of WAYLAND_DISPLAY as far as I remember (I
>> was
>> opening an issue about it long ago, still was not resolved).
>
> IIUC, it's because of PAM mount execution order that this
> happens? So
> there's also no need for that for people that don't use PAM
> mount.
> Maybe completing the comment as "/run/user/<greeter-user-uid>
> won't
> exist yet due to PAM mount execution order" comment would make
> that
> clearer?

No, that is not about order, but the fact that when greeter is
running it is not a "login action" to carry out PAM stuff. PAM
mount normally runs after user successfully passing authentication
with username and password. Greeter runs
agreet/wlgreet/gtkgreet/whatever before that.

Toggle quote (10 lines)
> Is the logfile here the one logging everything Sway? Could you
> make the
> logfile configurable or is that not possible due to unguaranteed
> dir
> existence due to PAM mount? We are making an extra effort to
> locate
> logfiles in the same dir in RDE. (I could also try and make a
> symlink a
> posteriori to the right dir).

That log file write stdout and stderr of greeter process, not the
user. At the time user passes successfull authentication, greeter
process exists, this log file completes its job. The user session
is started by greetd in different environment unrelated to
greeter's environment.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmd5OV4ACgkQ6M7O0mLO
BeIuBw/8CO4GhsnYSq+YI+e+yMN5J2sEP0PFchixWAj/sq+EfR8mMZEbrlpNoTej
Onw6mP0CAIFqySvFLpE79U6tMqDjxm8Lt+tAYi5rXV+AQCMhPdOoatEN+ET0QXb1
EUvUbghtC2crFjC/y+zxwtuLIqV8B2o9nuecHwhm+/0EIcQD0viiSAeEgv+hZ2p8
v1YNcY5mRSv0amh9u8lgsZTKF2us/UQXECwrC8bS1A4nymSCv/1isGcsK1g9Scha
6byTuNY4up9NiVzR8XqCbbJcPIVVyFeurq27Zc2NDugddgPE6VxpPsWOPdZt/8EQ
toDsKYj7Iim9Ve80Am2ZEzjLxlbQakwwuKnc+bajQ98CSXReYj6IuG/o5ChcO+op
QiXSs+mbP2O8+J2jl5SLU+I8bTaE3LOGwv1U/R038yWQln8Ok3BLIrzWqyq5YYYp
dza/ojaRYprxVWe8+9+fJlPHDs8gbw1TdyKSW4ZgnOYTRAVFR2MGD+iv7U8D9dM0
xYoGLnb5UXy/3V/TSVvQ1heCDG3RpEFAYhJkCasopMQkOUr6wNS4lUAlwNqBNvW1
/4/301DyzEleKh6DdDfMoHsBe/xcg3Seosjsrzb6I2aWrSDT1UYHmY4Y2DVJWjF6
53IW/CuWQjQUNRWEYAp1FZImj0NMXShia6FFVFFsH6X93FHnEsw=
=LgFu
-----END PGP SIGNATURE-----

Nicolas Graves wrote 2 months ago
Fwd: [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
(address . 75270@debbugs.gnu.org)
87a5c61rpz.fsf@ngraves.fr
-------------------- Start of forwarded message --------------------
From: muradm <mail@muradm.net>
To: Nicolas Graves <ngraves@ngraves.fr>
Subject: Re: [bug#75270] [PATCH 1/3] services: greetd: Improve greeter
configurations.
Date: Sat, 04 Jan 2025 16:49:09 +0300
Nicolas Graves <ngraves@ngraves.fr> writes:

Toggle quote (41 lines)
> On 2025-01-04 11:57, Nicolas Graves wrote:
>
>>> When you start sway, it has to put WAYLAND_DISPLAY somewhere.
>>> By
>>> default it is put to `/run/user/<uid>`. However greeter is
>>> special
>>> limited user which is used to run without logging in. Because
>>> of
>>> that, `/run/user/<uid>` is not created by PAM mount. For
>>> special
>>> purpose we can use any XDG_RUNTIME_DIR. Sway does not support
>>> specifying location of WAYLAND_DISPLAY as far as I remember (I
>>> was
>>> opening an issue about it long ago, still was not resolved).
>>
>> IIUC, it's because of PAM mount execution order that this
>> happens? So
>> there's also no need for that for people that don't use PAM
>> mount.
>> Maybe completing the comment as "/run/user/<greeter-user-uid>
>> won't
>> exist yet due to PAM mount execution order" comment would make
>> that
>> clearer?
>>
>> Is the logfile here the one logging everything Sway? Could you
>> make the
>> logfile configurable or is that not possible due to
>> unguaranteed dir
>> existence due to PAM mount? We are making an extra effort to
>> locate
>> logfiles in the same dir in RDE. (I could also try and make a
>> symlink a
>> posteriori to the right dir).
>
> Actually, I'm not sure I understand properly.
>
> I use agreety, then sway through ~/.profile because default is
> bash
> --login.

This is most straightforward and IMHO correct way to start
whatever user wants.

Toggle quote (3 lines)
> It works OK, because the user (not greetd) launches Sway.
> Should I care about your changes ?

No, you should not care about stuff happening in script in
`make-greetd-sway-greeter-command`. User session is started by
scripts within `make-greetd-user-session-command` and
`make-greetd-xdg-user-session-command`. Where user session command
is specified by `command`, `command-args` and `extra-env` in
`<greetd-user-session>`.

Most notable impact of this change, as noted in cover letter is
that user session now factored out. Now you are able to pass
instance of `<greetd-user-session>` to any properly defined
greeter, which are agreety, wlgreet and gtkgreet as of this
change.

I'm not RDE or guix home user, but I suppose that their entry
point should be an instance of `<greetd-user-session>` or
combination of greeter and `<greetd-user-session>`.

Toggle quote (6 lines)
> If I want to skip this bash step and make greetd launch sway
> directly,
> then I would need this script, otherwise, it is not necessary,
> am I
> right? Is there any upside / reason I should switch?

Technically, you may set `command`, `command-args` and `extra-env`
to sway, its required arguments and if necessary environment
variables of `<greetd-user-session>` instance, carefully
considering `xdg-env?` and `xdg-session-type`. But, as I mentioned
above, IMHO and from my experience, starting from
.bashrc/.profile/whatever from user home and editable by user is
more correct and straightforward.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmd5PFUACgkQ6M7O0mLO
BeKF5BAA1enfdaEPBMI+3hsk0anHaBTamvmo73JFOq16OFRzui9PpZNaCAIZnFo8
3vwnpOu4kDZEPDg0r8baBZ54c92k8nSCU3TBdMBZ3q62KYssdKs+IE+VLkWkXbaf
aRozhx1gFK5lyMjlbXhxl0LgLP7scku5BmtSDnm59YudNOUe7GwyaWTBEtCPogFD
FySR65NKOVX7xSF5bJbu+2UXq5vXX2OGbv6RkRy20gSJNdCW0Rx9H4/w06l+aUsB
D4zqq1GOEG0YaoKZfCbvV/fqwgD7P7ckodprS8jZMakx+AkGc00chreM6v3KNZRC
qGO0wMzW5eNQbT6zQPsJUGz2ml9dSmjit+SMutxByw6StSSGwRjKhtqf1cQ1y/V8
QEAOGkzDzVUZHZwUl+13ho71Qi0xc2bgW8qUjYchAECnYm+KcQ69i08A5w4Se8DX
LVhl3XUQEHGfUffzw+LMDZTJTb3tUAaKVk2XYa6S43n0NedXXyQP7QcsbXJuFxYy
GLgN8b9W7TDCz31Gb1V6j6KQmPYjhyCAq6u8oOtuqwQWMntOgntxyScLyiyQEdUh
m12rjzGiKMazpAxLyvgg2pzau1PEQvEuw4aKhaHDA9yy7/ifl5refHLB1RXNbB8u
Jn/vhmH1Y0rZ9FBQANAkRUouUTmEXx7l27VDRUItFMNH00+BDgE=
=N9Xh
-----END PGP SIGNATURE-----
-------------------- End of forwarded message --------------------

--
Best regards,
Nicolas Graves
muradm wrote 2 months ago
[PATCH v2 0/3] services: greetd: Improve greeter configurations.
(address . 75270@debbugs.gnu.org)
cover.1736009605.git.mail@muradm.net
Improves greeter configuration and adds new gtkgreet greeter.
This will solve 64112, 65769 and 70605.
This will obsolete 70318.

muradm (3):
services: greetd: Improve greeter configurations.
gnu: Add gtkgreet.
services: greetd: Add new gtkgreet greeter.

doc/guix.texi | 153 +++++++++++++++-----
gnu/packages/admin.scm | 25 +++-
gnu/services/base.scm | 307 ++++++++++++++++++++++++-----------------
gnu/tests/desktop.scm | 14 +-
4 files changed, 333 insertions(+), 166 deletions(-)


base-commit: 321edcf0744a8895690579e8a5b09b66c75d102c
--
2.47.1
muradm wrote 2 months ago
[PATCH v2 2/3] gnu: Add gtkgreet.
(address . 75270@debbugs.gnu.org)
8b80a71b3b698aebbe85c1b8cfc8c9ea38ec5ce5.1736009605.git.mail@muradm.net
* gnu/packages/admin.scm (gtkgreet): New variable.

Change-Id: I364dff198e0a01c88f5172416fb42cb410dbe48f
---
gnu/packages/admin.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 466df65dd9..a0e2ce7123 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -44,7 +44,7 @@
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;; Copyright © 2021-2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -5831,6 +5831,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")
--
2.47.1
muradm wrote 2 months ago
[PATCH v2 3/3] services: greetd: Add new gtkgreet greeter.
(address . 75270@debbugs.gnu.org)
78237de4acba4caf53dbfbfc358da29eb0bce2b5.1736009605.git.mail@muradm.net
* gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
represents `gtkgreet` greeter session configuration.
* doc/guix.texi (Base Services): Document new `gtkgreet` greeter.

Change-Id: I7af64ac6f12cc30ee358df73db57b41ac42b8aca
---
doc/guix.texi | 38 ++++++++++++++++++++++++++++++++++++++
gnu/services/base.scm | 31 +++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)

Toggle diff (100 lines)
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 4105da6c05..05c0a1a4e9 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
@@ -3470,6 +3471,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>
+ 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
+ (($ <greetd-gtkgreet-sway-session> 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 <greetd-gtkgreet-sway-session>)
+ system target)
+ (match-record session <greetd-gtkgreet-sway-session>
+ (sway)
+ (lower-object
+ (make-greetd-sway-greeter-command
+ sway
+ (make-greetd-gtkgreet-sway-session-sway-config session)))))
+
(define-record-type* <greetd-wlgreet-color>
greetd-wlgreet-color make-greetd-wlgreet-color greetd-wlgreet-color?
(red greetd-wlgreet-color-red)
--
2.47.1
muradm wrote 2 months ago
[PATCH v2 1/3] services: greetd: Improve greeter configurations.
(address . 75270@debbugs.gnu.org)
a30ec51224da27d0887de636c8fd1a83ca3ba63d.1736009605.git.mail@muradm.net
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 its 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 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-color>): New record, `wlgreet` color holder.
(<greetd-wlgreet-configuration>): Refactor `wlgreet` configuration.
(<greetd-wlgreet-sway-session>): Switch to common user session.
* gnu/tests/desktop.scm (%minimal-services): Reflect configuration
changes.
* doc/guix.texi (Base Services): Document refactoring changes.

Change-Id: Id957801bd67d24281bea6b3c554a8853f7cb55e3
---
doc/guix.texi | 115 ++++++++++++------
gnu/services/base.scm | 276 +++++++++++++++++++++++-------------------
gnu/tests/desktop.scm | 14 ++-
3 files changed, 240 insertions(+), 165 deletions(-)

Toggle diff (431 lines)
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..4105da6c05 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -16,7 +16,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hui Lu <luhuins@163.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 ( <paren@disroot.org>
@@ -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,177 @@ (define %qemu-static-networking
;;; greetd-service-type -- minimal and flexible login manager daemon
;;;
-(define-record-type* <greetd-agreety-session>
- 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 <greetd-agreety-session>
+(define-record-type* <greetd-user-session>
+ 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 <greetd-user-session>
(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 <greetd-agreety-session>
- (command command-args extra-env)
+(define (make-greetd-xdg-user-session-command config)
+ (match-record config <greetd-user-session>
+ (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 <greetd-user-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>
+ 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 <greetd-agreety-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>
- 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/<greeter-user-uid> won't exist yet
+ ;; this will contain WAYLAND_DISPLAY socket file
+ ;; and log-file below
+ (user-home-dir "/tmp/.greeter-home")
+ (user-xdg-runtime-dir (string-append user-home-dir "/run"))
+ (user-xdg-cache-dir (string-append user-home-dir "/cache"))
+ (log-file (string-append (number->string (getpid)) ".log"))
+ (log-file (string-append user-xdg-runtime-dir "/" log-file)))
+ (for-each (lambda (dir) (mkdir dir #o700))
+ (list user-home-dir
+ user-xdg-runtime-dir
+ user-xdg-cache-dir))
+ (setenv "HOME" user-home-dir)
+ (setenv "XDG_CACHE_DIR" user-xdg-cache-dir)
+ (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>
+ 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 <greetd-wlgreet-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>
+ 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
+
This message was truncated. Download the full message here.
muradm wrote 2 months ago
[PATCH v3 0/3] services: greetd: Improve greeter configurations.
(address . 75270@debbugs.gnu.org)
cover.1736358380.git.mail@muradm.net
Minor improvements and fixes compared to v2.

Improves greeter configuration and adds new gtkgreet greeter.
This will solve 64112, 65769 and 70605.
This will obsolete 70318.

muradm (3):
services: greetd: Improve greeter configurations.
gnu: Add gtkgreet.
services: greetd: Add new gtkgreet greeter.

doc/guix.texi | 161 ++++++++++++++++-----
gnu/packages/admin.scm | 43 +++++-
gnu/services/base.scm | 311 ++++++++++++++++++++++++-----------------
gnu/tests/desktop.scm | 14 +-
4 files changed, 362 insertions(+), 167 deletions(-)


base-commit: 911f205ddadf8255caa123671ccbb4efb9250ead
--
2.47.1
muradm wrote 2 months ago
[PATCH v3 1/3] services: greetd: Improve greeter configurations.
(address . 75270@debbugs.gnu.org)
d64e729e4a7dcbf973c65a7c0408c7b4d825cdcf.1736358380.git.mail@muradm.net
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 its 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 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-color>): New record, `wlgreet` color holder.
(<greetd-wlgreet-configuration>): Refactor `wlgreet` configuration.
(<greetd-wlgreet-sway-session>): Switch to common user session.
* gnu/tests/desktop.scm (%minimal-services): Reflect configuration
changes.
* doc/guix.texi (Base Services): Document refactoring changes.

Change-Id: I823b5075a5a7b2db49add1128b6e6e4eb64fcfd8
---
doc/guix.texi | 115 +++++++++++------
gnu/services/base.scm | 278 +++++++++++++++++++++++-------------------
gnu/tests/desktop.scm | 14 ++-
3 files changed, 242 insertions(+), 165 deletions(-)

Toggle diff (432 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index caebe3b03c..ba7b1761c3 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..b6d5e104a2 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -16,7 +16,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hui Lu <luhuins@163.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 ( <paren@disroot.org>
@@ -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,182 @@ (define %qemu-static-networking
;;; greetd-service-type -- minimal and flexible login manager daemon
;;;
-(define-record-type* <greetd-agreety-session>
- 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 <greetd-agreety-session>
+(define-record-type* <greetd-user-session>
+ 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 <greetd-user-session>
(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 <greetd-agreety-session>
- (command command-args extra-env)
+(define (make-greetd-xdg-user-session-command config)
+ (match-record config <greetd-user-session>
+ (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 <greetd-user-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>
+ 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 <greetd-agreety-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>
- 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"
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (let* ((username (getenv "USER"))
+ (user (getpwnam username))
+ (useruid (passwd:uid user))
+ (usergid (passwd:gid user))
+ (useruid-s (number->string useruid))
+ ;; /run/user/<greeter-user-uid> won't exist yet
+ ;; this will contain WAYLAND_DISPLAY socket file
+ ;; and log-file below
+ (user-home-dir "/tmp/.greeter-home")
+ (user-xdg-runtime-dir (string-append user-home-dir "/run"))
+ (user-xdg-cache-dir (string-append user-home-dir "/cache"))
+ (log-file (string-append (number->string (getpid)) ".log"))
+ (log-file (string-append user-home-dir "/" log-file)))
+ (for-each (lambda (d) (mkdir-p d) (chown d useruid usergid) (chmod d #o700))
+ (list user-home-dir
+ user-xdg-runtime-dir
+ user-xdg-cache-dir))
+ (setenv "HOME" user-home-dir)
+ (setenv "XDG_CACHE_DIR" user-xdg-cache-dir)
+ (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>
+ 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 <greetd-wlgreet-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>
+ greetd-wlgreet-configuration make-greetd-wlgreet-configuration
+ greetd-wlgreet-configuration?
+ (output-mode greetd-wlgreet-configuration-output-mode (default "all"))
+ (scale greetd
This message was truncated. Download the full message here.
muradm wrote 2 months ago
[PATCH v3 2/3] gnu: Add gtkgreet.
(address . 75270@debbugs.gnu.org)
695487839ec4cb22a445379c109ee1682deea9ad.1736358380.git.mail@muradm.net
* gnu/packages/admin.scm (gtkgreet): New variable.
(gtkgreet-adwaita-dark): New variable.

Change-Id: Ib0159b4a993113560f641b4877b826ff337e5c93
---
gnu/packages/admin.scm | 43 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)

Toggle diff (63 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 466df65dd9..42efdb1562 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -44,7 +44,7 @@
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;; Copyright © 2021-2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -5831,6 +5831,47 @@ (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 gtkgreet-adwaita-dark
+ (package
+ (inherit gtkgreet)
+ (name "gtkgreet-adwaita-dark")
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases
+ %standard-phases
+ (add-after 'install 'wrap-gtkgreet-for-theme
+ (lambda _
+ (wrap-program
+ (string-append #$output "/bin/gtkgreet")
+ '("GTK_THEME" "" = ("Adwaita:dark"))))))))
+ (inputs (modify-inputs
+ (package-inputs gtkgreet)
+ (prepend gnome-themes-extra)))))
+
(define-public libseat
(package
(name "libseat")
--
2.47.1
muradm wrote 2 months ago
[PATCH v3 3/3] services: greetd: Add new gtkgreet greeter.
(address . 75270@debbugs.gnu.org)
07537fc2b7e7c5c2c9220d88ace006e4ca140962.1736358380.git.mail@muradm.net
* gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
represents `gtkgreet` greeter session configuration.
* doc/guix.texi (Base Services): Document new `gtkgreet` greeter.

Change-Id: Idb226862bb0fc57404ebb8bd46e2192d7d4e57c6
---
doc/guix.texi | 48 +++++++++++++++++++++++++++++++++++++++++--
gnu/services/base.scm | 33 +++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 2 deletions(-)

Toggle diff (119 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index ba7b1761c3..28f94901ab 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20592,8 +20592,9 @@ Base Services
The user to use for running the greeter.
@item @code{default-session-command} (default: @code{(greetd-agreety-session)})
-Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session} or
-@code{gexp->script} like object to use as greeter.
+Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session},
+@code{greetd-gtkgreet-sway-session} or @code{gexp->script} like object to use
+as greeter.
@end table
@end deftp
@@ -20730,6 +20731,49 @@ Base Services
@end lisp
@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
+ ;; optionally use Adwaita:dark configured version
+ (gtkgreet gtkgreet-adwaita-dark)
+ (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-gtkgreet-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{gtkgreet-style} (default: @code{(plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")})
+Extra CSS stylesheet to customize GTK look.
+
+@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
+
@node Scheduled Job Execution
@subsection Scheduled Job Execution
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index b6d5e104a2..58f233770e 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -279,6 +279,7 @@ (define-module (gnu services base)
greetd-wlgreet-color
greetd-wlgreet-configuration
greetd-wlgreet-sway-session
+ greetd-gtkgreet-sway-session
%base-services))
@@ -3560,6 +3561,38 @@ (define-gexp-compiler (greetd-wlgreet-sway-session-compiler
sway
(make-greetd-wlgreet-sway-session-sway-config session)))))
+(define-record-type* <greetd-gtkgreet-sway-session>
+ 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-gtkgreet-sway-config" "")))
+ (gtkgreet greetd-gtkgreet-sway-session-gtkgreet (default gtkgreet))
+ (gtkgreet-style greetd-gtkgreet-sway-session-gtkgreet-style
+ (default (plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")))
+ (command greetd-gtkgreet-sway-session-command (default (greetd-user-session))))
+
+(define make-greetd-gtkgreet-sway-session-sway-config
+ (match-lambda
+ (($ <greetd-gtkgreet-sway-session> sway sway-config gtkgreet gtkgreet-style 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 -s " gtkgreet-style " -c " command "; " swaymsg-bin " exit\"\n")))))
+
+(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler
+ (session <greetd-gtkgreet-sway-session>)
+ system target)
+ (match-record session <greetd-gtkgreet-sway-session>
+ (sway)
+ (lower-object
+ (make-greetd-sway-greeter-command
+ sway
+ (make-greetd-gtkgreet-sway-session-sway-config session)))))
+
(define-record-type* <greetd-terminal-configuration>
greetd-terminal-configuration make-greetd-terminal-configuration
greetd-terminal-configuration?
--
2.47.1
pelzflorian (Florian Pelz) wrote 2 months ago
Re: [bug#75270] [PATCH v3 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)
87y0zjmy2w.fsf@pelzflorian.de
Thank you muradm for simplifying greetd greeters.

muradm <mail@muradm.net> writes:
Toggle quote (6 lines)
> -@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.

Could you retain the name of the existing field sway-configuration?
Using abbreviations is uncommon in Guix, I think, but more importantly
changes would need to go through a deprecation period with a news item
and such, because the Guix API is stable and we have a deprecation
policy. Also sway-configuration is used in many examples in the Guix
manual.


Toggle quote (7 lines)
> +
> +@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}.

For analogy, I would name this wlgreet-configuration.

I have not yet done a full review of your patch; it will take time; I
hope somebody else does.

Regards,
Florian
muradm wrote 2 months ago
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)
87tta5zbjp.fsf@muradm.net
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> writes:

Toggle quote (16 lines)
>> -@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.
>
> Could you retain the name of the existing field
> sway-configuration?
> Using abbreviations is uncommon in Guix, I think,
> [...]
> Also sway-configuration is used in many examples in the Guix
> manual.

I'm not sure if it is so strict, there are a lot of places where
'config' is used. Is there a guideline for naming?
On the other hand `sway-config` is used deliberately in order to
distinguish it from `<sway-configuration>` under `(gnu home
services sway)`.
Also type of value here is not a fully blown serializable data
structure, but a file like object having contents of
`sway.config`.

Toggle quote (6 lines)
> but more importantly changes would need to go through a
> deprecation
> period with a news item and such, because the Guix API is stable
> and
> we have a deprecation policy.

I don't think that it is worth it. IMHO `wlgreet` is not much in
use, since it is broken for quite time.
Is there a threshold for when we have to strictly complicate stuff
with deprecation tools?

Toggle quote (10 lines)
>> +@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}.
>
> For analogy, I would name this wlgreet-configuration.

That could be done if necessary.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmeCe8oACgkQ6M7O0mLO
BeJZ+xAAsnPRlgKLXgBRVH8HIYjihnI0UPzoPrY3+dHd93DzSSedItDYPKSnq+Bq
HMoM2JaKH1zhKB3OZN7hB4eZkpFtZpbDDwWk7k9OF4bGMQHtTBT7jguYn3y0j5j2
9afnqxkT00/N6NSWCaD5FY+a9XaKaZCwudtgUfH0Kzbj2SUSQ5+K3F2ehORFB35I
wOKQjhhsZ9iA26Mm92ieVd+mvV4lcUGym8mrWaTiRAOihyqeHMYiludx07FvDWKI
+INjUrsp4rSKEJjt4MJMAyWtHi6rzg8De0MJ+HUjSpeUaWUhUPI7ncWHw2+OVu6j
4IAkQGtd6NU2XRyIw3hqxCsw4dkjBHrJd8Cbl1hdXWjF8DiJdK7zgOaMnzfMDfFh
WVWJ5MRKeeYZicnc+xav/KlwYYmReuFf7UdTKrHdGpjLTbGHojYHc7TmPBLXijw/
j0GEf7KTOlgzRwD7dde6n8Iri76bD1l5d/Dg2xEnIaAh2hq2Phu2qAqIcTeZ0TF7
3ZNNJoi6HdWF4Rd0V6V+ndFJFJ3Hru4HL0nLgzMavwMftsq63AsuUNt/fNoUz4YD
Iq8ZxoF190CrpWXB2vl+kuibyxPTfRhIQoCoJ5Ym4PI4S5ngErlcG6GsogiP4G1z
+gCIUqarfUhIATxsUEIo/QWrAfGcS+0gC+Xn5xFlYutdPM4HiJU=
=2UV0
-----END PGP SIGNATURE-----

Ludovic Courtès wrote 1 months ago
(name . muradm)(address . mail@muradm.net)
87a5bfaqvk.fsf@gnu.org
Hi,

muradm <mail@muradm.net> skribis:

Toggle quote (20 lines)
> "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> writes:
>
>>> -@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.
>>
>> Could you retain the name of the existing field sway-configuration?
>> Using abbreviations is uncommon in Guix, I think,
>> [...]
>> Also sway-configuration is used in many examples in the Guix
>> manual.
>
> I'm not sure if it is so strict, there are a lot of places where
> 'config' is used. Is there a guideline for naming?

It is rather strict, yes. The guideline here would be:


Specifically Riastradh's Lisp Style Rules.

As for changing the name of configuration fields: this is something to
avoid because it breaks user configurations. See the guidelines under
“Services” at:


HTH!

Ludo’.
muradm wrote 1 months ago
[PATCH v4 0/3] services: greetd: Improve greeter configurations.
cover.1737900736.git.mail@muradm.net
Minor improvements and fixes compared to v3.

Improves greeter configuration and adds new gtkgreet greeter.
This will solve 64112, 65769 and 70605.
This will obsolete 70318.

muradm (3):
services: greetd: Improve greeter configurations.
gnu: Add gtkgreet.
services: greetd: Add new gtkgreet greeter.

doc/guix.texi | 161 ++++++++++++++++-----
gnu/packages/admin.scm | 43 +++++-
gnu/services/base.scm | 311 ++++++++++++++++++++++++-----------------
gnu/tests/desktop.scm | 14 +-
4 files changed, 362 insertions(+), 167 deletions(-)


base-commit: a895cc4c5bdb5d4bf8383077ef587ac18d069d7d
--
2.47.1
muradm wrote 1 months ago
[PATCH v4 2/3] gnu: Add gtkgreet.
6bb94e32e65887a796c2344cbfa8060bbf56d166.1737900736.git.mail@muradm.net
* gnu/packages/admin.scm (gtkgreet): New variable.
(gtkgreet-adwaita-dark): New variable.

Change-Id: I9f84c1011e66ae7c87191488930465685ae44569
---
gnu/packages/admin.scm | 43 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)

Toggle diff (63 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 659f7bc3bec..be6f00ce86b 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -44,7 +44,7 @@
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;; Copyright © 2021-2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -5939,6 +5939,47 @@ (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 gtkgreet-adwaita-dark
+ (package
+ (inherit gtkgreet)
+ (name "gtkgreet-adwaita-dark")
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases
+ %standard-phases
+ (add-after 'install 'wrap-gtkgreet-for-theme
+ (lambda _
+ (wrap-program
+ (string-append #$output "/bin/gtkgreet")
+ '("GTK_THEME" "" = ("Adwaita:dark"))))))))
+ (inputs (modify-inputs
+ (package-inputs gtkgreet)
+ (prepend gnome-themes-extra)))))
+
(define-public libseat
(package
(name "libseat")
--
2.47.1
muradm wrote 1 months ago
[PATCH v4 1/3] services: greetd: Improve greeter configurations.
d96bf189a980be56e8a073fd0eb2210c61d0d357.1737900736.git.mail@muradm.net
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 its 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 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-color>): New record, `wlgreet` color holder.
(<greetd-wlgreet-configuration>): Refactor `wlgreet` configuration.
(<greetd-wlgreet-sway-session>): Switch to common user session.
* gnu/tests/desktop.scm (%minimal-services): Reflect configuration
changes.
* doc/guix.texi (Base Services): Document refactoring changes.

Change-Id: I7d79f07e9aaac21673a7c84ee0f989a474d4749d
---
doc/guix.texi | 115 +++++++++++------
gnu/services/base.scm | 278 +++++++++++++++++++++++-------------------
gnu/tests/desktop.scm | 14 ++-
3 files changed, 242 insertions(+), 165 deletions(-)

Toggle diff (431 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 9a53bdcd374..d74a8938a6d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20512,13 +20512,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")
@@ -20586,19 +20594,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.
@@ -20608,6 +20617,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
@@ -20616,60 +20629,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-configuration} (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-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{/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
@@ -20677,8 +20716,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
@@ -20687,7 +20725,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 5967457002d..c6098af8f4f 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -16,7 +16,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hui Lu <luhuins@163.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 ( <paren@disroot.org>
@@ -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))
@@ -3393,161 +3395,182 @@ (define %qemu-static-networking
;;; greetd-service-type -- minimal and flexible login manager daemon
;;;
-(define-record-type* <greetd-agreety-session>
- 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 <greetd-agreety-session>
+(define-record-type* <greetd-user-session>
+ 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 <greetd-user-session>
(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 <greetd-agreety-session>
- (command command-args extra-env)
+(define (make-greetd-xdg-user-session-command config)
+ (match-record config <greetd-user-session>
+ (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 <greetd-user-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>
+ 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 <greetd-agreety-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>
- 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"
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (let* ((username (getenv "USER"))
+ (user (getpwnam username))
+ (useruid (passwd:uid user))
+ (usergid (passwd:gid user))
+ (useruid-s (number->string useruid))
+ ;; /run/user/<greeter-user-uid> won't exist yet
+ ;; this will contain WAYLAND_DISPLAY socket file
+ ;; and log-file below
+ (user-home-dir "/tmp/.greeter-home")
+ (user-xdg-runtime-dir (string-append user-home-dir "/run"))
+ (user-xdg-cache-dir (string-append user-home-dir "/cache"))
+ (log-file (string-append (number->string (getpid)) ".log"))
+ (log-file (string-append user-home-dir "/" log-file)))
+ (for-each (lambda (d) (mkdir-p d) (chown d useruid usergid) (chmod d #o700))
+ (list user-home-dir
+ user-xdg-runtime-dir
+ user-xdg-cache-dir))
+ (setenv "HOME" user-home-dir)
+ (setenv "XDG_CACHE_DIR" user-xdg-cache-dir)
+ (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>
+ 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 <greetd-wlgreet-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>
+ greetd-wlgreet-configuration make-greetd-wlgreet-configuration
+ greetd-wlgreet-configuration?
+ (output-mode greetd-wlgreet-configuration-output-mode (default "all")
This message was truncated. Download the full message here.
muradm wrote 1 months ago
[PATCH v4 3/3] services: greetd: Add new gtkgreet greeter.
d73bad8de54e28427fc4edb663b610c8a7d159cc.1737900736.git.mail@muradm.net
* gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
represents `gtkgreet` greeter session configuration.
* doc/guix.texi (Base Services): Document new `gtkgreet` greeter.

Change-Id: I10395a742fa7dee2c8ee2f92e80fe5c56a2e4fb6
---
doc/guix.texi | 48 +++++++++++++++++++++++++++++++++++++++++--
gnu/services/base.scm | 33 +++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 2 deletions(-)

Toggle diff (119 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index d74a8938a6d..b1a3558e8ff 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20594,8 +20594,9 @@ Base Services
The user to use for running the greeter.
@item @code{default-session-command} (default: @code{(greetd-agreety-session)})
-Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session} or
-@code{gexp->script} like object to use as greeter.
+Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session},
+@code{greetd-gtkgreet-sway-session} or @code{gexp->script} like object to use
+as greeter.
@end table
@end deftp
@@ -20732,6 +20733,49 @@ Base Services
@end lisp
@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
+ ;; optionally use Adwaita:dark configured version
+ (gtkgreet gtkgreet-adwaita-dark)
+ (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-configuration} (default: @code{(plain-file "greetd-gtkgreet-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{gtkgreet-style} (default: @code{(plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")})
+Extra CSS stylesheet to customize GTK look.
+
+@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
+
@node Scheduled Job Execution
@subsection Scheduled Job Execution
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index c6098af8f4f..1b46bf76a25 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -279,6 +279,7 @@ (define-module (gnu services base)
greetd-wlgreet-color
greetd-wlgreet-configuration
greetd-wlgreet-sway-session
+ greetd-gtkgreet-sway-session
%base-services))
@@ -3572,6 +3573,38 @@ (define-gexp-compiler (greetd-wlgreet-sway-session-compiler
sway
(make-greetd-wlgreet-sway-session-sway-config session)))))
+(define-record-type* <greetd-gtkgreet-sway-session>
+ greetd-gtkgreet-sway-session make-greetd-gtkgreet-sway-session
+ greetd-gtkgreet-sway-session?
+ (sway greetd-gtkgreet-sway-session-sway (default sway))
+ (sway-configuration greetd-wlgreet-sway-session-sway-configuration
+ (default (plain-file "greetd-gtkgreet-sway-config" "")))
+ (gtkgreet greetd-gtkgreet-sway-session-gtkgreet (default gtkgreet))
+ (gtkgreet-style greetd-gtkgreet-sway-session-gtkgreet-style
+ (default (plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")))
+ (command greetd-gtkgreet-sway-session-command (default (greetd-user-session))))
+
+(define make-greetd-gtkgreet-sway-session-sway-config
+ (match-lambda
+ (($ <greetd-gtkgreet-sway-session> sway sway-config gtkgreet gtkgreet-style 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 -s " gtkgreet-style " -c " command "; " swaymsg-bin " exit\"\n")))))
+
+(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler
+ (session <greetd-gtkgreet-sway-session>)
+ system target)
+ (match-record session <greetd-gtkgreet-sway-session>
+ (sway)
+ (lower-object
+ (make-greetd-sway-greeter-command
+ sway
+ (make-greetd-gtkgreet-sway-session-sway-config session)))))
+
(define-record-type* <greetd-terminal-configuration>
greetd-terminal-configuration make-greetd-terminal-configuration
greetd-terminal-configuration?
--
2.47.1
muradm wrote 1 months ago
Re: [bug#75270] [PATCH v3 1/3] services: greetd: Improve greeter configurations.
(name . Ludovic Courtès)(address . ludo@gnu.org)
875xm1sl3j.fsf@muradm.net
Hi,

Fixed in v4.

P.S. Sorry 75862, 75863, 75864 and 75865 was my bad due to missing
headers. But 75866, 75867, 75868 and 75869 should not happen.
75270@debbugs.gnu.org was included in CC. WHat do you suggest to
do with them?

--
Thanks in advance,
muradm

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (45 lines)
> Hi,
>
> muradm <mail@muradm.net> skribis:
>
>> "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
>> writes:
>>
>>>> -@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.
>>>
>>> Could you retain the name of the existing field
>>> sway-configuration?
>>> Using abbreviations is uncommon in Guix, I think,
>>> [...]
>>> Also sway-configuration is used in many examples in the Guix
>>> manual.
>>
>> I'm not sure if it is so strict, there are a lot of places
>> where
>> 'config' is used. Is there a guideline for naming?
>
> It is rather strict, yes. The guideline here would be:
>
> https://guix.gnu.org/manual/devel/en/html_node/Formatting-Code.html
>
> Specifically Riastradh's Lisp Style Rules.
>
> As for changing the name of configuration fields: this is
> something to
> avoid because it breaks user configurations. See the guidelines
> under
> “Services” at:
>
> https://guix.gnu.org/manual/devel/en/html_node/Deprecation-Policy.html
>
> HTH!
>
> Ludo’.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmeWRzAACgkQ6M7O0mLO
BeLlpxAAuzh4/oibvQxMCnnDEEurw0Ja+xYLlMyXloee2FvWQFK96hEcYzsa1/ac
BN0YsT8eAxxBovYH6j6wcFj7wHA3/HzpE14WZL16usnwoSCco546QL74jX1k01Ge
7lEIYxys/lS+uG+Lf7m/q9uPNc6aamOuYu35YGg/Tb0RfEdQk4h3CoqHoKaJhLda
UTcCsd9iVRXhy9zaETScK6cVSqlOhAhG9ER83wqRcphi9FvqlzS94xHRmxk0/v0x
J5KLA2x+BuZh/XKckreYOuW9irJLxm5AXfUaeIowcTFp1hJCsBv0H20v/k4wsYag
zl35XTHsxuHpowQelw4i9iR3vKFigSdqsr8avEGbnVNbjzsYLM54oDHhISv3aMDm
RWXyTd3FmoetpmUO0so6Ivepy6VGyCoaKT3dbqWz4wtv/EyLLEgvMba4YkDzM1JD
SH84f+9oSqXG8DQPqsNJu0dm660ItjxTHKX/+WQN+JPjIo9tjlYddTh+9/WKSHDV
aB0iv/LlxqQ8Y7SqMWMNedF9Ia52xY538zHE1VW5C0jjjvkCDupBJoeGKzZyRTDf
2S3VoL9auVEUzoSZ0Wq3qG6xPTlEoHvjj/OZpX01fXWY74xzaDzpRV03BDFeU4Ky
GaMlcdQWJ57r1H3Enwa0hg+NF+Ch2ZZGA0HqR260Rd3E9V2T138=
=uXgZ
-----END PGP SIGNATURE-----

muradm wrote 1 months ago
[PATCH v4 0/3] services: greetd: Improve greeter configurations.
cover.1737903645.git.mail@muradm.net
Minor improvements and fixes compared to v3.

Improves greeter configuration and adds new gtkgreet greeter.
This will solve 64112, 65769 and 70605.
This will obsolete 70318.

muradm (3):
services: greetd: Improve greeter configurations.
gnu: Add gtkgreet.
services: greetd: Add new gtkgreet greeter.

doc/guix.texi | 161 ++++++++++++++++-----
gnu/packages/admin.scm | 43 +++++-
gnu/services/base.scm | 311 ++++++++++++++++++++++++-----------------
gnu/tests/desktop.scm | 14 +-
4 files changed, 362 insertions(+), 167 deletions(-)


base-commit: a895cc4c5bdb5d4bf8383077ef587ac18d069d7d
--
2.47.1
muradm wrote 1 months ago
[PATCH v4 2/3] gnu: Add gtkgreet.
6bb94e32e65887a796c2344cbfa8060bbf56d166.1737903645.git.mail@muradm.net
* gnu/packages/admin.scm (gtkgreet): New variable.
(gtkgreet-adwaita-dark): New variable.

Change-Id: I9f84c1011e66ae7c87191488930465685ae44569
---
gnu/packages/admin.scm | 43 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)

Toggle diff (63 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 659f7bc3bec..be6f00ce86b 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -44,7 +44,7 @@
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;; Copyright © 2021-2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -5939,6 +5939,47 @@ (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 gtkgreet-adwaita-dark
+ (package
+ (inherit gtkgreet)
+ (name "gtkgreet-adwaita-dark")
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases
+ %standard-phases
+ (add-after 'install 'wrap-gtkgreet-for-theme
+ (lambda _
+ (wrap-program
+ (string-append #$output "/bin/gtkgreet")
+ '("GTK_THEME" "" = ("Adwaita:dark"))))))))
+ (inputs (modify-inputs
+ (package-inputs gtkgreet)
+ (prepend gnome-themes-extra)))))
+
(define-public libseat
(package
(name "libseat")
--
2.47.1
muradm wrote 1 months ago
[PATCH v4 3/3] services: greetd: Add new gtkgreet greeter.
d73bad8de54e28427fc4edb663b610c8a7d159cc.1737903645.git.mail@muradm.net
* gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
represents `gtkgreet` greeter session configuration.
* doc/guix.texi (Base Services): Document new `gtkgreet` greeter.

Change-Id: I10395a742fa7dee2c8ee2f92e80fe5c56a2e4fb6
---
doc/guix.texi | 48 +++++++++++++++++++++++++++++++++++++++++--
gnu/services/base.scm | 33 +++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 2 deletions(-)

Toggle diff (119 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index d74a8938a6d..b1a3558e8ff 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20594,8 +20594,9 @@ Base Services
The user to use for running the greeter.
@item @code{default-session-command} (default: @code{(greetd-agreety-session)})
-Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session} or
-@code{gexp->script} like object to use as greeter.
+Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session},
+@code{greetd-gtkgreet-sway-session} or @code{gexp->script} like object to use
+as greeter.
@end table
@end deftp
@@ -20732,6 +20733,49 @@ Base Services
@end lisp
@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
+ ;; optionally use Adwaita:dark configured version
+ (gtkgreet gtkgreet-adwaita-dark)
+ (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-configuration} (default: @code{(plain-file "greetd-gtkgreet-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{gtkgreet-style} (default: @code{(plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")})
+Extra CSS stylesheet to customize GTK look.
+
+@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
+
@node Scheduled Job Execution
@subsection Scheduled Job Execution
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index c6098af8f4f..1b46bf76a25 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -279,6 +279,7 @@ (define-module (gnu services base)
greetd-wlgreet-color
greetd-wlgreet-configuration
greetd-wlgreet-sway-session
+ greetd-gtkgreet-sway-session
%base-services))
@@ -3572,6 +3573,38 @@ (define-gexp-compiler (greetd-wlgreet-sway-session-compiler
sway
(make-greetd-wlgreet-sway-session-sway-config session)))))
+(define-record-type* <greetd-gtkgreet-sway-session>
+ greetd-gtkgreet-sway-session make-greetd-gtkgreet-sway-session
+ greetd-gtkgreet-sway-session?
+ (sway greetd-gtkgreet-sway-session-sway (default sway))
+ (sway-configuration greetd-wlgreet-sway-session-sway-configuration
+ (default (plain-file "greetd-gtkgreet-sway-config" "")))
+ (gtkgreet greetd-gtkgreet-sway-session-gtkgreet (default gtkgreet))
+ (gtkgreet-style greetd-gtkgreet-sway-session-gtkgreet-style
+ (default (plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")))
+ (command greetd-gtkgreet-sway-session-command (default (greetd-user-session))))
+
+(define make-greetd-gtkgreet-sway-session-sway-config
+ (match-lambda
+ (($ <greetd-gtkgreet-sway-session> sway sway-config gtkgreet gtkgreet-style 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 -s " gtkgreet-style " -c " command "; " swaymsg-bin " exit\"\n")))))
+
+(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler
+ (session <greetd-gtkgreet-sway-session>)
+ system target)
+ (match-record session <greetd-gtkgreet-sway-session>
+ (sway)
+ (lower-object
+ (make-greetd-sway-greeter-command
+ sway
+ (make-greetd-gtkgreet-sway-session-sway-config session)))))
+
(define-record-type* <greetd-terminal-configuration>
greetd-terminal-configuration make-greetd-terminal-configuration
greetd-terminal-configuration?
--
2.47.1
muradm wrote 1 months ago
[PATCH v4 1/3] services: greetd: Improve greeter configurations.
d96bf189a980be56e8a073fd0eb2210c61d0d357.1737903645.git.mail@muradm.net
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 its 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 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-color>): New record, `wlgreet` color holder.
(<greetd-wlgreet-configuration>): Refactor `wlgreet` configuration.
(<greetd-wlgreet-sway-session>): Switch to common user session.
* gnu/tests/desktop.scm (%minimal-services): Reflect configuration
changes.
* doc/guix.texi (Base Services): Document refactoring changes.

Change-Id: I7d79f07e9aaac21673a7c84ee0f989a474d4749d
---
doc/guix.texi | 115 +++++++++++------
gnu/services/base.scm | 278 +++++++++++++++++++++++-------------------
gnu/tests/desktop.scm | 14 ++-
3 files changed, 242 insertions(+), 165 deletions(-)

Toggle diff (431 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 9a53bdcd374..d74a8938a6d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20512,13 +20512,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")
@@ -20586,19 +20594,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.
@@ -20608,6 +20617,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
@@ -20616,60 +20629,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-configuration} (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-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{/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
@@ -20677,8 +20716,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
@@ -20687,7 +20725,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 5967457002d..c6098af8f4f 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -16,7 +16,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hui Lu <luhuins@163.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 ( <paren@disroot.org>
@@ -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))
@@ -3393,161 +3395,182 @@ (define %qemu-static-networking
;;; greetd-service-type -- minimal and flexible login manager daemon
;;;
-(define-record-type* <greetd-agreety-session>
- 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 <greetd-agreety-session>
+(define-record-type* <greetd-user-session>
+ 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 <greetd-user-session>
(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 <greetd-agreety-session>
- (command command-args extra-env)
+(define (make-greetd-xdg-user-session-command config)
+ (match-record config <greetd-user-session>
+ (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 <greetd-user-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>
+ 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 <greetd-agreety-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>
- 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"
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (let* ((username (getenv "USER"))
+ (user (getpwnam username))
+ (useruid (passwd:uid user))
+ (usergid (passwd:gid user))
+ (useruid-s (number->string useruid))
+ ;; /run/user/<greeter-user-uid> won't exist yet
+ ;; this will contain WAYLAND_DISPLAY socket file
+ ;; and log-file below
+ (user-home-dir "/tmp/.greeter-home")
+ (user-xdg-runtime-dir (string-append user-home-dir "/run"))
+ (user-xdg-cache-dir (string-append user-home-dir "/cache"))
+ (log-file (string-append (number->string (getpid)) ".log"))
+ (log-file (string-append user-home-dir "/" log-file)))
+ (for-each (lambda (d) (mkdir-p d) (chown d useruid usergid) (chmod d #o700))
+ (list user-home-dir
+ user-xdg-runtime-dir
+ user-xdg-cache-dir))
+ (setenv "HOME" user-home-dir)
+ (setenv "XDG_CACHE_DIR" user-xdg-cache-dir)
+ (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>
+ 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 <greetd-wlgreet-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>
+ greetd-wlgreet-configuration make-greetd-wlgreet-configuration
+ greetd-wlgreet-configuration?
+ (output-mode greetd-wlgreet-configuration-output-mode (default "all")
This message was truncated. Download the full message here.
Maxim Cournoyer wrote 1 months ago
Re: [bug#75270] [PATCH v3 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)
87sep55bp8.fsf@gmail.com
Hi Muradm,

muradm <mail@muradm.net> writes:

Toggle quote (9 lines)
> Hi,
>
> Fixed in v4.
>
> P.S. Sorry 75862, 75863, 75864 and 75865 was my bad due to missing
> headers. But 75866, 75867, 75868 and 75869 should not
> happen. 75270@debbugs.gnu.org was included in CC. WHat do you suggest
> to do with them?

It's not just CC, you need to send 'To: 75270@debbugs.gnu.org', using
'git send-email --to=75270@debbugs.gnu.org', or using 'mumi current
75270 && mumi send-email *.patch', for example :-).

It's a bit tricky and we all get it wrong at times, no worries. I'd
suggest closing the spurious issues created and resending to the correct
already existing issue.

--
Thanks,
Maxim
muradm wrote 1 months ago
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87r04oqkzs.fsf@muradm.net
Hi Maxim,

My last resort idea was exactly the same. Issues 75872, 75873,
75874 and 75875 was initiated with 'To: 75270@debbugs.gnu.org',
but it didn't help either ¯\_(ツ)_/¯.

I will close and archive them as well. Without trying again :) I
suppose it is enough copies of v4 is attached to 75270.

--
Thanks in advance,
muradm

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (26 lines)
> Hi Muradm,
>
> muradm <mail@muradm.net> writes:
>
>> Hi,
>>
>> Fixed in v4.
>>
>> P.S. Sorry 75862, 75863, 75864 and 75865 was my bad due to
>> missing
>> headers. But 75866, 75867, 75868 and 75869 should not
>> happen. 75270@debbugs.gnu.org was included in CC. WHat do you
>> suggest
>> to do with them?
>
> It's not just CC, you need to send 'To: 75270@debbugs.gnu.org',
> using
> 'git send-email --to=75270@debbugs.gnu.org', or using 'mumi
> current
> 75270 && mumi send-email *.patch', for example :-).
>
> It's a bit tricky and we all get it wrong at times, no worries.
> I'd
> suggest closing the spurious issues created and resending to the
> correct
> already existing issue.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmeXtDcACgkQ6M7O0mLO
BeJ96Q//V2s1V18to3riGaQkRQB8E2VOsbjVxCgTGVgOcg5kfgAFNM+oD9zExmlp
uP92/HKNWWfBYwgEmcmIkpOtVMJvbUjfqS6AN/TpUNV0/zhWap60M6Y0ihcZ0GsQ
HhaOStM1sowNJJSdeGQZQlZztAd+YF2bEUjUKDQkRrZwNGQGwOSH+jrfLJqYqUkd
sEcr5CN0qIfk+zKpMNxiBlH4t2LWHKcxVxT03XREy9S8ISaWsHUp1QVM0yVPNRa5
sBtPT39BvDf80DL7bpLxh83HPMUulCoIrxpRCfM+0T8MdfV4SpojifOSAsc1PFWn
RihQtXEUyVwwgLZR0+/VIg6gUXawWoW83Hb/f5ignl5obmbdCJPksl4uDv6efOjZ
apSsyMwDroYJRBY05B5Gdr3HJ3fySKGCWQj3kpGIeYRHJ1K4VdJ//qgE+Rpw/DkU
IIPiU8S0kGlF53Mt5FMCesuSQZzw9BeXifUllDd6pRMdkyyeSOakWIgRPn/Ec4M3
OYDSynoOW8FJwplnv3urzZHQDoc8xm0nVBJIJD6Ao3oZXvgxgzGMhfaRmCjwHxxi
4ENDw06EE3w4HmUCNjJ3h0zYa7ENyxPN0yRTuRcb3TKqPlwYpGBfeY45Hy6YvPi0
ZQmqehb1xEga9LFutWKpUV0txvUqyWfcKhpOjSEmEsgLXgq8pjQ=
=F4DZ
-----END PGP SIGNATURE-----

Maxim Cournoyer wrote 1 months ago
Re: [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)
87v7tzrqir.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (2 lines)
> btw, this will solve 64112, 65769 and 70605.

Could you make this clear in the commit messages by adding git trailers
such as:

Toggle snippet (3 lines)
Fixes: https://issues.guix.gnu.org/64112

in the commits that resolve the issues?

--
Thanks,
Maxim
Maxim Cournoyer wrote 1 months ago
Re: [bug#75270] [PATCH v4 2/3] gnu: Add gtkgreet.
(name . muradm)(address . mail@muradm.net)
87msfbrq03.fsf@gmail.com
Hello,

muradm <mail@muradm.net> writes:

Toggle quote (3 lines)
> * gnu/packages/admin.scm (gtkgreet): New variable.
> (gtkgreet-adwaita-dark): New variable.

Please split packages submission in different commits (1 package = 1
commit).

Toggle quote (43 lines)
> Change-Id: I9f84c1011e66ae7c87191488930465685ae44569
> ---
> gnu/packages/admin.scm | 43 +++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 42 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 659f7bc3bec..be6f00ce86b 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -44,7 +44,7 @@
> ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
> ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
> -;;; Copyright © 2021 muradm <mail@muradm.net>
> +;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
> ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
> ;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
> ;;; Copyright © 2021-2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
> @@ -5939,6 +5939,47 @@ (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.")

I'd spell GTK-based, despite what upstream used. What does 'to be run
under cage' means? What is cage? Shouldn't that run under greetd? I'm
confused. Please expand the description.

Toggle quote (18 lines)
> + (license license:gpl3+)))
> +
> +(define-public gtkgreet-adwaita-dark
> + (package
> + (inherit gtkgreet)
> + (name "gtkgreet-adwaita-dark")
> + (arguments
> + (list
> + #:phases
> + #~(modify-phases
> + %standard-phases
> + (add-after 'install 'wrap-gtkgreet-for-theme
> + (lambda _
> + (wrap-program
> + (string-append #$output "/bin/gtkgreet")
> + '("GTK_THEME" "" = ("Adwaita:dark"))))))))

Hm, that rebuilds gtkgreet just to change its theme? Couldn't its
service be configurable and take care of that instead?

Toggle quote (5 lines)
> + (inputs (modify-inputs
> + (package-inputs gtkgreet)
> + (prepend gnome-themes-extra)))))
> +

Nitpic: that'd be more conventionally indented as:

Toggle snippet (5 lines)
(inputs
(modify-inputs (package-inputs gtkgreet)
(prepend gnome-themes-extra)))

--
Thanks,
Maxim
Maxim Cournoyer wrote 1 months ago
Re: [bug#75270] [PATCH v4 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)
87h65jrlrg.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (10 lines)
> 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 its above is possible, one is still encouraged to use

While *the* above

Toggle quote (4 lines)
> `.bashrc`, `.profile` or similar.
> It also fixes incorrect use of `XDG_RUNTIME_DIR` for `wlgreet`.
> `wlgreet` requires compositor to run. We provide common sway based

requires *a* compositor

Toggle quote (5 lines)
> 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.

factored out (no hyphen)

Toggle quote (42 lines)
> (<greetd-agreety-session>): Switch to common user session.
> (<greetd-wlgreet-color>): New record, `wlgreet` color holder.
> (<greetd-wlgreet-configuration>): Refactor `wlgreet` configuration
> (<greetd-wlgreet-sway-session>): Switch to common user session.
> * gnu/tests/desktop.scm (%minimal-services): Reflect configuration
> changes.
> * doc/guix.texi (Base Services): Document refactoring changes.
>
> Change-Id: I7d79f07e9aaac21673a7c84ee0f989a474d4749d
> ---
> doc/guix.texi | 115 +++++++++++------
> gnu/services/base.scm | 278 +++++++++++++++++++++++-------------------
> gnu/tests/desktop.scm | 14 ++-
> 3 files changed, 242 insertions(+), 165 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index 9a53bdcd374..d74a8938a6d 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -20512,13 +20512,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))))))

You are changing the public API rather drastically. You need to come up
with a mechanism that will warn & automatically rewrite the legacy form
to the new form in the meantime, which I'm afraid won't be trivial given
the disruptive overhaul. There are examples among other services; it
typically involves defining a man-in-the-middle field sanitizer that
takes the old value, updates it to the new expected one while emitting a
deprecation warning.

Toggle quote (20 lines)
> ;; we can use any other executable command as greeter
> (greetd-terminal-configuration
> (terminal-vt "4")
> @@ -20586,19 +20594,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

I was wondering why 'greetd-agreety-session' was moved around; it makes
your change more confusing to review. Also, please use double space
between sentences, which is conventional in Guix.

Toggle quote (2 lines)
> +common command for that. User should prefer stable shell command like @code{bash},

s/user/users/, s/command/commands/, or 'a stable shell command'. I'm
not sure what 'stable' means in this context.

Toggle quote (2 lines)
> +which can start actual user terminal shell, window manager or desktop environment

*an* actual user terminal shell, [...]

Toggle quote (2 lines)
> +with its own mechanism, which would be @code{~/.bashrc} in case of @code{bash}.

@file{~/.bashrc} (not @code)

also, "in case of the @command{bash} command."

Toggle quote (15 lines)
>
> @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.
>
> @@ -20608,6 +20617,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

*The* user environment [...]

Toggle quote (2 lines)
> +adapt depending on its value (normaly by @code{.bashrc} or similar).

s/normaly/normally/

also, @file{~/.bashrc} to be consistent with above

Toggle quote (20 lines)
> +
> @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
> @@ -20616,60 +20629,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.

Note that @command is not intended for path, but for command *names*,
so, ideally we'd mention simply @command{agreety} command, though I see
this is a mistake from the past so could be done in prior commit.
Toggle quote (6 lines)
>
> -@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.

@command{agreety}

Toggle quote (2 lines)
> +Normally should be a variation of @code{greetd-user-session}, but could

I'd reword to: Typically, a <greetd-user-session> record instance is
used, but file-like objects are also valid.
Toggle quote (21 lines)
>
> -@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.

The descriptions are not too helpful. Are these supposed to be given as
hex value? Something else? A string? A number? Please expound.

Toggle quote (7 lines)
> +@end table
> +@end deftp
> +
> +@deftp {Data Type} greetd-wlgreet-configuration
>
> +@table @asis

@table @code (and simplify below).

Toggle quote (9 lines)
> @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))})

You can break these overly long lines via '@' to escape the newline, I
think.

Toggle quote (18 lines)
> 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.

I'm not convinced the greetd-wlgreet-color API change is worth the
trouble (especially given you need to make it backward-compatible with a
custom record field accessor that checks what it gets and adapts it to
the new expected format, emitting a deprecation warning in the process).

Toggle quote (25 lines)
> -@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-configuration} (default: @code{(plain-file "greetd-wlgreet-sway-config" "")})
> +Extra configuration for sway to be included before executing greeter.

Is that new default worth it/better? It'll create a not so useful empty
file in the store.

Toggle quote (13 lines)
> +@item @code{wlgreet} (default: @code{wlgreet})
> +The package with the @command{/bin/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{/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

Looks like all the tables can use '@table @code' instead of @asis, then
you can remove all the @code decorators for each items. This could be
done in a prior commit.

Toggle quote (8 lines)
> @@ -20677,8 +20716,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.

"*The* graphical greeter requireS additional group membership."

Toggle quote (10 lines)
> (greeter-supplementary-groups (list "video" "input" "seat"))
> (terminals
> (list (greetd-terminal-configuration
> @@ -20687,7 +20725,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

This line is a bit too long (80 columns max). Pleasae place the comment
on the line above, and punctuate it correctly as a line comment (note
also that margin comments are conventionally written like: ';no space
after semicolon', e.g. one ';' and no space between it and the comment).

[...]

Toggle quote (42 lines)
> (define-record-type* <greetd-wlgreet-sway-session>
> greetd-wlgreet-sway-session make-greetd-wlgreet-sway-session
> greetd-wlgreet-sway-session?
> - (wlgreet-session greetd-wlgreet-sway-session-wlgreet-session ;<greetd-wlgreet-session>
> - (default (greetd-wlgreet-session)))
> - (sway greetd-wlgreet-sway-session-sway (default sway)) ;<package>
> - (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-configuration greetd-wlgreet-sway-session-sway-configuration
> + (default (plain-file "greetd-wlgreet-sway-config" "")))
> + (wlgreet greetd-wlgreet-sway-session-wlgreet (default wlgreet))
> + (wlgreet-configuration greetd-wlgreet-sway-session-wlgreet-configuration
> + (default (greetd-wlgreet-configuration)))
> + (command greetd-wlgreet-sway-session-command (default (greetd-user-session))))
> +
> +(define make-greetd-wlgreet-sway-session-sway-config
> + (match-lambda
> + (($ <greetd-wlgreet-sway-session> sway sway-config wlgreet wlgreet-config command)
> + (let ((wlgreet-bin (file-append wlgreet "/bin/wlgreet"))
> + (wlgreet-config-file
> + (make-greetd-wlgreet-config 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")))))

Please break long lines so they fit in 80 chars.

Toggle quote (22 lines)
>
> (define-gexp-compiler (greetd-wlgreet-sway-session-compiler
> (session <greetd-wlgreet-sway-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 <greetd-wlgreet-sway-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

That's a suspicious line which already existed. It looks fragile. Is
it really necessary?

Toggle quote (66 lines)
> - (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>
> greetd-terminal-configuration make-greetd-terminal-configuration
> @@ -3625,7 +3648,8 @@ (define (greetd-accounts config)
> (name "greeter")
> (group "greeter")
> (supplementary-groups (greetd-greeter-supplementary-groups config))
> - (system? #t))))
> + (system? #t)
> + (create-home-directory? #f))))
>
> (define (make-greetd-pam-mount-conf-file config)
> (computed-file
> @@ -3675,6 +3699,9 @@ (define (greetd-pam-service config)
> (list optional-pam-mount))))
> pam))))))
>
> +(define (greetd-run-user-activation config)
> + #~(let ((d "/run/user")) (mkdir d #o755) (chmod d #o755)))
> +
> (define (greetd-shepherd-services config)
> (map
> (lambda (tc)
> @@ -3706,6 +3733,7 @@ (define greetd-service-type
> (list
> (service-extension account-service-type greetd-accounts)
> (service-extension file-system-service-type (const %greetd-file-systems))
> + (service-extension activation-service-type greetd-run-user-activation)
> (service-extension etc-service-type greetd-etc-service)
> (service-extension pam-root-service-type greetd-pam-service)
> (service-extension shepherd-root-service-type greetd-shepherd-services)))
> diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm
> index 1c32076ccb2..923c71a7f89 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")

I lost focus a bit in this file given the large hunks of changes, but it
looks reasonable. The main problem I see is the breakage of the old API
in the current form. I've given hints at how this can be overcome.
Could you attempt to do so in a v5?

--
Thanks,
Maxim
Maxim Cournoyer wrote 1 months ago
Re: [bug#75270] [PATCH v4 3/3] services: greetd: Add new gtkgreet greeter.
(name . muradm)(address . mail@muradm.net)
87cyg7rkye.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (4 lines)
> * gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
> represents `gtkgreet` greeter session configuration.
> * doc/guix.texi (Base Services): Document new `gtkgreet` greeter.

OK.

Toggle quote (20 lines)
> Change-Id: I10395a742fa7dee2c8ee2f92e80fe5c56a2e4fb6
> ---
> doc/guix.texi | 48 +++++++++++++++++++++++++++++++++++++++++--
> gnu/services/base.scm | 33 +++++++++++++++++++++++++++++
> 2 files changed, 79 insertions(+), 2 deletions(-)
>
> diff --git a/doc/guix.texi b/doc/guix.texi
> index d74a8938a6d..b1a3558e8ff 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -20594,8 +20594,9 @@ Base Services
> The user to use for running the greeter.
>
> @item @code{default-session-command} (default: @code{(greetd-agreety-session)})
> -Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session} or
> -@code{gexp->script} like object to use as greeter.
> +Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session},
> +@code{greetd-gtkgreet-sway-session} or @code{gexp->script} like object to use
> +as greeter.

I think you mean file-like object here also (which means just a G-Exp
that lowers to a file name IIUC). Your fill-column value or editor's
equivalent is set wrong (doesn't fold under 80 columns).

Toggle quote (14 lines)
> @end table
> @end deftp
> @@ -20732,6 +20733,49 @@ Base Services
> @end lisp
> @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.

Like earlier, missing 'The' article, as well as 's' to require. groups
should be plural too now that I think about it, since we're registering
more than one.

Toggle quote (10 lines)
> + (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
> + ;; optionally use Adwaita:dark configured version
> + (gtkgreet gtkgreet-adwaita-dark)

As mentioned in another mail, I think we need to refine how changing a
theme works. Rebuilding the package just for that is inelegant and
wasteful.

Toggle quote (4 lines)
> + (command
> + (greetd-user-session
> + ;; signal to our .bashrc that we want wayland compositor

Please use full sentences for line comments (including proper
punctuation).

Toggle quote (7 lines)
> + (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.

I'd write 'The package providing the @command{sway} and @command{swaymsg}
commands'.

Toggle quote (3 lines)
> +@item @code{sway-configuration} (default: @code{(plain-file "greetd-gtkgreet-sway-config" "")})
> +Extra configuration for sway to be included before executing greeter.

*the* greeter.

Toggle quote (4 lines)
> +
> +@item @code{gtkgreet} (default: @code{gtkgreet})
> +The package with @command{/bin/gtkgreet} command.

The package with the @command{gtkgreet} command.

Toggle quote (3 lines)
> +@item @code{gtkgreet-style} (default: @code{(plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")})
> +Extra CSS stylesheet to customize GTK look.

[...] customize *the* GTK look.

Toggle quote (4 lines)
> +
> +@item @code{command} (default: @code{(greetd-user-session)})
> +Command to be started by @command{/bin/agreety} on successful login.

@command{agreety}

Toggle quote (3 lines)
> +Normally should be a variation of @code{greetd-user-session}, but could
> +be any @code{gexp->script} like object.

Same as in the previous patch reviewed; s/variation/instance of the
@code{<greetd-user-session>} record/

also s/@code{gexp->script} like/file-like/

Toggle quote (45 lines)
> +
> +@end table
> +@end deftp
> +
> @node Scheduled Job Execution
> @subsection Scheduled Job Execution
>
> diff --git a/gnu/services/base.scm b/gnu/services/base.scm
> index c6098af8f4f..1b46bf76a25 100644
> --- a/gnu/services/base.scm
> +++ b/gnu/services/base.scm
> @@ -279,6 +279,7 @@ (define-module (gnu services base)
> greetd-wlgreet-color
> greetd-wlgreet-configuration
> greetd-wlgreet-sway-session
> + greetd-gtkgreet-sway-session
>
> %base-services))
>
> @@ -3572,6 +3573,38 @@ (define-gexp-compiler (greetd-wlgreet-sway-session-compiler
> sway
> (make-greetd-wlgreet-sway-session-sway-config session)))))
>
> +(define-record-type* <greetd-gtkgreet-sway-session>
> + greetd-gtkgreet-sway-session make-greetd-gtkgreet-sway-session
> + greetd-gtkgreet-sway-session?
> + (sway greetd-gtkgreet-sway-session-sway (default sway))
> + (sway-configuration greetd-wlgreet-sway-session-sway-configuration
> + (default (plain-file "greetd-gtkgreet-sway-config" "")))
> + (gtkgreet greetd-gtkgreet-sway-session-gtkgreet (default gtkgreet))
> + (gtkgreet-style greetd-gtkgreet-sway-session-gtkgreet-style
> + (default (plain-file "greetd-gtkgreet-sway-gtkgreet-style.css" "")))
> + (command greetd-gtkgreet-sway-session-command (default (greetd-user-session))))
> +
> +(define make-greetd-gtkgreet-sway-session-sway-config
> + (match-lambda
> + (($ <greetd-gtkgreet-sway-session> sway sway-config gtkgreet gtkgreet-style 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 -s " gtkgreet-style " -c " command "; " swaymsg-bin " exit\"\n")))))

Please break all these long lines extending past the 80 columns limit.

Toggle quote (11 lines)
> +(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler
> + (session <greetd-gtkgreet-sway-session>)
> + system target)
> + (match-record session <greetd-gtkgreet-sway-session>
> + (sway)
> + (lower-object
> + (make-greetd-sway-greeter-command
> + sway
> + (make-greetd-gtkgreet-sway-session-sway-config session)))))
> +

I wonder if we could use define-configuration and avoid the lower-level
define-gexp-compiler glue code.

Otherwise, LGTM.

Assuming you address my above comments,

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail>

--
Thanks,
Maxim
muradm wrote 1 months ago
Re: [bug#75270] [PATCH v4 2/3] gnu: Add gtkgreet.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87cyg6rcdb.fsf@muradm.net
Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (12 lines)
> Hello,
>
> muradm <mail@muradm.net> writes:
>
>> * gnu/packages/admin.scm (gtkgreet): New variable.
>> (gtkgreet-adwaita-dark): New variable.
>
> Please split packages submission in different commits (1 package
> = 1
> commit).
>

It is one package + variation, still split?

Toggle quote (10 lines)
>> + (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.")
>
> I'd spell GTK-based, despite what upstream used.

I copied and pasted what upstream says.

Toggle quote (5 lines)
> What does 'to be run
> under cage' means? What is cage? Shouldn't that run under
> greetd? I'm
> confused. Please expand the description.

While greeter is getting started by greetd, for graphical greeters
you need some compositor. So that greetd starts compositor which
starts the greeter. I suppose author here may refer to Cage
wayland kiosk (guix package --show=cage) compositor as an example.
The idea is to run greeter in such configuration that only one
application is executed.

Toggle quote (23 lines)
>> + (license license:gpl3+)))
>> +
>> +(define-public gtkgreet-adwaita-dark
>> + (package
>> + (inherit gtkgreet)
>> + (name "gtkgreet-adwaita-dark")
>> + (arguments
>> + (list
>> + #:phases
>> + #~(modify-phases
>> + %standard-phases
>> + (add-after 'install 'wrap-gtkgreet-for-theme
>> + (lambda _
>> + (wrap-program
>> + (string-append #$output "/bin/gtkgreet")
>> + '("GTK_THEME" "" =
>> ("Adwaita:dark"))))))))
>
> Hm, that rebuilds gtkgreet just to change its theme? Couldn't
> its
> service be configurable and take care of that instead?

There is nothing usable to extract into configuration. I found it
easier to configure package than to have alternative package
inlined into configuration. For instance
`<greetd-gtkgreet-sway-session>` has two fields holding packages
`sway` and `gtkgreet`. Is there any way to specify value of
`gtkgreet` to hold multiple packages to achieve similar effect
wihout building package?

Toggle quote (15 lines)
>> + (inputs (modify-inputs
>> + (package-inputs gtkgreet)
>> + (prepend gnome-themes-extra)))))
>> +
>
> Nitpic: that'd be more conventionally indented as:
>
> --8<---------------cut
> here---------------start------------->8---
> (inputs
> (modify-inputs (package-inputs gtkgreet)
> (prepend gnome-themes-extra)))
> --8<---------------cut
> here---------------end--------------->8---

Noted.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmeZKaAACgkQ6M7O0mLO
BeJOqw/+MfsFl2KCUJKPmkEj9VdI6NKimQW19wYZ2NJN9tyaWxguHdL1Lv8rE8s2
at0m/tK5gCDAuaUGe3eIweFuj6qKEZAaYPmxGhJcyPcw2PcSDf14BqKvktb1aD4V
DYGmukxpi61kT3Lbf2QXNr79OxoJUzT5ZMKyFRSUF+aSx5HWCvjhBXHerFz1/h+w
TZU35h2CM1TT69VvBO1915OA+OCT7+z3JMcRiuAeWpXWCrB5ee8Yf5BgaQiN2lct
j9wnyn3ttQLdyFLFlhLlB4q2AhLXriJW9RgO4sV7lvf0UQdnZudz8c2AjsNJNvk0
vTAvVdFB2cBV+QMwXfWUkDmfEom9obJI2h8p2fVWQ/atADND7alc8PNj18/xk3tC
3crdPTRwNdzO1LkgOTYTnlTJFPS9WJPTV29U112HWVzOf3bdGjct+2ZTGJtXghtP
eFujk8Kv7BGpjBjd9WCLA1sTl0KBwI3cj8Wk+a0MzmEPpLYcZeyyAivN1M3k4YbM
bkSjlwDYD2HlHzyL7+YiRkwfWhsKhCUe9P+joJ/70s3nrhYTcMHUfBsXepcCqhFL
0PjUlVSehDsdiEQVp3r30RDE/xH6IGAl/LTVx7IpsMq8kZ+YkNFzSG6sXZ9Divyg
5gGEFvSqlsw2C0SbkPLF/fLF+MO+1irJvG88+tOqPafLKDvRD3w=
=Dn2Q
-----END PGP SIGNATURE-----

Maxim Cournoyer wrote 1 months ago
(name . muradm)(address . mail@muradm.net)
87ikpyqlsl.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (17 lines)
> Hello,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> Hello,
>>
>> muradm <mail@muradm.net> writes:
>>
>>> * gnu/packages/admin.scm (gtkgreet): New variable.
>>> (gtkgreet-adwaita-dark): New variable.
>>
>> Please split packages submission in different commits (1 package = 1
>> commit).
>>
>
> It is one package + variation, still split?

Yes.

Toggle quote (12 lines)
>>> + (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.")
>>
>> I'd spell GTK-based, despite what upstream used.
>
> I copied and pasted what upstream says.

That's why I mentioned 'despite what upstream used' :-) As far as my
English grammar knowledge goes, when you use a compound adjective made
of a modified nound (such as GTK-based), it typically takes a hyphen.
There's apparently no strict rule [0], but in my opinion it helps
reading this correctly (you might pause a bit longer between GTK and
based if it were not joined by a hyphen).


Toggle quote (12 lines)
>> What does 'to be run
>> under cage' means? What is cage? Shouldn't that run under greetd?
>> I'm
>> confused. Please expand the description.
>
> While greeter is getting started by greetd, for graphical greeters you
> need some compositor. So that greetd starts compositor which starts
> the greeter. I suppose author here may refer to Cage wayland kiosk
> (guix package --show=cage) compositor as an example. The idea is to
> run greeter in such configuration that only one application is
> executed.

I see! Maybe it could thus be expound to:

"GTK-based greeter for greetd, to be run under a compositor such as
Cage."

Toggle quote (28 lines)
>>> + (license license:gpl3+)))
>>> +
>>> +(define-public gtkgreet-adwaita-dark
>>> + (package
>>> + (inherit gtkgreet)
>>> + (name "gtkgreet-adwaita-dark")
>>> + (arguments
>>> + (list
>>> + #:phases
>>> + #~(modify-phases
>>> + %standard-phases
>>> + (add-after 'install 'wrap-gtkgreet-for-theme
>>> + (lambda _
>>> + (wrap-program
>>> + (string-append #$output "/bin/gtkgreet")
>>> + '("GTK_THEME" "" = ("Adwaita:dark"))))))))
>>
>> Hm, that rebuilds gtkgreet just to change its theme? Couldn't its
>> service be configurable and take care of that instead?
>
> There is nothing usable to extract into configuration. I found it
> easier to configure package than to have alternative package inlined
> into configuration. For instance `<greetd-gtkgreet-sway-session>` has
> two fields holding packages `sway` and `gtkgreet`. Is there any way to
> specify value of `gtkgreet` to hold multiple packages to achieve
> similar effect wihout building package?

If the configuration record allowed provided a 'assets' or field, to put
in the environment greetd/gtkgreet runs, coupled with a
'environment-variables' field, the user could add the gnome-themes-extra
package to the 'assets' field and pass "GTK_THEME=Adwaita:dark" as an
environment variable to be set in the environment.

Your greetd-user-session already comes with 'extra-env', which could
accept the above. It'd just need a new 'assets' field. The
lightdm-gtk-greeter-configuration can be used for inspiration. The
'gdm-configuration' record also has a 'gnome-shell-assets' field serving
a similar purpose.

Note that there is a convention to end configuration records wih
'-configuration' in the name. I believe it will help users see more
clearly through the code if you follow this convention for the proposed
new records.

--
Thanks,
Maxim
muradm wrote 4 weeks ago
[PATCH v5 0/3] services: greetd: Improve greeter configurations.
cover.1738536455.git.mail@muradm.net
Minor improvements and fixes compared to v3.

Improves greeter configuration and adds new gtkgreet greeter.


muradm (3):
services: greetd: Improve greeter configurations.
gnu: Add gtkgreet.
services: greetd: Add new gtkgreet greeter.

doc/guix.texi | 120 ++++++++---
gnu/packages/admin.scm | 25 ++-
gnu/services/base.scm | 466 +++++++++++++++++++++++++++++------------
gnu/tests/desktop.scm | 14 +-
4 files changed, 463 insertions(+), 162 deletions(-)


base-commit: b64d3168af697ceb2a96e7e2c62bcf418b8a586a
--
2.47.1
muradm wrote 4 weeks ago
[PATCH v5 1/3] services: greetd: Improve greeter configurations.
81ca14e1ce416e71e56593e5dcb75fc50699eaca.1738536455.git.mail@muradm.net
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.
* gnu/tests/desktop.scm (%minimal-services): Reflect configuration
changes.
* doc/guix.texi (Base Services): Document refactoring changes.

Change-Id: Ibfd79e71a97b0d7fb4a866138d501236b9646ca4
---
doc/guix.texi | 77 +++++---
gnu/services/base.scm | 430 +++++++++++++++++++++++++++++-------------
gnu/tests/desktop.scm | 14 +-
3 files changed, 360 insertions(+), 161 deletions(-)

Toggle diff (427 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index bb5f29277fb..c60ad4f216b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20512,13 +20512,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 '("-l"))
+ (extra-env '(("MY_VAR" . "1")))
+ (xdg-env? #f))))))
;; we can use any other executable command as greeter
(greetd-terminal-configuration
(terminal-vt "4")
@@ -20586,21 +20594,23 @@ 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. 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}.
@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 +20618,36 @@ 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}. The User environment may
+adapt depending on its value (normally by @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 with @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 +20669,6 @@ Base Services
@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,20 +20681,30 @@ Base Services
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 with 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
@@ -20687,6 +20713,7 @@ Base Services
(default-session-command
(greetd-wlgreet-sway-session
(sway-configuration
+ ;; Optional extra sway configuration.
(local-file "sway-greetd.conf"))))))))
@end lisp
@end deftp
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 7331c030d71..926fc973c8b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -16,7 +16,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hui Lu <luhuins@163.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 ( <paren@disroot.org>
@@ -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-session ; deprecated
+ greetd-wlgreet-configuration
greetd-wlgreet-sway-session
%base-services))
@@ -3393,87 +3395,218 @@ (define %qemu-static-networking
;;; greetd-service-type -- minimal and flexible login manager daemon
;;;
+(define-record-type* <greetd-user-session>
+ 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 <greetd-user-session>
+ (command command-args extra-env)
+ (program-file
+ "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 (make-greetd-xdg-user-session-command config)
+ (match-record config <greetd-user-session>
+ (command command-args extra-env xdg-session-type)
+ (program-file
+ "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" #$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 <greetd-user-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>
- 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 <greetd-agreety-session>
- (command command-args extra-env)
- (program-file
- "agreety-tty-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 <greetd-agreety-session>
- (command command-args extra-env)
- (program-file
- "agreety-tty-xdg-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_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))))))
+ greetd-agreety-session make-greetd-agreety-session greetd-agreety-session?
+ (agreety greetd-agreety-session-agreety (default greetd))
+ (command greetd-agreety-session-command
+ (default (greetd-user-session))
+ (sanitize warn-greetd-agreety-session-command-type))
+ (command-args greetd-agreety-command-args
+ (default #nil)
+ (sanitize warn-deprecated-greetd-agreety-command-args))
+ (extra-env greetd-agreety-extra-env
+ (default #nil)
+ (sanitize warn-deprecated-greetd-agreety-extra-env))
+ (xdg-env? greetd-agreety-xdg-env?
+ (default #nil)
+ (sanitize warn-deprecated-greetd-agreety-xdg-env?)))
+
+(define (warn-deprecated-greetd-agreety-command-args value)
+ (when (not (nil? value))
+ (warn-about-deprecation
+ 'command-args #f
+ #:replacement '<greetd-user-seesion>))
+ value)
+
+(define (warn-deprecated-greetd-agreety-extra-env value)
+ (when (not (nil? value))
+ (warn-about-deprecation
+ 'extra-env #f
+ #:replacement '<greetd-user-seesion>))
+ value)
+
+(define (warn-deprecated-greetd-agreety-xdg-env? value)
+ (when (not (nil? value))
+ (warn-about-deprecation
+ 'xdg-env? #f
+ #:replacement '<greetd-user-seesion>))
+ value)
+
+(define-deprecated/alias greetd-agreety greetd-agreety-session-agreety)
+(define-deprecated/alias greetd-agreety-command greetd-agreety-session-command)
+
+(define (warn-greetd-agreety-session-command-type value)
+ (when (not (greetd-user-session? value))
+ (warn-about-deprecation
+ "arbitrary command" #f
+ #:replacement '<greetd-user-seesion>))
+ value)
+
+(define (greetd-agreety-session-to-user-session session default-command)
+ (let ((command (greetd-agreety-session-command session))
+ (command-args (or (greetd-agreety-command-args session)
+ (greetd-user-session-command-args default-command)))
+ (extra-env (or (greetd-agreety-extra-env session)
+ (greetd-user-session-extra-env default-command)))
+ (xdg-env? (or (greetd-agreety-xdg-env? session)
+ (greetd-user-session-xdg-env? default-command))))
+ (greetd-user-session
+ (command command)
+ (command-args command-args)
+ (extra-env extra-env)
+ (xdg-env? xdg-env?))))
(define-gexp-compiler (greetd-agreety-session-compiler
(session <greetd-agreety-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-agreety session) "/bin/agreety"))
+ (command
+ (greetd-agreety-session-command session))
+ (command
+ (if (greetd-user-session? command)
+ command
+ (greetd-agreety-session-to-user-session
+ session
+ (greetd-user-session)))))
(lower-object
- (program-file "agreety-command"
- #~(execl #$agreety #$agreety "-c" #$command)))))
+ (program-file
+ "agreety-wrapper"
+ #~(execl #$agreety #$agreety "-c" #$command)))))
-(define-record-type* <greetd-wlgreet-session>
- greetd-wlgreet-session make-greetd-wlgreet-session
- greetd-wlgreet-session?
- (wlgreet greetd-wlgreet (default wlgreet))
+(define (make-greetd-sway-greeter-command sway sway-config)
+ (let ((sway-bin (file-append sway "/bin/sway")))
+ (program-file
+ "greeter-sway-command"
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (let* ((username (getenv "USER"))
+ (user (getpwnam username))
+ (useruid (passwd:uid user))
+ (usergid (passwd:gid user))
+ (useruid-s (number->string useruid))
+ ;; /run/user/<greeter-user-uid> won't exist yet
+ ;; this will contain WAYLAND_DISPLAY socket file
+ ;; and log-file below
+ (user-home-dir "/tmp/.greeter-home")
+ (user-xdg-runtime-dir (string-append user-home-dir "/run"))
+ (user-xdg-cache-dir (string-append user-home-dir "/cache"))
+ (log-file (string-append (number->string (getpid)) ".log"))
+ (log-file (string-append user-home-dir "/" log-file)))
+ (for-each (lambda (d)
+ (mkdir-p d)
+ (chown d useruid usergid) (chmod d #o700))
+ (list user-home-dir
+ user-xdg-runtime-dir
+ user-xdg-cache-dir))
+ (setenv "HOME" user-home-dir)
+ (setenv "XDG_CACHE_DIR" user-xdg-cache-dir)
+ (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-configuration>
+ 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 '(0 0 0 0.9)))
+ (headline greetd-wlgreet-configuration-headline (default '(1 1 1 1)))
+ (prompt greetd-wlgreet-configuration-prompt (default '(1 1 1 1)))
+ (prompt-error greetd-wlgreet-configuration-prompt-error (default '(1 1 1 1)))
+ (border greetd-wlgreet-configuration-border (default '(1 1 1 1)))
+ (wlgreet greetd-wlgreet
+ (default #nil)
+ (sanitize warn-deprecated-greetd-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))
- (f
This message was truncated. Download the full message here.
muradm wrote 4 weeks ago
[PATCH v5 2/3] gnu: Add gtkgreet.
1048b16231229ca5aae519ebdaabac722ff47c14.1738536455.git.mail@muradm.net
* gnu/packages/admin.scm (gtkgreet): New variable.

Change-Id: If9f90e46d6cad85fa27bf844bbac36c04049d704
---
gnu/packages/admin.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 8e9dea4e2d9..727d08d262e 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -44,7 +44,7 @@
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;; Copyright © 2021-2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -6052,6 +6052,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 a compositor such as Cage.")
+ (home-page "https://git.sr.ht/~kennylevinsen/gtkgreet")
+ (license license:gpl3+)))
+
(define-public libseat
(package
(name "libseat")
--
2.47.1
muradm wrote 4 weeks ago
[PATCH v5 3/3] services: greetd: Add new gtkgreet greeter.
745d6966766cbe382bf9a07a19f5f33329ac17af.1738536455.git.mail@muradm.net
* gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
represents `gtkgreet` greeter session configuration.
* doc/guix.texi (Base Services): Document new `gtkgreet` greeter.

Change-Id: I34a5418c2ea948ac81fcb9b46aedd662863be31b
---
doc/guix.texi | 45 +++++++++++++++++++++++++++++++++++++++++--
gnu/services/base.scm | 38 ++++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 2 deletions(-)

Toggle diff (121 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index c60ad4f216b..5ea9b457109 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20594,8 +20594,8 @@ Base Services
The user to use for running the greeter.
@item @code{default-session-command} (default: @code{(greetd-agreety-session)})
-Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session} or
-@code{gexp->script} like object to use as greeter.
+Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session},
+@code{greetd-gtkgreet-sway-session} or file-like object to use as greeter.
@end table
@end deftp
@@ -20718,6 +20718,47 @@ Base Services
@end lisp
@end deftp
+@deftp {Data Type} greetd-gtkgreet-sway-session
+Configuration record for the gtkgreet greetd greeter. Can be used as
+following:
+
+@lisp
+ (greetd-configuration
+ ;; The graphical greeter requires additional groups 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
+ ;; Optionally signal to .bashrc that we want wayland compositor.
+ (xdg-session-type "wayland")))))))))
+@end lisp
+
+@table @asis
+@item @code{sway} (default: @code{sway})
+The package providing the @command{sway} and @command{swaymsg} commands.
+
+@item @code{sway-configuration} (default: @code{#f})
+Extra file-like configuration for sway to be included before executing
+the greeter.
+
+@item @code{gtkgreet} (default: @code{gtkgreet})
+The package with @command{gtkgreet} command.
+
+@item @code{gtkgreet-style} (default: @code{#f})
+Extra file-like CSS stylesheet to customize the GTK look.
+
+@item @code{command} (default: @code{(greetd-user-session)})
+Command to be started by @command{gtkgreet} on successful login, an
+instance of @code{greetd-user-session}.
+
+@end table
+@end deftp
+
@node Scheduled Job Execution
@subsection Scheduled Job Execution
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 926fc973c8b..691270f6bec 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -279,6 +279,7 @@ (define-module (gnu services base)
greetd-wlgreet-session ; deprecated
greetd-wlgreet-configuration
greetd-wlgreet-sway-session
+ greetd-gtkgreet-sway-session
%base-services))
@@ -3708,6 +3709,43 @@ (define-gexp-compiler (greetd-wlgreet-sway-session-compiler
sway
(make-greetd-wlgreet-sway-session-sway-config s))))))
+(define-record-type* <greetd-gtkgreet-sway-session>
+ greetd-gtkgreet-sway-session make-greetd-gtkgreet-sway-session
+ greetd-gtkgreet-sway-session?
+ (sway greetd-gtkgreet-sway-session-sway (default sway))
+ (sway-configuration greetd-gtkgreet-sway-session-sway-configuration
+ (default #f))
+ (gtkgreet greetd-gtkgreet-sway-session-gtkgreet (default gtkgreet))
+ (gtkgreet-style greetd-gtkgreet-sway-session-gtkgreet-style (default #f))
+ (command greetd-gtkgreet-sway-session-command (default (greetd-user-session))))
+
+(define make-greetd-gtkgreet-sway-session-sway-config
+ (match-lambda
+ (($ <greetd-gtkgreet-sway-session>
+ sway sway-config gtkgreet gtkgreet-style command)
+ (let ((gtkgreet-bin (file-append gtkgreet "/bin/gtkgreet"))
+ (swaymsg-bin (file-append sway "/bin/swaymsg")))
+ (mixed-text-file
+ "gtkgreet-sway-config"
+ (if sway-config "include " "")
+ (if sway-config sway-config "")
+ (if sway-config "\n" "")
+ "xwayland disable\n"
+ "exec \"" gtkgreet-bin " -l"
+ (if gtkgreet-style " -s " "")
+ (if gtkgreet-style gtkgreet-style "")
+ " -c " command "; " swaymsg-bin " exit\"\n")))))
+
+(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler
+ (session <greetd-gtkgreet-sway-session>)
+ system target)
+ (match-record session <greetd-gtkgreet-sway-session>
+ (sway)
+ (lower-object
+ (make-greetd-sway-greeter-command
+ sway
+ (make-greetd-gtkgreet-sway-session-sway-config session)))))
+
(define-record-type* <greetd-terminal-configuration>
greetd-terminal-configuration make-greetd-terminal-configuration
greetd-terminal-configuration?
--
2.47.1
muradm wrote 4 weeks ago
Re: [bug#75270] [PATCH v4 1/3] services: greetd: Improve greeter configurations.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
877c682axz.fsf@muradm.net
Hi,

Skipped comments are ok or done. Commenting most notable only.

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (14 lines)
> You are changing the public API rather drastically. You need to
> come up
> with a mechanism that will warn & automatically rewrite the
> legacy form
> to the new form in the meantime, which I'm afraid won't be
> trivial given
> the disruptive overhaul. There are examples among other
> services; it
> typically involves defining a man-in-the-middle field sanitizer
> that
> takes the old value, updates it to the new expected one while
> emitting a
> deprecation warning.

Done. It should be noted that it is impossible to cover all
possible cases
to provide solid backward compatibility. Uses of file-like objects
increase variations.

Toggle quote (6 lines)
> I was wondering why 'greetd-agreety-session' was moved around;
> it makes
> your change more confusing to review. Also, please use double
> space
> between sentences, which is conventional in Guix.

Unfortunately, when greetd-service-type first created, it was not
clear
for me how to make things clean. Now that cleaning requires
somewhat
complex refactoring.

Toggle quote (4 lines)
> s/user/users/, s/command/commands/, or 'a stable shell command'.
> I'm
> not sure what 'stable' means in this context.

Changed stable to POSIX. Idea was to specify something "working
always".

Toggle quote (4 lines)
> I'd reword to: Typically, a <greetd-user-session> record
> instance is
> used, but file-like objects are also valid.

This one is changed. Having configurable <greetd-user-session>, I
don't
think that it is worth supporting file-like there.

Toggle quote (9 lines)
> I'm not convinced the greetd-wlgreet-color API change is worth
> the
> trouble (especially given you need to make it
> backward-compatible with a
> custom record field accessor that checks what it gets and adapts
> it to
> the new expected format, emitting a deprecation warning in the
> process).

I was not either. Dropped greetd-wlgreet-color.

Toggle quote (4 lines)
> Is that new default worth it/better? It'll create a not so
> useful empty
> file in the store.

I didn't introduce that default, but documented it. With v5
default fixed.

Toggle quote (6 lines)
> Looks like all the tables can use '@table @code' instead of
> @asis, then
> you can remove all the @code decorators for each items. This
> could be
> done in a prior commit.

I didn't find any use of '@table @code' which document default
values.

Toggle quote (6 lines)
>> - (sleep 1) ;give seatd/logind some time to start up
>
> That's a suspicious line which already existed. It looks
> fragile. Is
> it really necessary?

Unfortunately, there is no good/easy way to conditionally depend
on elogind or seatd. greetd-service-type and agreety greeter do
not require
seat, only sway based greeters may/will want it.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmef/RgACgkQ6M7O0mLO
BeLm9Q//Zo29mv+tPVmbbKMbX5591fcSTfMJcvfY0K6N1v6KrqtXCSWIEnqTS1pB
sFKOgRoP7QvDQ1QUtcI76UNs3GdjVkXK3t9YjMtwLKUQPtGCaHLh74W7fU6WW4tO
fv1wwY3uZ5miRJ/BG4G59vCSaxxH2f0zvqqkrvcAZwS2C0W/42ml6ZQkoCVuBNkZ
HOmWwHWv9AgcLK4Z3jWD8tQ2gQwY1BvcbrxYIrdSmL7Vfv+GBbQAk0/4Z1nOAP2C
w6O+96gcNpn5/0YZJgIjZzc0oNSWVeQRMoLPV0oFC2SdbPcK8uSH+9GFrk9MBGir
FfwSogIj0Au3IjhDaVmw8Pas/Q3zlMQ0JTfIb6cqaq7hGxkvPUJzs0t2JMc6gFaz
H0ToMxWVMHv3AG5V6TKGxgr7t+lbj7Sdv9LRxyn2M+ZBTnE2HBu9f0DRrhndUiDI
MjtZQsybRuqQBUfjAP5MolTpODYfx0bE/CVk6n4CFNO87S2lNv3bAHTaCBdgpaX3
s/urJAt+onKTFUUAuTXBapBXbRcVQoSBTQApRiVJ6H9QjOt0BYzdH//IUsF24N1p
Thk9R3hSE/mmOhL7+AjBmUCoLxhJrFi25xPQr+uMNodz8SG0h0qoR+Vmeweof65X
THGsUhN33Y6l5dOdIdzdrVSRokMWoWxNxdNN7Lpn+qCR8K9pGgk=
=ivHv
-----END PGP SIGNATURE-----

muradm wrote 4 weeks ago
Re: [bug#75270] [PATCH v4 2/3] gnu: Add gtkgreet.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
871pwf3ogp.fsf@muradm.net
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (25 lines)
>>> Hm, that rebuilds gtkgreet just to change its theme? Couldn't
>>> its
>>> service be configurable and take care of that instead?
>>
>> There is nothing usable to extract into configuration. I found
>> it
>> easier to configure package than to have alternative package
>> inlined
>> into configuration. For instance
>> `<greetd-gtkgreet-sway-session>` has
>> two fields holding packages `sway` and `gtkgreet`. Is there any
>> way to
>> specify value of `gtkgreet` to hold multiple packages to
>> achieve
>> similar effect wihout building package?
>
> If the configuration record allowed provided a 'assets' or
> field, to put
> in the environment greetd/gtkgreet runs, coupled with a
> 'environment-variables' field, the user could add the
> gnome-themes-extra
> package to the 'assets' field and pass "GTK_THEME=Adwaita:dark"
> as an
> environment variable to be set in the environment.

I find it too complex to configure explicitly. Also greeter is
somewhat
special program, for security, that should be run alone. Messing
with
its environment, is not good idea.

Toggle quote (9 lines)
> Your greetd-user-session already comes with 'extra-env', which
> could
> accept the above. It'd just need a new 'assets' field. The
> lightdm-gtk-greeter-configuration can be used for inspiration.
> The
> 'gdm-configuration' record also has a 'gnome-shell-assets' field
> serving
> a similar purpose.

That `extra-env` is not intended for greeter environment, but for
user environment after login.

For now I dropped dark variant.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmegAmYACgkQ6M7O0mLO
BeJxtRAAgYX+a5bXK4SbxjTRfA/Z92X2TFY0ygawTSa0WQ45crfprgxc3MxyBnZU
8il7BZN0gHhIz6ZjHt2FF9jXMGE3GwL6DElQQxZ7v9DvQC2eGk8Xb7r3TqHxJXPv
eQm7nLDchza0GbwMKMbpiLs0FElYjGvsEhRyCNGSK9KSF3rZ+1VUyyxEv2LlmNiz
FNvs3lGupqo9dBtWnAhL+5W8kmBQ+ql4BhCB+98Y9curbr+17QkG+2+Zhupwg6uv
sKX+lyjLCyMoK7rxF3PR2ZZ8jmQygfjYBSg7u1lCVipJlfyz9P9xMmMtIY3C6W73
61mPDAhyoBimDNTYEy+Gth5aYR0HmD29dMmCU0l/DUxHygK62UDYQoIv6zm6+56s
9+TB8cGbv78holRhPNWa8cQ9AyJGgFsjkQKxKumNLhulqqx39x5FhMHqSZN78pf5
BtoW+nK7e2CYge1G1Cwu0Jw6FYzjLNWOsyNAgRdKwGNUX3KeudQEigJq7c5S9PDv
A1Xa0Nm9OwGBcz8xCo3ZxWmmAwUsO22/KJ3KQs2sWB3ZQetcKCB3Hvu1uKQ9sOGj
prJqNYxWusrzoY+f98w/teYZ7aO361aOIgLPgIHZH8uVXR8CSokHFPX+FsLq0Xlw
ZQCBriNLYa+2xmQ8aXw3x69/hY9UkKWDi4/NMpkGwXDQE+Rr/f4=
=HQtM
-----END PGP SIGNATURE-----

muradm wrote 4 weeks ago
Re: [bug#75270] [PATCH v4 3/3] services: greetd: Add new gtkgreet greeter.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87v7tr29md.fsf@muradm.net
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (17 lines)
>> +(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler
>> + (session
>> <greetd-gtkgreet-sway-session>)
>> + system target)
>> + (match-record session <greetd-gtkgreet-sway-session>
>> + (sway)
>> + (lower-object
>> + (make-greetd-sway-greeter-command
>> + sway
>> + (make-greetd-gtkgreet-sway-session-sway-config
>> session)))))
>> +
>
> I wonder if we could use define-configuration and avoid the
> lower-level
> define-gexp-compiler glue code.

gnu/services/base.scm do not import `(gnu services
configuration)`. IMHO,
`define-configuration` is good for serializing record-like
configuration
to custom formats. Here we actually need and configure executable
programs. I was not the one who introduced them, but currently I
find
them more useful here.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmegA8oACgkQ6M7O0mLO
BeJPzhAAvT9Wt5l3Cyk2K56KFjFhftv8KiX7GujfZrQi8O01GVKgc9WJicPi9X9C
1366GI1rtQyyxobYhWyRBU4cIdsXwoANr//NJcUxFDMLLD2sD4T9q3V4Q6pW5szN
of8HXHYxwLm53yCUSm3RvoTiSp6X7MKCrc9rlXLaTqIwhAd8tbV2KgGzRXSBKnMC
SblmXEfXVV82UBxMRX/HBShhGLZBz+yuPH2eL675/h6Y8hZLCBIX/oqcI1Gb940W
2XKJiiIi2gK5pmgmkRDuiaQtVyh5IAWCIUJTxNLoUE4wfEpabmkAQF0WrgGhxFhz
v8dsDOEE7FJ2GOSy5W+yMw8Y0Ll2HrDTQf2pvGy1HCL364vrGMTvrlew6oAdamd0
5xbKk18fNiX0FULOPkodnjx7dI1VMxtbNaihqzMyv2AKKNEqW041IGJHHtwHkXqb
4oJZDw9XCdwb1zDUQdko5DuhFJy45srNhC7cW8HyI8G425pNEqytLtaqnXKIPLJh
GTzkU9b2sPtclVlFZjUHqLKSbkN1joIYBCpu1FsFjtDk9cXLFqHFDRj6DH+NxBGI
Ueu1lmLe1xUQm1JuOSXzxmt8fnCg3j8Zs6sDASh51/XezJ7nil2O4P+Ru//j98Ta
YyV2+sEEDQCyUWtcn/Ys/lwjfUzVEQkSKNH+FI+XKGMYKp0k6WI=
=qfUG
-----END PGP SIGNATURE-----

Maxim Cournoyer wrote 4 weeks ago
Re: [bug#75270] [PATCH v4 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)
87tt9bdtxs.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (24 lines)
> Hi,
>
> Skipped comments are ok or done. Commenting most notable only.
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> You are changing the public API rather drastically. You need to
>> come up
>> with a mechanism that will warn & automatically rewrite the legacy
>> form
>> to the new form in the meantime, which I'm afraid won't be trivial
>> given
>> the disruptive overhaul. There are examples among other services;
>> it
>> typically involves defining a man-in-the-middle field sanitizer that
>> takes the old value, updates it to the new expected one while
>> emitting a
>> deprecation warning.
>
> Done. It should be noted that it is impossible to cover all possible
> cases
> to provide solid backward compatibility. Uses of file-like objects
> increase variations.

OK; so the new version will need some fiddling from users to just build
with their current config? Or are these expected to be rare edge cases?

Toggle quote (10 lines)
>> I was wondering why 'greetd-agreety-session' was moved around; it
>> makes
>> your change more confusing to review. Also, please use double space
>> between sentences, which is conventional in Guix.
>
> Unfortunately, when greetd-service-type first created, it was not
> clear
> for me how to make things clean. Now that cleaning requires somewhat
> complex refactoring.

OK.

[...]

Toggle quote (7 lines)
>> Is that new default worth it/better? It'll create a not so useful
>> empty
>> file in the store.
>
> I didn't introduce that default, but documented it. With v5 default
> fixed.

OK, I must have gotten confused by the messy diff.

Toggle quote (8 lines)
>> Looks like all the tables can use '@table @code' instead of @asis,
>> then
>> you can remove all the @code decorators for each items. This could
>> be
>> done in a prior commit.
>
> I didn't find any use of '@table @code' which document default values.

See (info '(texinfo) @table):

Write the ‘@table’ command at the beginning of a line, after a blank
line, and follow it on the same line with an argument that is an
'indicating' command, such as ‘@code’, ‘@samp’, ‘@var’, ‘@option’, or
‘@kbd’ (*note Indicating::). This command will be applied to the text
in the first column. For example, ‘@table @code’ will cause the text
in the first column to be output as if it had been the argument to a
‘@code’ command.

I think the 'indicating' command argument to @table is required, so
there is no default value.

Toggle quote (11 lines)
>>> - (sleep 1) ;give seatd/logind some time to start up
>>
>> That's a suspicious line which already existed. It looks fragile.
>> Is
>> it really necessary?
>
> Unfortunately, there is no good/easy way to conditionally depend
> on elogind or seatd. greetd-service-type and agreety greeter do not
> require
> seat, only sway based greeters may/will want it.

I meant perhaps waiting 1 second here is no longer necessary? 1 s is
not much at all. Perhaps added during debug/development of the service
and forgotten? I'd trying taking it out and see.

--
Thanks,
Maxim
muradm wrote 4 weeks ago
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87ed0f15xw.fsf@muradm.net
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (30 lines)
>>> You are changing the public API rather drastically. You need
>>> to
>>> come up
>>> with a mechanism that will warn & automatically rewrite the
>>> legacy
>>> form
>>> to the new form in the meantime, which I'm afraid won't be
>>> trivial
>>> given
>>> the disruptive overhaul. There are examples among other
>>> services;
>>> it
>>> typically involves defining a man-in-the-middle field
>>> sanitizer that
>>> takes the old value, updates it to the new expected one while
>>> emitting a
>>> deprecation warning.
>>
>> Done. It should be noted that it is impossible to cover all
>> possible
>> cases
>> to provide solid backward compatibility. Uses of file-like
>> objects
>> increase variations.
>
> OK; so the new version will need some fiddling from users to
> just build
> with their current config? Or are these expected to be rare
> edge cases?

Problems may occur with complex setups, where commands provided by
users
are very different from "bash -l". Knowing in advance all
alternatives
is impossible. Everything sane or default, should work as is,
showing
the warnings on reconfigure.

Toggle quote (31 lines)
>>> Looks like all the tables can use '@table @code' instead of
>>> @asis,
>>> then
>>> you can remove all the @code decorators for each items. This
>>> could
>>> be
>>> done in a prior commit.
>>
>> I didn't find any use of '@table @code' which document default
>> values.
>
> See (info '(texinfo) @table):
>
> Write the ‘@table’ command at the beginning of a line, after
> a blank
> line, and follow it on the same line with an argument that is
> an
> 'indicating' command, such as ‘@code’, ‘@samp’, ‘@var’,
> ‘@option’, or
> ‘@kbd’ (*note Indicating::). This command will be applied to
> the text
> in the first column. For example, ‘@table @code’ will cause
> the text
> in the first column to be output as if it had been the
> argument to a
> ‘@code’ command.
>
> I think the 'indicating' command argument to @table is required,
> so
> there is no default value.

I have to try, may be next time.
You want me to update all tables in greetd service documentation?

Toggle quote (21 lines)
>>>> - (sleep 1) ;give seatd/logind some time to start
>>>> up
>>>
>>> That's a suspicious line which already existed. It looks
>>> fragile.
>>> Is
>>> it really necessary?
>>
>> Unfortunately, there is no good/easy way to conditionally
>> depend
>> on elogind or seatd. greetd-service-type and agreety greeter do
>> not
>> require
>> seat, only sway based greeters may/will want it.
>
> I meant perhaps waiting 1 second here is no longer necessary? 1
> s is
> not much at all. Perhaps added during debug/development of the
> service
> and forgotten? I'd trying taking it out and see.

Unfortunately, if you take it out, you will end up with race
condition
when sometimes it works sometimes not. Technically, "sleep 1" may
cause race as well, but for years I didn't have any issue with it.

To try it, you have to configure seatd, greetd, and sway based
greeter. Then just reboot/restart host until race.

One possible is to provide additional greetd configuration that
will expose the shepherd requirements. But I think it might
will complicate configuration dramatically for end user.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmegzKsACgkQ6M7O0mLO
BeL9+g//dKGvwvHM0zvdXpYtD7uYYcCR7DenYkLPMxqnqisFOOxIVHpIPafLEJN+
wrofJNjKei58mGlW+zgDZ/98cltFF8D0UhnAQd6LYgP9Zra+E66FVBx3Ozy23iJP
ZW+0UP0RP/9SMpR9k0zkc0a+9lE2DcMiu2XlUhNb1+TTAAifg8SXL5ruH2NgDaKu
DFeCP+4vvhJqXkd4jOAYCNup8pZo3kHiFE+g/j660Fw3/4yFZ10uZSCUMyg2SJg4
Hc+mOhAdcQvFFysEGxY5wP5RX2Sm/C3gBzGgzaqcvm4q6CpJ7rpGGGlmPhpm3/Sy
5svaG1sa29oNo6eb+t5YW5HRvQiytSSCQJDJIYsXkwMSWKmQI6DDU/fVfba06HAO
CcJF0m9jNAu6kq/Y+BBVUGAx1yKLbA2LJIH+/BEQ4VzzAGJMSOgaxSAbL2UJiKBq
2sVa63NxJrq19+cskKpG7FwUX4yiUWdXH90C2f81PhNHce8a4k7khCNPLHNaIcNz
vf3QSpFnD6a2SBpOBn7UneZ8e7mA2DoqYLNYatjRWZGy1fG8xWuXSdlKpGQtvxCk
Ynq4wycmjyjcfmNWT8l7/HLz/T3oQErOSgN1HSq5Ep6BKZdhnL0z55Xv/FAVmfpU
fF1q8Lyt5HtSj5GM6Cp3oogoUixJDQvsSEx0IDfK2IgdcXaeTN0=
=bcT1
-----END PGP SIGNATURE-----

Maxim Cournoyer wrote 4 weeks ago
Re: [PATCH v5 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)(address . 75270@debbugs.gnu.org)
875xlp9d1y.fsf@gmail.com
Hi again!

muradm <mail@muradm.net> writes:

[...]

Toggle quote (3 lines)
> +@item @code{xdg-session-type} (default: @code{"tty"})
> +Specify the value of @code{XDG_SESSION_TYPE}. The User environment may

s/User/user/

[...]

Toggle quote (19 lines)
> +(define-record-type* <greetd-user-session>
> + 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 <greetd-user-session>
> + (command command-args extra-env)
> + (program-file
> + "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))))))

Please break long lines under 80 chars.

Toggle quote (17 lines)
> +
> +(define (make-greetd-xdg-user-session-command config)
> + (match-record config <greetd-user-session>
> + (command command-args extra-env xdg-session-type)
> + (program-file
> + "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" #$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))))))

Please break long lines under 80 chars.

[...]

Toggle quote (18 lines)
> + greetd-agreety-session make-greetd-agreety-session greetd-agreety-session?
> + (agreety greetd-agreety-session-agreety (default greetd))
> + (command greetd-agreety-session-command
> + (default (greetd-user-session))
> + (sanitize warn-greetd-agreety-session-command-type))
> + (command-args greetd-agreety-command-args
> + (default #nil)
> + (sanitize warn-deprecated-greetd-agreety-command-args))
> + (extra-env greetd-agreety-extra-env
> + (default #nil)
> + (sanitize warn-deprecated-greetd-agreety-extra-env))
> + (xdg-env? greetd-agreety-xdg-env?
> + (default #nil)
> + (sanitize warn-deprecated-greetd-agreety-xdg-env?)))
> +
> +(define (warn-deprecated-greetd-agreety-command-args value)
> + (when (not (nil? value))

#nil. Interesting, I had never used it. You should use 'unless' here
instead of 'when ... not' though.

Toggle quote (2 lines)
> + (warn-about-deprecation

Despite being public, this particular deprecation procedure is not the
best, as it deosn't handle the source location itself. I've tested the
following successfully:

Toggle quote (4 lines)
> + 'command-args #f
> + #:replacement '<greetd-user-seesion>))
> + value)

There's a typo, here and for the other deprecation procedures:
s/seesion/session/

Ideally deprecation warns and the configuration records are
automatically rewritten to the modern equivalent in the code, which
means only one code path in the service exists for one given option, but
I don't think that's possible here given the new command record replaces
multiple fields, so OK. I couldn't find a way to preserve the syntax
source info too, in my quick experiment.

[...]

Toggle quote (59 lines)
> +(define-record-type* <greetd-wlgreet-configuration>
> + 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 '(0 0 0 0.9)))
> + (headline greetd-wlgreet-configuration-headline (default '(1 1 1 1)))
> + (prompt greetd-wlgreet-configuration-prompt (default '(1 1 1 1)))
> + (prompt-error greetd-wlgreet-configuration-prompt-error (default '(1 1 1 1)))
> + (sway greetd-wlgreet-sway-session-sway (default sway))
> + (sway-configuration greetd-wlgreet-sway-session-sway-configuration
> + (default #f))
> + (wlgreet greetd-wlgreet-sway-session-wlgreet (default wlgreet))
> + (wlgreet-configuration greetd-wlgreet-sway-session-wlgreet-configuration
> + (default (greetd-wlgreet-configuration)))
> + (command greetd-wlgreet-sway-session-command (default (greetd-user-session)))
> + (wlgreet-session
> + greetd-wlgreet-sway-session-wlgreet-session
> + (default #nil)
> + (sanitize warn-deprecated-greetd-wlgreet-sway-session-wlgreet-session)))
> +
> +(define (warn-deprecated-greetd-wlgreet-sway-session-wlgreet-session value)
> + (when (not (nil? value))
> + (warn-about-deprecation
> + 'wlgreet-session #f
> + #:replacement 'wlgreet-configuration))
> + value)
> +
> +(define make-greetd-wlgreet-sway-session-sway-config
> + (match-lambda
> + (($ <greetd-wlgreet-sway-session>
> + sway sway-config wlgreet wlgreet-config command)
> + (let ((wlgreet-bin (file-append wlgreet "/bin/wlgreet"))
> + (wlgreet-config-file
> + (make-greetd-wlgreet-config command wlgreet-config))
> + (swaymsg-bin (file-append sway "/bin/swaymsg")))
> + (mixed-text-file
> + "wlgreet-sway-config"
> + (if sway-config "include " "")
> + (if sway-config sway-config "")
> + (if sway-config "\n" "")
> + "xwayland disable\n"
> + "exec \"" wlgreet-bin " --config " wlgreet-config-file
> + "; " swaymsg-bin " exit\"\n")))))
> +
> +(define (greetd-wlgreet-session-to-config session config)
> + (let* ((wlgreet (or (greetd-wlgreet config)
> + (greetd-wlgreet-sway-session-wlgreet session)))
> + (default-command (greetd-wlgreet-sway-session-command session))
> + (command (or (greetd-wlgreet-command config)
> + (greetd-user-session-command default-command)))
> + (command-args (or (greetd-wlgreet-command-args config)
> + (greetd-user-session-command-args default-command)))
> + (extra-env (or (greetd-wlgreet-extra-env config)
> + (greetd-user-session-extra-env default-command))))
> + (greetd-wlgreet-sway-session
> + (sway (greetd-wlgreet-sway-session-sway session))
> + (sway-configuration (greetd-wlgreet-sway-session-sway-configuration session))

Line width > 80 :-)

Part from these nitpicks:

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail>

--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
Re: [PATCH v5 3/3] services: greetd: Add new gtkgreet greeter.
(name . muradm)(address . mail@muradm.net)(address . 75270@debbugs.gnu.org)
871pwd9cq7.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (4 lines)
> * gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
> represents `gtkgreet` greeter session configuration.
> * doc/guix.texi (Base Services): Document new `gtkgreet` greeter.

Nitpick: I'd use straight quote in GNU Change Log messages; back quotes
are very much Markdown :-).

[...]

Toggle quote (4 lines)
> +(define make-greetd-gtkgreet-sway-session-sway-config
> + (match-lambda
> + (($ <greetd-gtkgreet-sway-session>

You should use a regular lambda + the Guix-provided 'match-record'
syntax.

Toggle quote (9 lines)
> + sway sway-config gtkgreet gtkgreet-style command)
> + (let ((gtkgreet-bin (file-append gtkgreet "/bin/gtkgreet"))
> + (swaymsg-bin (file-append sway "/bin/swaymsg")))
> + (mixed-text-file
> + "gtkgreet-sway-config"
> + (if sway-config "include " "")
> + (if sway-config sway-config "")
> + (if sway-config "\n" "")

Seems these if block can be grouped as one.

Toggle quote (5 lines)
> + "xwayland disable\n"
> + "exec \"" gtkgreet-bin " -l"
> + (if gtkgreet-style " -s " "")
> + (if gtkgreet-style gtkgreet-style "")

Likewise.

The rest LGTM.

Could you send a v6 revision of the whole series?

--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
Re: [bug#75270] [PATCH v4 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)
87wme57xyp.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

[...]

Toggle quote (11 lines)
>> OK; so the new version will need some fiddling from users to just
>> build
>> with their current config? Or are these expected to be rare edge
>> cases?
>
> Problems may occur with complex setups, where commands provided by
> users
> are very different from "bash -l". Knowing in advance all alternatives
> is impossible. Everything sane or default, should work as is, showing
> the warnings on reconfigure.

Thanks for explaining. That sounds reasonable to me.

[...]

Toggle quote (22 lines)
>> See (info '(texinfo) @table):
>>
>> Write the ‘@table’ command at the beginning of a line, after a
>> blank
>> line, and follow it on the same line with an argument that is
>> an
>> 'indicating' command, such as ‘@code’, ‘@samp’, ‘@var’,
>> ‘@option’, or
>> ‘@kbd’ (*note Indicating::). This command will be applied to
>> the text
>> in the first column. For example, ‘@table @code’ will cause
>> the text
>> in the first column to be output as if it had been the
>> argument to a
>> ‘@code’ command.
>>
>> I think the 'indicating' command argument to @table is required, so
>> there is no default value.
>
> I have to try, may be next time.
> You want me to update all tables in greetd service documentation?

Yes, that'd be best. It can be done later in a different submission.

Toggle quote (21 lines)
>>>>> - (sleep 1) ;give seatd/logind some time to start up
>>>>
>>>> That's a suspicious line which already existed. It looks fragile.
>>>> Is
>>>> it really necessary?
>>>
>>> Unfortunately, there is no good/easy way to conditionally depend
>>> on elogind or seatd. greetd-service-type and agreety greeter do not
>>> require
>>> seat, only sway based greeters may/will want it.
>>
>> I meant perhaps waiting 1 second here is no longer necessary? 1 s
>> is
>> not much at all. Perhaps added during debug/development of the
>> service
>> and forgotten? I'd trying taking it out and see.
>
> Unfortunately, if you take it out, you will end up with race condition
> when sometimes it works sometimes not. Technically, "sleep 1" may
> cause race as well, but for years I didn't have any issue with it.

OK. What do other systems do? Surely, there are better technical means
to achieve this than sleeping for one second?

Toggle quote (7 lines)
> To try it, you have to configure seatd, greetd, and sway based
> greeter. Then just reboot/restart host until race.
>
> One possible is to provide additional greetd configuration that
> will expose the shepherd requirements. But I think it might
> will complicate configuration dramatically for end user.

Perhaps there could be a shepherd-requirements field attached to the
greeter configurations with a sane default value capturing the Shepherd
requirements, abstracting the complexity to most users while leaving it
configurable?

--
Thanks,
Maxim
muradm wrote 4 weeks ago
[PATCH v6 0/3] services: greetd: Improve greeter configurations.
cover.1738760538.git.mail@muradm.net
Minor improvements and fixes compared to v5.
Adds extra-shepherd-requirement.

Improves greeter configuration and adds new gtkgreet greeter.


muradm (3):
services: greetd: Improve greeter configurations.
gnu: Add gtkgreet.
services: greetd: Add new gtkgreet greeter.

doc/guix.texi | 129 ++++++++---
gnu/packages/admin.scm | 25 ++-
gnu/services/base.scm | 473 +++++++++++++++++++++++++++++------------
gnu/tests/desktop.scm | 14 +-
4 files changed, 477 insertions(+), 164 deletions(-)


base-commit: b64d3168af697ceb2a96e7e2c62bcf418b8a586a
--
2.47.1
muradm wrote 4 weeks ago
[PATCH v6 1/3] services: greetd: Improve greeter configurations.
bc9ce68ef267e88bf7d03f0f7134572e66828701.1738760538.git.mail@muradm.net
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
---
doc/guix.texi | 84 +++++---
gnu/services/base.scm | 439 +++++++++++++++++++++++++++++-------------
gnu/tests/desktop.scm | 14 +-
3 files changed, 374 insertions(+), 163 deletions(-)

Toggle diff (428 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index bb5f29277fb..2a0fa6b37d1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20512,13 +20512,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 '("-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,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{config-file-name}
Configuration file name to use for greetd daemon. Generally, autogenerated
derivation based on @code{terminal-vt} value.
@@ -20586,21 +20599,23 @@ 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. 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}.
@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 +20623,36 @@ 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}. The user environment may
+adapt depending on its value (normally by @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 with @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 +20674,6 @@ Base Services
@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 +20686,41 @@ Base Services
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 with 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
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 7331c030d71..8c9947c1914 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -16,7 +16,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Hui Lu <luhuins@163.com>
;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 ( <paren@disroot.org>
@@ -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-session ; deprecated
+ greetd-wlgreet-configuration
greetd-wlgreet-sway-session
%base-services))
@@ -3393,87 +3395,220 @@ (define %qemu-static-networking
;;; greetd-service-type -- minimal and flexible login manager daemon
;;;
+(define-record-type* <greetd-user-session>
+ 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 <greetd-user-session>
+ (command command-args extra-env)
+ (program-file
+ "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 (make-greetd-xdg-user-session-command config)
+ (match-record config <greetd-user-session>
+ (command command-args extra-env xdg-session-type)
+ (program-file
+ "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" #$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 <greetd-user-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>
- 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 <greetd-agreety-session>
- (command command-args extra-env)
- (program-file
- "agreety-tty-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 <greetd-agreety-session>
- (command command-args extra-env)
- (program-file
- "agreety-tty-xdg-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_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))))))
+ greetd-agreety-session make-greetd-agreety-session greetd-agreety-session?
+ (agreety greetd-agreety-session-agreety (default greetd))
+ (command greetd-agreety-session-command
+ (default (greetd-user-session))
+ (sanitize warn-greetd-agreety-session-command-type))
+ (command-args greetd-agreety-command-args
+ (default #nil)
+ (sanitize warn-deprecated-greetd-agreety-command-args))
+ (extra-env greetd-agreety-extra-env
+ (default #nil)
+ (sanitize warn-deprecated-greetd-agreety-extra-env))
+ (xdg-env? greetd-agreety-xdg-env?
+ (default #nil)
+ (sanitize warn-deprecated-greetd-agreety-xdg-env?)))
+
+(define (warn-deprecated-greetd-agreety-command-args value)
+ (unless (nil? value)
+ (warn-about-deprecation
+ 'command-args #f
+ #:replacement '<greetd-user-seesion>))
+ value)
+
+(define (warn-deprecated-greetd-agreety-extra-env value)
+ (unless (nil? value)
+ (warn-about-deprecation
+ 'extra-env #f
+ #:replacement '<greetd-user-seesion>))
+ value)
+
+(define (warn-deprecated-greetd-agreety-xdg-env? value)
+ (unless (nil? value)
+ (warn-about-deprecation
+ 'xdg-env? #f
+ #:replacement '<greetd-user-seesion>))
+ value)
+
+(define-deprecated/alias greetd-agreety greetd-agreety-session-agreety)
+(define-deprecated/alias greetd-agreety-command greetd-agreety-session-command)
+
+(define (warn-greetd-agreety-session-command-type value)
+ (unless (greetd-user-session? value)
+ (warn-about-deprecation
+ "arbitrary command" #f
+ #:replacement '<greetd-user-session>))
+ value)
+
+(define (greetd-agreety-session-to-user-session session default-command)
+ (let ((command (greetd-agreety-session-command session))
+ (command-args (or (greetd-agreety-command-args session)
+ (greetd-user-session-command-args default-command)))
+ (extra-env (or (greetd-agreety-extra-env session)
+ (greetd-user-session-extra-env default-command)))
+ (xdg-env? (or (greetd-agreety-xdg-env? session)
+ (greetd-user-session-xdg-env? default-command))))
+ (greetd-user-session
+ (command command)
+ (command-args command-args)
+ (extra-env extra-env)
+ (xdg-env? xdg-env?))))
(define-gexp-compiler (greetd-agreety-session-compiler
(session <greetd-agreety-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-agreety session) "/bin/agreety"))
+ (command
+ (greetd-agreety-session-command session))
+ (command
+ (if (greetd-user-session? command)
+ command
+ (greetd-agreety-session-to-user-session
+ session
+ (greetd-user-session)))))
(lower-object
- (program-file "agreety-command"
- #~(execl #$agreety #$agreety "-c" #$command)))))
+ (program-file
+ "agreety-wrapper"
+ #~(execl #$agreety #$agreety "-c" #$command)))))
-(define-record-type* <greetd-wlgreet-session>
- greetd-wlgreet-session make-greetd-wlgreet-session
- greetd-wlgreet-session?
- (wlgreet greetd-wlgreet (default wlgreet))
+(define (make-greetd-sway-greeter-command sway sway-config)
+ (let ((sway-bin (file-append sway "/bin/sway")))
+ (program-file
+ "greeter-sway-command"
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+
+ (let* ((username (getenv "USER"))
+ (user (getpwnam username))
+ (useruid (passwd:uid user))
+ (usergid (passwd:gid user))
+ (useruid-s (number->string useruid))
+ ;; /run/user/<greeter-user-uid> won't exist yet
+ ;; this will contain WAYLAND_DISPLAY socket file
+ ;; and log-file below
+ (user-home-dir "/tmp/.greeter-home")
+ (user-xdg-runtime-dir (string-append user-home-dir "/run"))
+ (user-xdg-cache-dir (string-append user-home-dir "/cache"))
+ (log-file (string-append (number->string (getpid)) ".log"))
+ (log-file (string-append user-home-dir "/" log-file)))
+ (for-each (lambda (d)
+ (mkdir-p d)
+ (chown d useruid usergid) (chmod d #o700))
+ (list user-home-dir
+ user-xdg-runtime-dir
+ user-xdg-cache-dir))
+ (setenv "HOME" user-home-dir)
+ (setenv "XDG_CACHE_DIR" user-xdg-cache-dir)
+ (setenv "XDG_RUNTIME_DIR" user-xdg-runtime-dir)
+ (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-configuration>
+ 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 '(0 0 0 0.9)))
+ (headline greetd-wlgreet-configuration-headline (default '(1 1 1 1)))
+ (prompt greetd-wlgreet-configuration-prompt (default '(1 1 1 1)))
+ (prompt-error greetd-wlgreet-configuration-prompt-error (default '(1 1 1 1)))
+ (border greetd-wlgreet-configuration-border (default '(1 1 1 1)))
+ (wlgreet greetd-wlgreet
+ (default #nil)
+ (sanitize warn-deprecated-greetd-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 gre
This message was truncated. Download the full message here.
muradm wrote 4 weeks ago
[PATCH v6 2/3] gnu: Add gtkgreet.
27a283d25c176f0dffd64b39a5bfb0fa6496b720.1738760538.git.mail@muradm.net
* gnu/packages/admin.scm (gtkgreet): New variable.

Change-Id: Ifd00be82534e14d27ea42d5ec06d8733346d860b
---
gnu/packages/admin.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 8e9dea4e2d9..727d08d262e 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -44,7 +44,7 @@
;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
-;;; Copyright © 2021 muradm <mail@muradm.net>
+;;; Copyright © 2021, 2025 muradm <mail@muradm.net>
;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
;;; Copyright © 2021-2025 Artyom V. Poptsov <poptsov.artyom@gmail.com>
@@ -6052,6 +6052,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 a compositor such as Cage.")
+ (home-page "https://git.sr.ht/~kennylevinsen/gtkgreet")
+ (license license:gpl3+)))
+
(define-public libseat
(package
(name "libseat")
--
2.47.1
muradm wrote 4 weeks ago
[PATCH v6 3/3] services: greetd: Add new gtkgreet greeter.
ad55fad26beb7d6d98b106872d24f2574a458238.1738760538.git.mail@muradm.net
* gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
represents 'gtkgreet' greeter session configuration.
* doc/guix.texi (Base Services): Document new 'gtkgreet' greeter.

Change-Id: I2e8b5710965faa05795af1d0b2a0e2f774af1d5a
---
doc/guix.texi | 47 +++++++++++++++++++++++++++++++++++++++++--
gnu/services/base.scm | 36 +++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 2 deletions(-)

Toggle diff (121 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 2a0fa6b37d1..b25ead9d587 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20599,8 +20599,8 @@ Base Services
The user to use for running the greeter.
@item @code{default-session-command} (default: @code{(greetd-agreety-session)})
-Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session} or
-@code{gexp->script} like object to use as greeter.
+Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session},
+@code{greetd-gtkgreet-sway-session} or file-like object to use as greeter.
@end table
@end deftp
@@ -20725,6 +20725,49 @@ Base Services
@end lisp
@end deftp
+@deftp {Data Type} greetd-gtkgreet-sway-session
+Configuration record for the gtkgreet greetd greeter. Can be used as
+following:
+
+@lisp
+ (greetd-configuration
+ ;; The graphical greeter requires additional groups 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-gtkgreet-sway-session
+ (command
+ (greetd-user-session
+ ;; Optionally signal to .bashrc that we want wayland compositor.
+ (xdg-session-type "wayland")))))))))
+@end lisp
+
+@table @asis
+@item @code{sway} (default: @code{sway})
+The package providing the @command{sway} and @command{swaymsg} commands.
+
+@item @code{sway-configuration} (default: @code{#f})
+Extra file-like configuration for sway to be included before executing
+the greeter.
+
+@item @code{gtkgreet} (default: @code{gtkgreet})
+The package with @command{gtkgreet} command.
+
+@item @code{gtkgreet-style} (default: @code{#f})
+Extra file-like CSS stylesheet to customize the GTK look.
+
+@item @code{command} (default: @code{(greetd-user-session)})
+Command to be started by @command{gtkgreet} on successful login, an
+instance of @code{greetd-user-session}.
+
+@end table
+@end deftp
+
@node Scheduled Job Execution
@subsection Scheduled Job Execution
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 8c9947c1914..86d8683a520 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -279,6 +279,7 @@ (define-module (gnu services base)
greetd-wlgreet-session ; deprecated
greetd-wlgreet-configuration
greetd-wlgreet-sway-session
+ greetd-gtkgreet-sway-session
%base-services))
@@ -3710,6 +3711,41 @@ (define-gexp-compiler (greetd-wlgreet-sway-session-compiler
sway
(make-greetd-wlgreet-sway-session-sway-config s))))))
+(define-record-type* <greetd-gtkgreet-sway-session>
+ greetd-gtkgreet-sway-session make-greetd-gtkgreet-sway-session
+ greetd-gtkgreet-sway-session?
+ (sway greetd-gtkgreet-sway-session-sway (default sway))
+ (sway-configuration greetd-gtkgreet-sway-session-sway-configuration
+ (default #f))
+ (gtkgreet greetd-gtkgreet-sway-session-gtkgreet (default gtkgreet))
+ (gtkgreet-style greetd-gtkgreet-sway-session-gtkgreet-style (default #f))
+ (command greetd-gtkgreet-sway-session-command
+ (default (greetd-user-session))))
+
+(define (make-greetd-gtkgreet-sway-session-sway-config session)
+ (match-record session <greetd-gtkgreet-sway-session>
+ (sway sway-configuration gtkgreet gtkgreet-style command)
+ (let ((gtkgreet-bin (file-append gtkgreet "/bin/gtkgreet"))
+ (swaymsg-bin (file-append sway "/bin/swaymsg")))
+ (mixed-text-file
+ "gtkgreet-sway-config"
+ (if sway-configuration
+ #~(string-append "include " #$sway-configuration "\n")
+ "")
+ "xwayland disable\n"
+ "exec \"" gtkgreet-bin " -l"
+ (if gtkgreet-style #~(string-append " -s " #$gtkgreet-style) "")
+ " -c " command "; " swaymsg-bin " exit\"\n"))))
+
+(define-gexp-compiler (greetd-gtkgreet-sway-session-compiler
+ (session <greetd-gtkgreet-sway-session>)
+ system target)
+ (match-record session <greetd-gtkgreet-sway-session> (sway)
+ (lower-object
+ (make-greetd-sway-greeter-command
+ sway
+ (make-greetd-gtkgreet-sway-session-sway-config session)))))
+
(define-record-type* <greetd-terminal-configuration>
greetd-terminal-configuration make-greetd-terminal-configuration
greetd-terminal-configuration?
--
2.47.1
muradm wrote 4 weeks ago
Re: [bug#75270] [PATCH v4 1/3] services: greetd: Improve greeter configurations.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
87r04czg82.fsf@muradm.net
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (49 lines)
>>>>>> - (sleep 1) ;give seatd/logind some time to start
>>>>>> up
>>>>>
>>>>> That's a suspicious line which already existed. It looks
>>>>> fragile.
>>>>> Is
>>>>> it really necessary?
>>>>
>>>> Unfortunately, there is no good/easy way to conditionally
>>>> depend
>>>> on elogind or seatd. greetd-service-type and agreety greeter
>>>> do not
>>>> require
>>>> seat, only sway based greeters may/will want it.
>>>
>>> I meant perhaps waiting 1 second here is no longer necessary?
>>> 1 s
>>> is
>>> not much at all. Perhaps added during debug/development of
>>> the
>>> service
>>> and forgotten? I'd trying taking it out and see.
>>
>> Unfortunately, if you take it out, you will end up with race
>> condition
>> when sometimes it works sometimes not. Technically, "sleep 1"
>> may
>> cause race as well, but for years I didn't have any issue with
>> it.
>
> OK. What do other systems do? Surely, there are better
> technical means
> to achieve this than sleeping for one second?
>
>> To try it, you have to configure seatd, greetd, and sway based
>> greeter. Then just reboot/restart host until race.
>>
>> One possible is to provide additional greetd configuration that
>> will expose the shepherd requirements. But I think it might
>> will complicate configuration dramatically for end user.
>
> Perhaps there could be a shepherd-requirements field attached to
> the
> greeter configurations with a sane default value capturing the
> Shepherd
> requirements, abstracting the complexity to most users while
> leaving it
> configurable?

Adding extra-shepherd-requirement configuration field in v6.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmejZB0ACgkQ6M7O0mLO
BeK7jQ/+OfSNL0S5C5MC5j/TDXlueK6XPafInXsiPnHsBjEjiUqhOCF11pDBF3yp
fsIBQoRdw83q7chwEjdv790+OSl51dyJfo1rnfgVLNw4hlMnWY0yQZ0fOMtVxjgJ
KaCx2qmGSW+xQIWKaXFjCMmDozGEwcDHgk386SKaN/uvxjXhmHRUvCAMwgoJAOP/
k6qWCh3VzR4qQtek/cZD+BAi3z/5eZY9ujvxOmjzNdvu43oe7h+jGsMrle/6Yvj/
oB9kUU91L/hA070o86T8nIOj2q4GlyrxeT4PdPbL8HM4APeJtEbjJjSGkBKhTR9+
9+JGCtjEt1cBrsnoGTlL8Xx+49DB74uKGombvm3TjwbjL7Be2xDZ1CJBXhk5fIgO
aevWUsPZSZ9FxD1rB3aZouKHHlWwgFTSphYFM+ily6mOe2JUrr3krXN54h3N9IYF
0dDO6k38Xt3vnReYLVtWeSLaakuBL9Ld8U6C98MLvrVuF1lovZ2L717IETtMyaV8
DDQPQjfp72xDDgygU/ah7C/UEhqlYfdpjAtrJoe5qrQj0rKv2fwXJ7GMXGMHBTno
0Qbs1ksRTckJZBT0jbsBu1kUhbuF+agaGVGoB/SCb3MslF7frBB0s/N7ipm9Sewd
RSq9sQ09whtNo+gQbHR3j/jjR17AYAFQLN/fz5wjdCBfhCSF280=
=tT4s
-----END PGP SIGNATURE-----

Maxim Cournoyer wrote 4 weeks ago
Re: [PATCH v6 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)(address . 75270@debbugs.gnu.org)
87bjvf8bmz.fsf@gmail.com
Hello,

muradm <mail@muradm.net> writes:


[...]

Toggle quote (5 lines)
> +@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:

Toggle snippet (120 lines)
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


--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
Re: [bug#75270] [PATCH v6 3/3] services: greetd: Add new gtkgreet greeter.
(name . muradm)(address . mail@muradm.net)
877c638asu.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (4 lines)
> * gnu/services/base.scm (<greetd-gtkgreet-sway-session>): New record,
> represents 'gtkgreet' greeter session configuration.
> * doc/guix.texi (Base Services): Document new 'gtkgreet' greeter.

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>

I'll merge it shortly. I took the liberty to make the following
stylistic edits:

Toggle snippet (65 lines)
1 file changed, 10 insertions(+), 8 deletions(-)
doc/guix.texi | 18 ++++++++++--------

modified doc/guix.texi
@@ -20600,8 +20600,9 @@ Base Services
The user to use for running the greeter.
@item @code{default-session-command} (default: @code{(greetd-agreety-session)})
-Can be either @code{greetd-agreety-session}, @code{greetd-wlgreet-sway-session},
-@code{greetd-gtkgreet-sway-session} or file-like object to use as greeter.
+Can be either @code{greetd-agreety-session},
+@code{greetd-wlgreet-sway-session}, @code{greetd-gtkgreet-sway-session}
+or a file-like object to use as greeter.
@end table
@end deftp
@@ -20729,8 +20730,8 @@ Base Services
@end deftp
@deftp {Data Type} greetd-gtkgreet-sway-session
-Configuration record for the gtkgreet greetd greeter. Can be used as
-following:
+Configuration record for the gtkgreet greetd greeter. It can be used as
+follows:
@lisp
(greetd-configuration
@@ -20738,7 +20739,7 @@ Base Services
(greeter-supplementary-groups (list "video" "input" "seat"))
(terminals
(list (greetd-terminal-configuration
- ;; Sway requires seatd service.
+ ;; Sway requires the seatd service.
(shepherd-requirement '(seatd))
(terminal-vt "1")
(terminal-switch #t)
@@ -20746,7 +20747,8 @@ Base Services
(greetd-gtkgreet-sway-session
(command
(greetd-user-session
- ;; Optionally signal to .bashrc that we want wayland compositor.
+ ;; Optionally signal to .bashrc that we want the Wayland
+ ;; compositor.
(xdg-session-type "wayland")))))))))
@end lisp
@@ -20759,13 +20761,13 @@ Base Services
the greeter.
@item @code{gtkgreet} (default: @code{gtkgreet})
-The package with @command{gtkgreet} command.
+The package providing the @command{gtkgreet} command.
@item @code{gtkgreet-style} (default: @code{#f})
Extra file-like CSS stylesheet to customize the GTK look.
@item @code{command} (default: @code{(greetd-user-session)})
-Command to be started by @command{gtkgreet} on successful login, an
+The command to be started by @command{gtkgreet} on successful login, an
instance of @code{greetd-user-session}.
@end table


Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
Re: [bug#75270] [PATCH v6 0/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)
8734gr8aff.fsf@gmail.com
close 64112
close 65769
close 70605
close 70318
quit

Hi,

muradm <mail@muradm.net> writes:

Toggle quote (10 lines)
> Minor improvements and fixes compared to v5.
> Adds extra-shepherd-requirement.
>
> Improves greeter configuration and adds new gtkgreet greeter.
>
> Fixes: https://issues.guix.gnu.org/64112
> Fixes: https://issues.guix.gnu.org/65769
> Fixes: https://issues.guix.gnu.org/70605
> Obsoletes: https://issues.guix.gnu.org/70318

Pushed as commit 220ef58440. Thanks a lot for tackling these various
issues and for your patience during the review.

--
Thanks,
Maxim
muradm wrote 4 weeks ago
Re: [PATCH v6 1/3] services: greetd: Improve greeter configurations.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 75270@debbugs.gnu.org)
87a5azyxvq.fsf@muradm.net
Hello,

Toggle quote (16 lines)
>> +@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.

I explicitly named field 'extra-shepherd-requirement' due to its
implementation. Other places you mention about configure whole
list of requirements, for instance:

Toggle snippet (24 lines)
(shepherd-requirement
mingetty-configuration-shepherd-requirement
;; Since the login prompt shows the host
name, wait
;; for the 'host-name' service to be done.
Also wait
;; for udev essentially so that the tty
text is not
;; lost in the middle of kernel messages
(XXX).
(default '(user-processes host-name udev
virtual-terminal))))

;; .... skipped

(list
(shepherd-service
(documentation "Run mingetty on an tty.")
(provision (list (symbol-append 'term- (string->symbol
tty))))

(requirement shepherd-requirement)

Compared to what 'extra-shepherd-requirement' means:

Toggle snippet (17 lines)
+ (extra-shepherd-requirement greetd-extra-shepherd-requirement
(default '()))

- (greetd-vt (greetd-terminal-vt tc)))
+ (greetd-vt (greetd-terminal-vt tc))
+ (greetd-requirement (greetd-extra-shepherd-requirement
tc)))
(shepherd-service
(documentation "Minimal and flexible login manager
daemon")
- (requirement '(pam user-processes host-name udev
virtual-terminal))
+ (requirement `(pam user-processes host-name udev
virtual-terminal
+ ,@greetd-requirement))

We add to requrements, thus 'extra-shepherd-requirement', compared
to other overriding requirements.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmekwPoACgkQ6M7O0mLO
BeLf5Q//QN85j8oaFpqKlCrrzDLt2915e74EUcUwg1+ryryjyJergoRaytPUC5FC
KeOpPQ22SwCcT67KH+oDNlaZ4StOSB4ZxBK9WDtA4luTyxNmMd+/FKKUEG9hgy2A
LAT+dekU7SzREDnnsbqIF4r0dAJtapJl2Tt4ebUfc5F3mRSJiOr0KP0bNJFFe2Kt
HO0Kn1QM6Sfhd2FTQ0lT/DS4jvJ6vjO1hE0JPAHTRdkW0cjBalMoF16WLBBOpd2P
zLsQVSa97MIPahQIfbjUFgYgRLpzTId5CeCXINGoJS8zZ4GAD0E1yVxYVsoF4ueK
cyf810PNG8I6+HTmUoWkGWK22VS+sIOzazFitbGbEqSr1wmsTI6U+z71Wq085Mvc
1r7Zu6YLmzNkTKu/VrRu31grFQIXIDRgNWcuG+5GL9TTk8pRqJQhlC/m/Cy8/PPm
SYNmlDWlIvw+f7DnO7f9diKJiQ2NMCxqUac+foSBA4Eof7b0IkOlvBOP5VOhAGxN
oCq1+G3IMIGPYbVIS3d1XO+FCCC21zKEX1ZT7Vc878cIFvlbdF1XAwiu/Wa4HKMh
LjIKGu2zctPjBQ4rnKA2wJNvE2ZDvi+n0+3EO+h4E+83CC3aEUdCxnnNGXR4bX87
w0hfn8RYLFYi7kHF1MnQ+QIC4mmGcjJOENxZ2k4J34jvkUh+JGI=
=tCJl
-----END PGP SIGNATURE-----

muradm wrote 4 weeks ago
Re: [bug#75270] [PATCH v6 0/3] services: greetd: Improve greeter configurations.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
874j17yxtt.fsf@muradm.net
Hi, thanks for reviewing and commiting.

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (23 lines)
> close 64112
> close 65769
> close 70605
> close 70318
> quit
>
> Hi,
>
> muradm <mail@muradm.net> writes:
>
>> Minor improvements and fixes compared to v5.
>> Adds extra-shepherd-requirement.
>>
>> Improves greeter configuration and adds new gtkgreet greeter.
>>
>> Fixes: https://issues.guix.gnu.org/64112
>> Fixes: https://issues.guix.gnu.org/65769
>> Fixes: https://issues.guix.gnu.org/70605
>> Obsoletes: https://issues.guix.gnu.org/70318
>
> Pushed as commit 220ef58440. Thanks a lot for tackling these
> various
> issues and for your patience during the review.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEESPY5lma9A9l5HGLP6M7O0mLOBeIFAmekwT4ACgkQ6M7O0mLO
BeJyrRAA2NSnHzrr7cZjW6d/ZHA838RlxO6NEfmUjfCfGb9gvFtbAYO14s4iVbSZ
3oY7WuyTJsauD7pD/CouM8qeglqrhOe7JomN2Y5YLsH7c5nzUSePyxEcYKbVM7R8
aivpHkxUvd60/A0Yz/fhjnEl6BlNmg0YEayLQ0TMflabuJtbD2FEZ2cGMyAw2YRn
y9q3oacLxSzb6fe5NRI1s+4gtLcWkzIFCNQIB8qGN6ForMQpbGmoCfC9VXUEhaed
16fxRnF+JjXsdlLCMikwk80cBw87urFxq/60bg+ccFBoH+x1rR6U5J2VDRhsENVU
izTqehhawtFPuUpziK1pLqWeAEz2hEjThaKHykYyGd/Lze6T981/9+IA8otGkSNg
gRhVsEZbD3fTOvV9TeyhZmNiMcX4t8hKR9f5GrTOfJpN8wixG5PQdDitim6uqH7q
MhFdSS1hDbW5snnzPxlxIaK5rDVTxeJTwEepKCIH3EtSlek1RT5Zpt5eXnt2m2Sq
XzRdO2Xq28FdPop1S1uAT6tqOS2RNYaBk0JpmqtyUxkJGZSsDz4H2EStmtV4sak3
z5gBgYWX9Uhl5PsEbYzvAPcP1Mr+w5hfbG8yMryBW311+U/SRYfnQj0RTz0XPAHy
4GTax3X4LHkGvAIOFSRnRYFCNgSy2Rp2B6LjYG0a772Z1XGbKNA=
=OKt/
-----END PGP SIGNATURE-----

Timo Wilken wrote 4 weeks ago
guix system: error: mkdir: File exists: "/run/user"
(address . 75270@debbugs.gnu.org)(address . mail@muradm.net)
D7LHIIG102X2.74GZBYW1M79A@twilken.net
Hi,

Unfortunately, this patch breaks my system activation:

$ sudo guix system reconfigure -e '(@ (tw system frm) %frm-system)'
[...]
activating system...
making '/var/guix/profiles/system-84-link' the current system...
populating /etc from /gnu/store/akx5gq0i5ackzzgdghg6a9l5np8kjqyq-etc...
setting up privileged programs in '/run/privileged/bin'...
guix system: error: mkdir: File exists: "/run/user"

I'm on the latest Guix:

$ guix describe
Generation 74 Feb 06 2025 16:41:14 (current)
tw 493333f
branch: master
commit: 493333fc4ee5b7c28835268c6f5038d1fef89eea
guix a62ee28
branch: master
commit: a62ee289a59ff67c46dc79d96b8e79c975f71482
[non-free channels elided]

Tracing through the activation scripts, it looks like the culprit is this
g-exp in gnu/services/base.scm line 3877:

(define (greetd-run-user-activation config)
#~(let ((d "/run/user"))
(mkdir d #o755)
(chmod d #o755)))

I suppose that should be a `mkdir-p' instead.

Cheers,
Timo
Maxim Cournoyer wrote 4 weeks ago
Re: [PATCH v6 1/3] services: greetd: Improve greeter configurations.
(name . muradm)(address . mail@muradm.net)(address . 75270@debbugs.gnu.org)
87plju5fd0.fsf@gmail.com
Hello,

muradm <mail@muradm.net> writes:

Toggle quote (64 lines)
> Hello,
>
>>> +@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.

> I explicitly named field 'extra-shepherd-requirement' due to its
> implementation. Other places you mention about configure whole
> list of requirements, for instance:
>
> (shepherd-requirement
> mingetty-configuration-shepherd-requirement
> ;; Since the login prompt shows the host
> name, wait
> ;; for the 'host-name' service to be done.
> Also wait
> ;; for udev essentially so that the tty
> text is not
> ;; lost in the middle of kernel messages
> (XXX).
> (default '(user-processes host-name udev
> virtual-terminal))))
>
> ;; .... skipped
>
> (list
> (shepherd-service
> (documentation "Run mingetty on an tty.")
> (provision (list (symbol-append 'term- (string->symbol
> tty))))
>
> (requirement shepherd-requirement)
>
>
> Compared to what 'extra-shepherd-requirement' means:
>
> + (extra-shepherd-requirement greetd-extra-shepherd-requirement
> (default '()))
>
> - (greetd-vt (greetd-terminal-vt tc)))
> + (greetd-vt (greetd-terminal-vt tc))
> + (greetd-requirement (greetd-extra-shepherd-requirement
> tc)))
> (shepherd-service
> (documentation "Minimal and flexible login manager
> daemon")
> - (requirement '(pam user-processes host-name udev
> virtual-terminal))
> + (requirement `(pam user-processes host-name udev
> virtual-terminal
> + ,@greetd-requirement))

I see; that makes sense. Since this is a new field that was added
yesterday, I think it's still time to change it to
extra-shepherd-requirement, if you feel it makes a big enough
difference.

Sorry for not having seen that (I did try to interpret it that way, but
stopped on the default value of '()).

--
Thanks,
Maxim
Maxim Cournoyer wrote 4 weeks ago
(name . muradm)(address . mail@muradm.net)(address . 75270-done@debbugs.gnu.org)
87h6565e66.fsf@gmail.com
Hi,

muradm <mail@muradm.net> writes:

Toggle quote (4 lines)
> I explicitly named field 'extra-shepherd-requirement' due to its
> implementation. Other places you mention about configure whole
> list of requirements, for instance:

[...]

Nevermind my previous message, I've reinstated the
extra-shepherd-requirement naming. Thanks for your explanation.

--
Thanks,
Maxim
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 75270@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 75270
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help