From patchwork Tue Aug 9 19:40:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 41457 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id CF8EA27BBEA; Tue, 9 Aug 2022 20:43:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DBCAD27BBEB for ; Tue, 9 Aug 2022 20:43:21 +0100 (BST) Received: from localhost ([::1]:55000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oLV8L-0005Gu-1H for patchwork@mira.cbaines.net; Tue, 09 Aug 2022 15:43:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oLV82-0005Fw-JL for guix-patches@gnu.org; Tue, 09 Aug 2022 15:43:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oLV82-0001um-BE for guix-patches@gnu.org; Tue, 09 Aug 2022 15:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oLV82-0000hK-5m for guix-patches@gnu.org; Tue, 09 Aug 2022 15:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56699] [PATCH v4] gnu: greetd-service-type: Add greeter-extra-groups config field. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 09 Aug 2022 19:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56699 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: "\(" , 56699@debbugs.gnu.org Received: via spool by 56699-submit@debbugs.gnu.org id=B56699.16600741692662 (code B ref 56699); Tue, 09 Aug 2022 19:43:02 +0000 Received: (at 56699) by debbugs.gnu.org; 9 Aug 2022 19:42:49 +0000 Received: from localhost ([127.0.0.1]:45138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLV7o-0000gs-F5 for submit@debbugs.gnu.org; Tue, 09 Aug 2022 15:42:48 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:33478 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oLV7m-0000gd-55 for 56699@debbugs.gnu.org; Tue, 09 Aug 2022 15:42:47 -0400 Received: from localhost ([127.0.0.1]:40302) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1oLV76-0002Pw-10; Tue, 09 Aug 2022 19:42:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Type:MIME-Version:Message-ID:In-reply-to:Date:Subject:Cc:To :From:References:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=YWzLwADBfpakp/qSi41AVHxSenHDT0X+fp++3cWLXwU=; b=NSWxk/aKoNt0ieDxDO7wHr+qoh D82xcpvPdV5laj8nHCBV4rPxE9DmPRsN/RSqHgbfz4ej1fWxVMX3KA/J2M2Ga6lmRYAWHrdyMS74Z oB8JlAZu0J/KcJD4LYD4AGTUTrCcTEPSKdTocqaIKD8wNTl2Wh0bxdnN/IE7tD1xhj7tGGeIuWxS7 jI6Xt8ao0fZQmjGyvw+GpXulEbsLKRUs8E06Fj3MrPe3s4oedofeEoDh6J7hFIa+H0BphBeKl673J uc3UbBKkobZQtfvyLdwZfUqg+k7fMjLMblf5OYKKeEBhbsdCCfV2l+6oR6g65H02LKCuaRegskeV/ sgAM/kPFsmTp13j7Umb8/YmPVZ/ivdFUJFF2GwLCtvM6inA0QtBh8mHvrowdj2SqIWSdFIj03Ltw8 zkzdTY6AoKCd/F6xafj7IfAULsfNhQmzV8kozmXd9RBx+Qq1DDiiEvPjlo4OR6cISAyviHi/gFzMP Z90NespiuCtYG7c58u392s6r; Received: from muradm by localhost with local (Exim 4.96) (envelope-from ) id 1oLV7a-0007Ky-0p; Tue, 09 Aug 2022 22:42:34 +0300 References: <874jyn20et.fsf@muradm.net> <20220807214804.22323-1-mail@muradm.net> <1d138ba85a305947acc267d995179effd6be0edd.camel@ist.tugraz.at> <87edxqzg95.fsf@muradm.net> User-agent: mu4e 1.8.7; emacs 29.0.50 From: muradm Date: Tue, 09 Aug 2022 22:40:47 +0300 In-reply-to: Message-ID: <8735e5yziu.fsf@muradm.net> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches fixed Liliana Marie Prikler writes: > Am Montag, dem 08.08.2022 um 22:27 +0300 schrieb muradm: >> >> Liliana Marie Prikler 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 From d92efe5c5f26645513911ac11ec8876681768b4b Mon Sep 17 00:00:00 2001 From: muradm 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. (): 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? (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