From patchwork Mon Aug 8 19:27:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 41416 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 AE32D27BBEA; Mon, 8 Aug 2022 20:30:20 +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 118C627BBE9 for ; Mon, 8 Aug 2022 20:30:20 +0100 (BST) Received: from localhost ([::1]:32892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oL8SB-0008Gc-1P for patchwork@mira.cbaines.net; Mon, 08 Aug 2022 15:30:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oL8Rv-0008G6-2Z for guix-patches@gnu.org; Mon, 08 Aug 2022 15:30:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52284) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oL8Ru-0000pf-OR for guix-patches@gnu.org; Mon, 08 Aug 2022 15:30:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oL8Ru-0005gO-Fc for guix-patches@gnu.org; Mon, 08 Aug 2022 15:30:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56699] [PATCH v2] 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: Mon, 08 Aug 2022 19:30: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.165998695021749 (code B ref 56699); Mon, 08 Aug 2022 19:30:02 +0000 Received: (at 56699) by debbugs.gnu.org; 8 Aug 2022 19:29:10 +0000 Received: from localhost ([127.0.0.1]:42033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oL8R3-0005eh-DD for submit@debbugs.gnu.org; Mon, 08 Aug 2022 15:29:09 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:52776 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oL8R1-0005eF-7S for 56699@debbugs.gnu.org; Mon, 08 Aug 2022 15:29:07 -0400 Received: from localhost ([127.0.0.1]:45792) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1oL8QM-00026a-2J; Mon, 08 Aug 2022 19:28:26 +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=5Rw59od6HpHxqFSNdFMtsdH9slULq+uXxv2Yips+z+Q=; b=xpwT1uJWXWw6Rmq956W7eHeElR 4+hkqJ3OSWKk3bVaAUY/2e/VS9O9zuVwM7ItGEWGruHivlE/FAVDU0kNfXd/4QxQTfd3fLViveLvH FzoBTJNL/0pnDkSuBaZ3RzN8JxYAKq6/WBuowwEO8DmbBi5g5Q4F5UNz2gyMBhUybrF/umvV/rtln Bnt+DI0txK1miOQtid5WEWTbpE61hLPgDg0EC1PJz+O6cKtMckSiM1sigWG6/gUbR3FKvCIsC85tu ocgbVjpcl79pYJiuViW2XqlHw3xirMtlTnuX8NCyY8W6YwGNp67B96cG6bM/uKa2fxYkl3X7kACJL kjQaEhdZzo7s6W2zhglmGhHPmIOIhuFCip3hwnwgZRUIWUYQkN1jFhdXlF0KVCxQv5UUajEyOvbbW kPAsn3/EkRHIEONRSMCKb3vT4phI6C3QRzh0fwAeL3BMXNuxhab39VJZbxZx074bGLpbz7PZE3/Rr Z08aqyg3TyiuWUi2H85e68uX; Received: from muradm by localhost with local (Exim 4.96) (envelope-from ) id 1oL8Qo-0006hb-2z; Mon, 08 Aug 2022 22:28:54 +0300 References: <874jyn20et.fsf@muradm.net> <20220807214804.22323-1-mail@muradm.net> <1d138ba85a305947acc267d995179effd6be0edd.camel@ist.tugraz.at> User-agent: mu4e 1.8.7; emacs 29.0.50 From: muradm Date: Mon, 08 Aug 2022 22:27:40 +0300 In-reply-to: <1d138ba85a305947acc267d995179effd6be0edd.camel@ist.tugraz.at> Message-ID: <87edxqzg95.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 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. >> +  (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 From c8ba263cd3323c06cd3044243347e76a85cb9628 Mon Sep 17 00:00:00 2001 From: muradm 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. (): 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? (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