* [bug#56699] [PATCH] gnu: greetd-service-type: Add greeter-extra-groups config field. @ 2022-07-22 11:45 muradm 2022-07-24 16:31 ` ( via Guix-patches via 0 siblings, 1 reply; 12+ messages in thread From: muradm @ 2022-07-22 11:45 UTC (permalink / raw) To: 56699 * gnu/services/base.scm (greetd-service-type): Added configurable groups. [extensions]: Switching accounts-service-type from const to function. (<greetd-configuration>): Added greeter-extra-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. * doc/guix.texi: Mention greeter-extra-groups field with example. --- doc/guix.texi | 8 ++++++++ gnu/services/base.scm | 28 +++++++++++++++------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3c5864ec1a..51678b7f19 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18493,6 +18493,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-extra-groups} (default: @code{'()}) +List of groups which should be added to @code{greeter} user. For instance: +@lisp +(greeter-extra-groups '("seat")) +@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..94c8dcac2a 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,20 @@ (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-extra-groups greetd-greeter-extra-groups (default '()))) + +(define (greetd-accounts-service config) + (list (user-group (name "greeter") (system? #t)) + (user-account + (name "greeter") + (group "greeter") + ;; video group is required for graphical greeters. + (supplementary-groups + (append + '("video") + (greetd-greeter-extra-groups config))) + (system? #t)))) (define (make-greetd-pam-mount-conf-file config) (computed-file @@ -3033,7 +3035,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) -- 2.36.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH] gnu: greetd-service-type: Add greeter-extra-groups config field. 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 0 siblings, 1 reply; 12+ messages in thread From: ( via Guix-patches via @ 2022-07-24 16:31 UTC (permalink / raw) To: muradm, 56699 On Fri Jul 22, 2022 at 12:45 PM BST, muradm wrote: > + ;; video group is required for graphical greeters. > + (supplementary-groups > + (append > + '("video") > + (greetd-greeter-extra-groups config))) Change to (cons "video" (greetd-greeter-extra-groups config)) or maybe use cons* if you think there's a possibility that more groups will later need to be added. Otherwise SGTM :) -- ( ^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-07-24 16:31 ` ( via Guix-patches via @ 2022-08-05 6:44 ` muradm 2022-08-05 7:54 ` Liliana Marie Prikler 0 siblings, 1 reply; 12+ messages in thread From: muradm @ 2022-08-05 6:44 UTC (permalink / raw) To: (; +Cc: 56699 [-- Attachment #1: Type: text/plain, Size: 787 bytes --] supplimentary-groups receiving a list, so I find it more informative when adding apples with apples. And yes with high enough chance more groups could be added to the list of defaults. Is there any preference on using cons* in favour of more readable append? thanks in advance, muradm "(" <paren@disroot.org> writes: > On Fri Jul 22, 2022 at 12:45 PM BST, muradm wrote: >> + ;; video group is required for graphical greeters. >> + (supplementary-groups >> + (append >> + '("video") >> + (greetd-greeter-extra-groups config))) > Change to (cons "video" (greetd-greeter-extra-groups config)) or > maybe > use cons* if you think there's a possibility that more groups > will later > need to be added. > > Otherwise SGTM :) > > -- ( [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-05 6:44 ` muradm @ 2022-08-05 7:54 ` Liliana Marie Prikler 2022-08-07 21:42 ` [bug#56699] [PATCH v2] " muradm 0 siblings, 1 reply; 12+ messages in thread From: Liliana Marie Prikler @ 2022-08-05 7:54 UTC (permalink / raw) To: muradm, (; +Cc: 56699 Am Freitag, dem 05.08.2022 um 09:44 +0300 schrieb muradm: > supplimentary-groups receiving a list, so I find it more > informative when adding apples with apples. And yes with high enough > chance more groups could be added to the list of defaults. What are "the defaults" here, though? A sequence of hard-coded values known at compile time. There is no need to make that sequence a list. > Is there any preference on using cons* in favour of more readable > append? Use of cons or cons* signals that you are only expecting user-supplied groups to be a list and everything else known values. Use of append on the other hand signals that you are expecting multiple lists, which even if you did are not currently present. Cheers ^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH v2] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-05 7:54 ` Liliana Marie Prikler @ 2022-08-07 21:42 ` muradm 2022-08-07 21:48 ` [bug#57047] " muradm 0 siblings, 1 reply; 12+ messages in thread From: muradm @ 2022-08-07 21:42 UTC (permalink / raw) To: Liliana Marie Prikler; +Cc: paren, 56699 [-- Attachment #1: Type: text/plain, Size: 969 bytes --] Correct, no defaults are given. Attached is v2. Defaults non existent, append/cons* irrelevant. thanks in advance, muradm Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes: > Am Freitag, dem 05.08.2022 um 09:44 +0300 schrieb muradm: >> supplimentary-groups receiving a list, so I find it more >> informative when adding apples with apples. And yes with high >> enough >> chance more groups could be added to the list of defaults. > What are "the defaults" here, though? A sequence of hard-coded > values > known at compile time. There is no need to make that sequence a > list. > >> Is there any preference on using cons* in favour of more >> readable >> append? > Use of cons or cons* signals that you are only expecting > user-supplied > groups to be a list and everything else known values. Use of > append on > the other hand signals that you are expecting multiple lists, > which > even if you did are not currently present. > > Cheers [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#57047] [PATCH v2] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-07 21:42 ` [bug#56699] [PATCH v2] " muradm @ 2022-08-07 21:48 ` muradm 2022-08-07 21:56 ` muradm 2022-08-08 5:41 ` [bug#56699] " Liliana Marie Prikler 0 siblings, 2 replies; 12+ messages in thread From: muradm @ 2022-08-07 21:48 UTC (permalink / raw) To: 56699, Liliana Marie Prikler; +Cc: paren, 57047 * 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 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#57047] [PATCH v2] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-07 21:48 ` [bug#57047] " muradm @ 2022-08-07 21:56 ` muradm 2022-08-08 5:41 ` [bug#56699] " Liliana Marie Prikler 1 sibling, 0 replies; 12+ messages in thread From: muradm @ 2022-08-07 21:56 UTC (permalink / raw) To: 57047, control [-- Attachment #1: Type: text/plain, Size: 29 bytes --] close should not be opened [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH v2] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-07 21:48 ` [bug#57047] " muradm 2022-08-07 21:56 ` muradm @ 2022-08-08 5:41 ` Liliana Marie Prikler 2022-08-08 19:27 ` muradm 1 sibling, 1 reply; 12+ messages in thread From: Liliana Marie Prikler @ 2022-08-08 5:41 UTC (permalink / raw) To: muradm, 56699; +Cc: ( Am Montag, dem 08.08.2022 um 00:48 +0300 schrieb muradm: > --- > 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. Note that this example will fail if the @code{seat} group does not exist. > + (greeter-groups greetd-greeter-groups (default '()))) I think, we can err a little on the side of verbosity here and make clear that it's greeter-supplementary-groups. Other than that LGTM ^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH v2] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-08 5:41 ` [bug#56699] " Liliana Marie Prikler @ 2022-08-08 19:27 ` muradm 2022-08-09 6:25 ` Liliana Marie Prikler 0 siblings, 1 reply; 12+ messages in thread From: muradm @ 2022-08-08 19:27 UTC (permalink / raw) To: Liliana Marie Prikler; +Cc: (, 56699 [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.1: v3-0001-gnu-greetd-service-type-Add-greeter-extra-groups-.patch --] [-- Type: text/x-patch, Size: 4847 bytes --] From c8ba263cd3323c06cd3044243347e76a85cb9628 Mon Sep 17 00:00:00 2001 From: muradm <mail@muradm.net> Date: Fri, 22 Jul 2022 14:28:57 +0300 Subject: [PATCH v3] gnu: greetd-service-type: Add greeter-extra-groups config field. To: 56699@debbugs.gnu.org * gnu/services/base.scm (greetd-service-type): Added configurable supplementary groups. [extensions]: Switching accounts-service-type from const to function. (<greetd-configuration>): Added greeter-supplementary-groups field. (greetd-accounts-service): New variable, function returning list necessary accounts for accounts-service-type, including the greeter-supplementary-groups. (%greetd-accounts): Removed. * gnu/tests/desktop.scm (%minimal-services): Add test for greeter-supplementary-groups. * doc/guix.texi: Mention greeter-supplementary-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 9a6a5c307d..8eda5bb2c0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18541,6 +18541,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-supplementary-groups} (default: @code{'()}) +List of groups which should be added to @code{greeter} user. For instance: +@lisp +(greeter-supplementary-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..251196b108 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-supplementary-groups greetd-greeter-supplementary-groups (default '()))) + +(define (greetd-accounts-service config) + (list (user-group (name "greeter") (system? #t)) + (user-account + (name "greeter") + (group "greeter") + (supplementary-groups (greetd-greeter-supplementary-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..f20423f0aa 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-supplementary-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 [-- Attachment #1.2: Type: text/plain, Size: 1444 bytes --] Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes: > Am Montag, dem 08.08.2022 um 00:48 +0300 schrieb muradm: >> --- >> 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. > Note that this example will fail if the @code{seat} group does > not > exist. Which is stated right on the next line. >> + (greeter-groups greetd-greeter-groups (default '()))) > I think, we can err a little on the side of verbosity here and > make > clear that it's greeter-supplementary-groups. done > Other than that LGTM [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH v2] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-08 19:27 ` muradm @ 2022-08-09 6:25 ` Liliana Marie Prikler 2022-08-09 19:40 ` [bug#56699] [PATCH v4] " muradm 0 siblings, 1 reply; 12+ messages in thread From: Liliana Marie Prikler @ 2022-08-09 6:25 UTC (permalink / raw) To: muradm; +Cc: (, 56699 Am Montag, dem 08.08.2022 um 22:27 +0300 schrieb muradm: > > Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes: > > > Am Montag, dem 08.08.2022 um 00:48 +0300 schrieb muradm: > > > --- > > > 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. > > Note that this example will fail if the @code{seat} group does > > not exist. > Which is stated right on the next line. In a convoluted way. "Note that this example will fail if the @code{seat} group does not exist." is imho easier on the reader. Cheers ^ permalink raw reply [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH v4] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-09 6:25 ` Liliana Marie Prikler @ 2022-08-09 19:40 ` muradm 2022-08-10 7:49 ` Liliana Marie Prikler 0 siblings, 1 reply; 12+ messages in thread From: muradm @ 2022-08-09 19:40 UTC (permalink / raw) To: Liliana Marie Prikler; +Cc: (, 56699 [-- Attachment #1.1: Type: text/plain, Size: 8 bytes --] fixed [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1.2: v4-0001-gnu-greetd-service-type-Add-greeter-extra-groups-.patch --] [-- Type: text/x-patch, Size: 4780 bytes --] From d92efe5c5f26645513911ac11ec8876681768b4b Mon Sep 17 00:00:00 2001 From: muradm <mail@muradm.net> Date: Fri, 22 Jul 2022 14:28:57 +0300 Subject: [PATCH v4] gnu: greetd-service-type: Add greeter-extra-groups config field. To: 56699@debbugs.gnu.org * gnu/services/base.scm (greetd-service-type): Added configurable supplementary groups. [extensions]: Switching accounts-service-type from const to function. (<greetd-configuration>): Added greeter-supplementary-groups field. (greetd-accounts-service): New variable, function returning list necessary accounts for accounts-service-type, including the greeter-supplementary-groups. (%greetd-accounts): Removed. * gnu/tests/desktop.scm (%minimal-services): Add test for greeter-supplementary-groups. * doc/guix.texi: Mention greeter-supplementary-groups field with example. --- doc/guix.texi | 7 +++++++ gnu/services/base.scm | 24 +++++++++++------------- gnu/tests/desktop.scm | 7 +++++++ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 896c830aeb..3f04a32f2d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18554,6 +18554,13 @@ 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-supplementary-groups} (default: @code{'()}) +List of groups which should be added to @code{greeter} user. For instance: +@lisp +(greeter-supplementary-groups '("seat" "video")) +@end lisp +Note that, this example will fail if @code{seat} group does not exist. @end table @end deftp diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 27eae75c46..251196b108 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-supplementary-groups greetd-greeter-supplementary-groups (default '()))) + +(define (greetd-accounts-service config) + (list (user-group (name "greeter") (system? #t)) + (user-account + (name "greeter") + (group "greeter") + (supplementary-groups (greetd-greeter-supplementary-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..f20423f0aa 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-supplementary-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 [-- Attachment #1.3: Type: text/plain, Size: 1657 bytes --] Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes: > Am Montag, dem 08.08.2022 um 22:27 +0300 schrieb muradm: >> >> Liliana Marie Prikler <liliana.prikler@ist.tugraz.at> writes: >> >> > Am Montag, dem 08.08.2022 um 00:48 +0300 schrieb muradm: >> > > --- >> > > 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. >> > Note that this example will fail if the @code{seat} group >> > does >> > not exist. >> Which is stated right on the next line. > In a convoluted way. "Note that this example will fail if the > @code{seat} group does not exist." is imho easier on the reader. > > Cheers [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [bug#56699] [PATCH v4] gnu: greetd-service-type: Add greeter-extra-groups config field. 2022-08-09 19:40 ` [bug#56699] [PATCH v4] " muradm @ 2022-08-10 7:49 ` Liliana Marie Prikler 0 siblings, 0 replies; 12+ messages in thread From: Liliana Marie Prikler @ 2022-08-10 7:49 UTC (permalink / raw) To: muradm; +Cc: (, 56699 Am Dienstag, dem 09.08.2022 um 22:40 +0300 schrieb muradm: > fixed v4 LGTM ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-08-10 7:50 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 ` [bug#57047] " muradm 2022-08-07 21:56 ` 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
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).