* [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations.
@ 2025-01-01 22:47 ` muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 1/3] " muradm
` (5 more replies)
0 siblings, 6 replies; 14+ messages in thread
From: muradm @ 2025-01-01 22:47 UTC (permalink / raw)
To: 75270; +Cc: Ludovic Courtès, Maxim Cournoyer
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
2025-01-01 22:47 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
@ 2025-01-01 22:53 ` muradm
2025-01-03 13:23 ` Nicolas Graves via Guix-patches via
2025-01-01 22:53 ` [bug#75270] [PATCH 2/3] gnu: Add gtkgreet muradm
` (4 subsequent siblings)
5 siblings, 1 reply; 14+ messages in thread
From: muradm @ 2025-01-01 22:53 UTC (permalink / raw)
To: 75270; +Cc: Ludovic Courtès, Maxim Cournoyer
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(-)
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 scale) "\n"
+ (apply string-append
+ (map (match-lambda
+ ((section-name . color)
+ (greetd-wlgreet-color-for-section section-name color)))
+ `(("background" . ,background)
+ ("headline" . ,headline)
+ ("prompt" . ,prompt)
+ ("prompt-error" . ,prompt-error)
+ ("border" . ,border)))))))
(define-record-type* <greetd-wlgreet-sway-session>
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-config greetd-wlgreet-sway-session-sway-config
+ (default (plain-file "greetd-wlgreet-sway-config" "")))
+ (wlgreet greetd-wlgreet-sway-session-wlgreet (default wlgreet))
+ (wlgreet-config greetd-wlgreet-sway-session-wlgreet-config
+ (default (greetd-wlgreet-configuration)))
+ (command greetd-wlgreet-sway-session-command (default (greetd-user-session))))
+
+(define make-greetd-wlgreet-sway-session-sway-config
+ (match-lambda
+ (($ <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-configuration command wlgreet-config))
+ (swaymsg-bin (file-append sway "/bin/swaymsg")))
+ (mixed-text-file
+ "wlgreet-sway-config"
+ "include " sway-config "\n"
+ "xwayland disable\n"
+ "exec \"" wlgreet-bin " --config " wlgreet-config-file "; " swaymsg-bin " exit\"\n")))))
(define-gexp-compiler (greetd-wlgreet-sway-session-compiler
(session <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
- (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
diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm
index ef30442886..1693bbcebf 100644
--- a/gnu/tests/desktop.scm
+++ b/gnu/tests/desktop.scm
@@ -141,13 +141,21 @@ (define %minimal-services
(terminal-vt "2")
(default-session-command
(greetd-agreety-session
- (extra-env '(("MY_VAR" . "1")))
- (xdg-env? #f))))
+ (command
+ (greetd-user-session
+ (extra-env '(("MY_VAR" . "1")))
+ (xdg-env? #f))))))
;; we can use different shell instead of default bash
(greetd-terminal-configuration
(terminal-vt "3")
(default-session-command
- (greetd-agreety-session (command (file-append zsh "/bin/zsh")))))
+ (greetd-agreety-session
+ (command
+ (greetd-user-session
+ (command (file-append zsh "/bin/zsh"))
+ (command-args '())
+ (extra-env '(("MY_VAR" . "1")))
+ (xdg-env? #f))))))
;; we can use any other executable command as greeter
(greetd-terminal-configuration
(terminal-vt "4")
--
2.47.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 2/3] gnu: Add gtkgreet.
2025-01-01 22:47 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 1/3] " muradm
@ 2025-01-01 22:53 ` muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 3/3] services: greetd: Add new gtkgreet greeter muradm
` (3 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: muradm @ 2025-01-01 22:53 UTC (permalink / raw)
To: 75270; +Cc: Sharlatan Hellseher
* gnu/packages/admin.scm (gtkgreet): New variable.
Change-Id: I1ba56f77dc4059ac17d1f8e9f0d89fd0f65cb008
---
gnu/packages/admin.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index dce93e4f3a..e28b59d51c 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -44,7 +44,7 @@
;;; Copyright © 2021 WinterHound <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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 3/3] services: greetd: Add new gtkgreet greeter.
2025-01-01 22:47 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 1/3] " muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 2/3] gnu: Add gtkgreet muradm
@ 2025-01-01 22:53 ` muradm
2025-01-03 11:34 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
` (2 subsequent siblings)
5 siblings, 0 replies; 14+ messages in thread
From: muradm @ 2025-01-01 22:53 UTC (permalink / raw)
To: 75270; +Cc: Ludovic Courtès, Maxim Cournoyer
* 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(+)
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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations.
2025-01-01 22:47 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
` (2 preceding siblings ...)
2025-01-01 22:53 ` [bug#75270] [PATCH 3/3] services: greetd: Add new gtkgreet greeter muradm
@ 2025-01-03 11:34 ` muradm
2025-01-04 16:14 ` [bug#75270] Fwd: [bug#75270] [PATCH 1/3] " Nicolas Graves via Guix-patches via
2025-01-04 16:58 ` [bug#75270] [PATCH v2 0/3] " muradm
5 siblings, 0 replies; 14+ messages in thread
From: muradm @ 2025-01-03 11:34 UTC (permalink / raw)
To: Ludovic Courtès, Maxim Cournoyer, 75270
[-- Attachment #1: Type: text/plain, Size: 608 bytes --]
btw, this will solve 64112, 65769 and 70605.
muradm <mail@muradm.net> writes:
> 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
2025-01-01 22:53 ` [bug#75270] [PATCH 1/3] " muradm
@ 2025-01-03 13:23 ` Nicolas Graves via Guix-patches via
2025-01-03 17:08 ` muradm
0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Graves via Guix-patches via @ 2025-01-03 13:23 UTC (permalink / raw)
To: muradm, 75270; +Cc: Ludovic Courtès, Maxim Cournoyer
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.
> + (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.
> + (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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
2025-01-03 13:23 ` Nicolas Graves via Guix-patches via
@ 2025-01-03 17:08 ` muradm
2025-01-04 10:57 ` Nicolas Graves via Guix-patches via
0 siblings, 1 reply; 14+ messages in thread
From: muradm @ 2025-01-03 17:08 UTC (permalink / raw)
To: Nicolas Graves; +Cc: Ludovic Courtès, 75270, Maxim Cournoyer
[-- Attachment #1: Type: text/plain, Size: 3044 bytes --]
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).
>> + (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.
>> + (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`.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
2025-01-03 17:08 ` muradm
@ 2025-01-04 10:57 ` Nicolas Graves via Guix-patches via
2025-01-04 13:36 ` muradm
0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Graves via Guix-patches via @ 2025-01-04 10:57 UTC (permalink / raw)
To: muradm; +Cc: Ludovic Courtès, 75270, Maxim Cournoyer
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?
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
2025-01-04 10:57 ` Nicolas Graves via Guix-patches via
@ 2025-01-04 13:36 ` muradm
0 siblings, 0 replies; 14+ messages in thread
From: muradm @ 2025-01-04 13:36 UTC (permalink / raw)
To: Nicolas Graves; +Cc: Ludovic Courtès, 75270, Maxim Cournoyer
[-- Attachment #1: Type: text/plain, Size: 3210 bytes --]
Nicolas Graves <ngraves@ngraves.fr> writes:
> 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.
> 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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] Fwd: [bug#75270] [PATCH 1/3] services: greetd: Improve greeter configurations.
2025-01-01 22:47 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
` (3 preceding siblings ...)
2025-01-03 11:34 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
@ 2025-01-04 16:14 ` Nicolas Graves via Guix-patches via
2025-01-04 16:58 ` [bug#75270] [PATCH v2 0/3] " muradm
5 siblings, 0 replies; 14+ messages in thread
From: Nicolas Graves via Guix-patches via @ 2025-01-04 16:14 UTC (permalink / raw)
To: 75270
[-- Attachment #1: Type: text/plain, Size: 268 bytes --]
-------------------- 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
[-- Attachment #2.1: Type: text/plain, Size: 2959 bytes --]
Nicolas Graves <ngraves@ngraves.fr> writes:
> 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.
> 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>`.
> 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.
[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #3: Type: text/plain, Size: 101 bytes --]
-------------------- End of forwarded message --------------------
--
Best regards,
Nicolas Graves
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH v2 0/3] services: greetd: Improve greeter configurations.
2025-01-01 22:47 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
` (4 preceding siblings ...)
2025-01-04 16:14 ` [bug#75270] Fwd: [bug#75270] [PATCH 1/3] " Nicolas Graves via Guix-patches via
@ 2025-01-04 16:58 ` muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 1/3] " muradm
` (2 more replies)
5 siblings, 3 replies; 14+ messages in thread
From: muradm @ 2025-01-04 16:58 UTC (permalink / raw)
To: 75270; +Cc: Ludovic Courtès, Maxim Cournoyer
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH v2 1/3] services: greetd: Improve greeter configurations.
2025-01-04 16:58 ` [bug#75270] [PATCH v2 0/3] " muradm
@ 2025-01-04 16:58 ` muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 2/3] gnu: Add gtkgreet muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 3/3] services: greetd: Add new gtkgreet greeter muradm
2 siblings, 0 replies; 14+ messages in thread
From: muradm @ 2025-01-04 16:58 UTC (permalink / raw)
To: 75270; +Cc: Ludovic Courtès, Maxim Cournoyer
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(-)
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
+ (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-config 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 scale) "\n"
+ (apply string-append
+ (map (match-lambda
+ ((section-name . color)
+ (greetd-wlgreet-color-for-section section-name color)))
+ `(("background" . ,background)
+ ("headline" . ,headline)
+ ("prompt" . ,prompt)
+ ("prompt-error" . ,prompt-error)
+ ("border" . ,border)))))))
(define-record-type* <greetd-wlgreet-sway-session>
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-config greetd-wlgreet-sway-session-sway-config
+ (default (plain-file "greetd-wlgreet-sway-config" "")))
+ (wlgreet greetd-wlgreet-sway-session-wlgreet (default wlgreet))
+ (wlgreet-config greetd-wlgreet-sway-session-wlgreet-config
+ (default (greetd-wlgreet-configuration)))
+ (command greetd-wlgreet-sway-session-command (default (greetd-user-session))))
+
+(define make-greetd-wlgreet-sway-session-sway-config
+ (match-lambda
+ (($ <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")))))
(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
- (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
@@ -3613,7 +3631,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
@@ -3663,6 +3682,12 @@ (define (greetd-pam-service config)
(list optional-pam-mount))))
pam))))))
+(define (greetd-run-user-activation config)
+ #~(begin
+ (let ((directory "/run/user"))
+ (mkdir directory #o755)
+ (chmod directory #o755))))
+
(define (greetd-shepherd-services config)
(map
(lambda (tc)
@@ -3694,6 +3719,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 ef30442886..1693bbcebf 100644
--- a/gnu/tests/desktop.scm
+++ b/gnu/tests/desktop.scm
@@ -141,13 +141,21 @@ (define %minimal-services
(terminal-vt "2")
(default-session-command
(greetd-agreety-session
- (extra-env '(("MY_VAR" . "1")))
- (xdg-env? #f))))
+ (command
+ (greetd-user-session
+ (extra-env '(("MY_VAR" . "1")))
+ (xdg-env? #f))))))
;; we can use different shell instead of default bash
(greetd-terminal-configuration
(terminal-vt "3")
(default-session-command
- (greetd-agreety-session (command (file-append zsh "/bin/zsh")))))
+ (greetd-agreety-session
+ (command
+ (greetd-user-session
+ (command (file-append zsh "/bin/zsh"))
+ (command-args '())
+ (extra-env '(("MY_VAR" . "1")))
+ (xdg-env? #f))))))
;; we can use any other executable command as greeter
(greetd-terminal-configuration
(terminal-vt "4")
--
2.47.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH v2 2/3] gnu: Add gtkgreet.
2025-01-04 16:58 ` [bug#75270] [PATCH v2 0/3] " muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 1/3] " muradm
@ 2025-01-04 16:58 ` muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 3/3] services: greetd: Add new gtkgreet greeter muradm
2 siblings, 0 replies; 14+ messages in thread
From: muradm @ 2025-01-04 16:58 UTC (permalink / raw)
To: 75270; +Cc: Sharlatan Hellseher
* gnu/packages/admin.scm (gtkgreet): New variable.
Change-Id: I364dff198e0a01c88f5172416fb42cb410dbe48f
---
gnu/packages/admin.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 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
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [bug#75270] [PATCH v2 3/3] services: greetd: Add new gtkgreet greeter.
2025-01-04 16:58 ` [bug#75270] [PATCH v2 0/3] " muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 1/3] " muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 2/3] gnu: Add gtkgreet muradm
@ 2025-01-04 16:58 ` muradm
2 siblings, 0 replies; 14+ messages in thread
From: muradm @ 2025-01-04 16:58 UTC (permalink / raw)
To: 75270; +Cc: Ludovic Courtès, Maxim Cournoyer
* 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(+)
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
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-01-04 16:59 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <87jzbar8oa.fsf@muradm.net>
2025-01-01 22:47 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 1/3] " muradm
2025-01-03 13:23 ` Nicolas Graves via Guix-patches via
2025-01-03 17:08 ` muradm
2025-01-04 10:57 ` Nicolas Graves via Guix-patches via
2025-01-04 13:36 ` muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 2/3] gnu: Add gtkgreet muradm
2025-01-01 22:53 ` [bug#75270] [PATCH 3/3] services: greetd: Add new gtkgreet greeter muradm
2025-01-03 11:34 ` [bug#75270] [PATCH 0/3] services: greetd: Improve greeter configurations muradm
2025-01-04 16:14 ` [bug#75270] Fwd: [bug#75270] [PATCH 1/3] " Nicolas Graves via Guix-patches via
2025-01-04 16:58 ` [bug#75270] [PATCH v2 0/3] " muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 1/3] " muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 2/3] gnu: Add gtkgreet muradm
2025-01-04 16:58 ` [bug#75270] [PATCH v2 3/3] services: greetd: Add new gtkgreet greeter muradm
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.