From patchwork Sun Aug 7 21:48:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 41348 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 84EB127BBEA; Sun, 7 Aug 2022 22:49:13 +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 9734127BBE9 for ; Sun, 7 Aug 2022 22:49:12 +0100 (BST) Received: from localhost ([::1]:48002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKo91-0003H5-Ok for patchwork@mira.cbaines.net; Sun, 07 Aug 2022 17:49:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKo8s-0003FU-J4 for guix-patches@gnu.org; Sun, 07 Aug 2022 17:49:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKo8s-0002AO-AS for guix-patches@gnu.org; Sun, 07 Aug 2022 17:49:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKo8s-0000FN-68 for guix-patches@gnu.org; Sun, 07 Aug 2022 17:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57047] [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: Sun, 07 Aug 2022 21:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57047 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56699@debbugs.gnu.org, Liliana Marie Prikler Cc: paren@disroot.org, 57047@debbugs.gnu.org X-Debbugs-Original-Cc: "\(" , guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.1659908897883 (code B ref -1); Sun, 07 Aug 2022 21:49:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Aug 2022 21:48:17 +0000 Received: from localhost ([127.0.0.1]:38423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKo88-0000EA-Am for submit@debbugs.gnu.org; Sun, 07 Aug 2022 17:48:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:35308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKo87-0000E3-DC for submit@debbugs.gnu.org; Sun, 07 Aug 2022 17:48:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKo87-0003F4-6z for guix-patches@gnu.org; Sun, 07 Aug 2022 17:48:15 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:34170 helo=nomad-cl1.muradm.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKo85-00028T-Lc for guix-patches@gnu.org; Sun, 07 Aug 2022 17:48:14 -0400 Received: from localhost ([127.0.0.1]:48752) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1oKo7V-0001ZE-22; Sun, 07 Aug 2022 21:47:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=Iyo7Kt/OBpisvavYZ9vzVLreMLacPDasYHjYyUdAVM4=; b=QVym5EFbwuxWJSwOS1JVRYaBPj x0RD0BGWhLIKFMOEEuF4IBVcz4i94wO78cUNESeUgH56zbGPQBAx6vatNsgvfeh30eO4CmkqDs6h8 ACdz5hrqPKEtENBSS//quOuVN2lPy3uIp5SvzV71WkzF8wBs6G9bIA51lHMTH6tUwTBX7/hUGXCs9 4JuyK2pAup/7TbWOEgz1CoARr50RQvKfRl11BgIO5WmlLT3N4CJlTOW6m8K6hp2xMmTOj0QPbDZYC 2K7Z82cffZpiIK26hzg4BTx3S4dnpzOEe0smMAo9xmgfKypHXub0KTpQnczenGjUMcq4UxsgaJtkr eiPC6yYNabctwaL+KV2itLeVxdqHIxaspkHvGGOU91E8VYgs426IU2Jxdtg6+GcwlgO6dFoCup4VV tI1bcQP+IGXipgmo2X+Cyk7se3ZbBZlRFUnFXAeFaXTJcKp+xYRi4fijo8WI0ld6l7xx8wt2w7Ku1 FXxY54qTnPFn+PW2IdE69f3F; Received: from muradm by localhost with local (Exim 4.96) (envelope-from ) id 1oKo7w-0005oB-21; Mon, 08 Aug 2022 00:48:04 +0300 From: muradm Date: Mon, 8 Aug 2022 00:48:04 +0300 Message-Id: <20220807214804.22323-1-mail@muradm.net> X-Mailer: git-send-email 2.37.1 In-Reply-To: <874jyn20et.fsf@muradm.net> References: <874jyn20et.fsf@muradm.net> MIME-Version: 1.0 Received-SPF: pass client-ip=139.162.159.157; envelope-from=mail@muradm.net; helo=nomad-cl1.muradm.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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 * gnu/services/base.scm (greetd-service-type): Added configurable groups. [extensions]: Switching accounts-service-type from const to function. (): 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? (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