unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: muradm <mail@muradm.net>
To: 56699@debbugs.gnu.org,
	Liliana Marie Prikler <liliana.prikler@ist.tugraz.at>
Cc: paren@disroot.org, 57047@debbugs.gnu.org
Subject: [bug#57047] [PATCH v2] gnu: greetd-service-type: Add greeter-extra-groups config field.
Date: Mon,  8 Aug 2022 00:48:04 +0300	[thread overview]
Message-ID: <20220807214804.22323-1-mail@muradm.net> (raw)
In-Reply-To: <874jyn20et.fsf@muradm.net>

* gnu/services/base.scm (greetd-service-type): Added configurable groups.
[extensions]: Switching accounts-service-type from const to function.
(<greetd-configuration>): Added greeter-groups field of type list.
(greetd-accounts-service): New variable, function returning list necessary
accounts for accounts-service-type, including the greeter-extra-groups.
(%greetd-accounts): Removed.
* gnu/tests/desktop.scm (%minimal-services): Add test for greeter-groups.
* doc/guix.texi: Mention greeter-extra-groups field with example.
---
 doc/guix.texi         |  8 ++++++++
 gnu/services/base.scm | 24 +++++++++++-------------
 gnu/tests/desktop.scm |  7 +++++++
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 21cee4e369..2b09bea3b0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -18509,6 +18509,14 @@ the 'root' account has just been created.
 @item @code{terminals} (default: @code{'()})
 List of @code{greetd-terminal-configuration} per terminal for which
 @code{greetd} should be started.
+
+@item @code{greeter-groups} (default: @code{'()})
+List of groups which should be added to @code{greeter} user. For instance:
+@lisp
+(greeter-groups '("seat" "video"))
+@end lisp
+Note that, however it will fail if @code{seatd-service-type} is not present,
+or to be more specific, @code{seat} group is not present.
 @end table
 @end deftp
 
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 27eae75c46..85de6decfe 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -2918,17 +2918,6 @@ (define (make-greetd-terminal-configuration-file config)
      "user = " default-session-user "\n"
      "command = " default-session-command "\n")))
 
-(define %greetd-accounts
-  (list (user-account
-         (name "greeter")
-         (group "greeter")
-         ;; video group is required for graphical greeters.
-         (supplementary-groups '("video"))
-         (system? #t))
-        (user-group
-         (name "greeter")
-         (system? #t))))
-
 (define %greetd-file-systems
   (list (file-system
           (device "none")
@@ -2956,7 +2945,16 @@ (define-record-type* <greetd-configuration>
   greetd-configuration?
   (motd greetd-motd (default %default-motd))
   (allow-empty-passwords? greetd-allow-empty-passwords? (default #t))
-  (terminals greetd-terminals (default '())))
+  (terminals greetd-terminals (default '()))
+  (greeter-groups greetd-greeter-groups (default '())))
+
+(define (greetd-accounts-service config)
+  (list (user-group (name "greeter") (system? #t))
+        (user-account
+         (name "greeter")
+         (group "greeter")
+         (supplementary-groups (greetd-greeter-groups config))
+         (system? #t))))
 
 (define (make-greetd-pam-mount-conf-file config)
   (computed-file
@@ -3033,7 +3031,7 @@ (define greetd-service-type
 login manager daemon.")
    (extensions
     (list
-     (service-extension account-service-type (const %greetd-accounts))
+     (service-extension account-service-type greetd-accounts-service)
      (service-extension file-system-service-type (const %greetd-file-systems))
      (service-extension etc-service-type greetd-etc-service)
      (service-extension pam-root-service-type greetd-pam-service)
diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm
index 25971f9225..ef4a7e0ec9 100644
--- a/gnu/tests/desktop.scm
+++ b/gnu/tests/desktop.scm
@@ -122,6 +122,7 @@ (define %minimal-services
     (service seatd-service-type)
     (service greetd-service-type
              (greetd-configuration
+              (greeter-groups '("input" "video"))
               (terminals
                (list
                 ;; we can make any terminal active by default
@@ -286,6 +287,12 @@ (define (greetd-pid-to-sock pid)
               (marionette-type "echo alice > /run/user/1000/test\n" marionette)
               (file-get-all-strings "/run/user/1000/test")))
 
+          (test-equal "check greeter user has correct groups"
+            "greeter input video\n"
+            (begin
+              (marionette-type "id -Gn greeter > /run/user/1000/greeter-groups\n" marionette)
+              (file-get-all-strings "/run/user/1000/greeter-groups")))
+
           (test-assert "screendump"
             (begin
               (marionette-control (string-append "screendump " #$output
-- 
2.37.1





  reply	other threads:[~2022-08-07 21:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 11:45 [bug#56699] [PATCH] gnu: greetd-service-type: Add greeter-extra-groups config field muradm
2022-07-24 16:31 ` ( via Guix-patches via
2022-08-05  6:44   ` muradm
2022-08-05  7:54     ` Liliana Marie Prikler
2022-08-07 21:42       ` [bug#56699] [PATCH v2] " muradm
2022-08-07 21:48         ` muradm [this message]
2022-08-07 21:56           ` [bug#57047] " muradm
2022-08-08  5:41           ` [bug#56699] " Liliana Marie Prikler
2022-08-08 19:27             ` muradm
2022-08-09  6:25               ` Liliana Marie Prikler
2022-08-09 19:40                 ` [bug#56699] [PATCH v4] " muradm
2022-08-10  7:49                   ` Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220807214804.22323-1-mail@muradm.net \
    --to=mail@muradm.net \
    --cc=56699@debbugs.gnu.org \
    --cc=57047@debbugs.gnu.org \
    --cc=liliana.prikler@ist.tugraz.at \
    --cc=paren@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).