From patchwork Mon Jun 13 08:45:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 39932 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 62F3E27BBEA; Mon, 13 Jun 2022 09:56:12 +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 1741F27BBE9 for ; Mon, 13 Jun 2022 09:56:12 +0100 (BST) Received: from localhost ([::1]:60446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0frn-0001Kz-7s for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 04:56:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0fix-0006nv-EB for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0fix-0001PE-5e for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0fix-0004mB-4H for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v10 1/7] gnu: crates-io: Add rust-enquote 1.1.0 and rust-pam-sys 0.5.6. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 08:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49969@debbugs.gnu.org Received: via spool by 49969-submit@debbugs.gnu.org id=B49969.165510998118252 (code B ref 49969); Mon, 13 Jun 2022 08:47:03 +0000 Received: (at 49969) by debbugs.gnu.org; 13 Jun 2022 08:46:21 +0000 Received: from localhost ([127.0.0.1]:57235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fiD-0004kF-MY for submit@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:21 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:43512 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi2-0004iw-Oc for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:09 -0400 Received: from localhost ([127.0.0.1]:35034) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0fft-0003eh-QD for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 08:43:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: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=V+rK1wsJVIhhBKOHxw+BWDfP7w+MZ56iotq766UvSP0=; b=piGFtEfnuaTulMSM2sQ4cVvYSb DfSUDyDkj05sbUHtXdMZLpOFiTxvMWTHNjK1HIKE0HC4/qH8lfqE0X3OISotwhE9jjJYTlCcsH4+P 20yDySW2mnN8KL5OC8ECefgVt63iwxNHWco+Jxt7kaToQs42A9CbUqyfVocKZMBcMJozGVUVEnNtU b1nKUi/NkkSoWMDLf1sB/4WwY8ycZmoNigADx35w4tfg74TJxFmFRdn7SjiGGyaU5U2Xn08/cJIZk GkJfwjghBSyzOM47+i6x7YzJaNtPc/tJs+FRWDDorIa5ibuVOdQNhP/jXiO9hy39U4Rn9ZV83YIMV rypagBIPnsUT8/X2GWk8r8kKHhOVIQBL9sz4dsbUHwIYbDzOib2P6dkM2CnNih5LI6FalPVqrEwtF Z3uH8IMFyUnSKmysWufA+OrTT8Cjdrb3oj10PNgHKKczUci5UKe8jRK9tEFsJAXpxSH8jvMnYJyH6 U9nW2zdsl0vTyb0hTxRcwfQl; Received: from muradm by localhost with local (Exim 4.95) (envelope-from ) id 1o0fi1-0000fw-9I for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 11:46:05 +0300 From: muradm Date: Mon, 13 Jun 2022 11:45:58 +0300 Message-Id: <20220613084604.2575-2-mail@muradm.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613084604.2575-1-mail@muradm.net> References: <20220613084604.2575-1-mail@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 * gnu/packages/crates-io.scm (rust-enquote-1): New variable * gnu/packages/crates-io.scm (rust-pam-sys-0.5): New variable --- gnu/packages/crates-io.scm | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 86313f5e4f..9374601bb4 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -19,6 +19,7 @@ ;;; Copyright © 2021 Antero Mejr ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Vinicius Monego +;;; Copyright © 2021 muradm ;;; Copyright © 2021, 2022 Petr Hodina ;;; Copyright © 2021, 2022 Ricardo Wurmus ;;; Copyright © 2021 Jacob Hrbek @@ -73053,3 +73054,42 @@ (define-public rust-shell2batch-0.4 and automatically convert it to a windows batch file, this library provides a way to convert simple shell commands to windows batch commands.") (license license:asl2.0))) + +(define-public rust-enquote-1 + (package + (name "rust-enquote") + (version "1.1.0") + (home-page "https://github.com/reujab/enquote") + (source (origin + (method url-fetch) + (uri (crate-uri "enquote" version)) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0clrjghlfkkb7sndabs5wch0fz2nif6nj4b117s8kqxx3nqnrhq6")))) + (build-system cargo-build-system) + (synopsis "Rust library that quotes, unquotes, and unescapes strings") + (description "A Rust library quotes, unquotes, and unescapes strings") + (license license:unlicense))) + +(define-public rust-pam-sys-0.5 + (package + (name "rust-pam-sys") + (version "0.5.6") + (home-page "https://github.com/1wilkens/pam-sys") + (source (origin + (method url-fetch) + (uri (crate-uri "pam-sys" version)) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0d14501d5vybjnzxfjf96321xa5wa36x1xvf02h02zq938qmhj6d")))) + (build-system cargo-build-system) + (arguments + `(#:cargo-inputs (("rust-libc" ,rust-libc-0.2)))) + (native-inputs `(("linux-pam" ,linux-pam))) + (synopsis + "Rust FFI wrappers for the Linux Pluggable Authentication Modules (PAM)") + (description + "Rust FFI wrappers for the Linux Pluggable Authentication Modules (PAM)") + (license (list license:expat license:asl2.0)))) From patchwork Mon Jun 13 08:45:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 39936 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 A566D27BBEA; Mon, 13 Jun 2022 10:02:52 +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 0561E27BBE9 for ; Mon, 13 Jun 2022 10:02:52 +0100 (BST) Received: from localhost ([::1]:38078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0fyF-0006PL-4M for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 05:02:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35270) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0fix-0006nw-Qs for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35118) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0fix-0001PJ-IB for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0fix-0004mJ-HA for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v10 2/7] gnu: admin: Add greetd 0.8.0. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 08:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49969@debbugs.gnu.org Received: via spool by 49969-submit@debbugs.gnu.org id=B49969.165510998118260 (code B ref 49969); Mon, 13 Jun 2022 08:47:03 +0000 Received: (at 49969) by debbugs.gnu.org; 13 Jun 2022 08:46:21 +0000 Received: from localhost ([127.0.0.1]:57237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fiH-0004kL-37 for submit@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:21 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:43514 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi3-0004iy-PW for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:09 -0400 Received: from localhost ([127.0.0.1]:35036) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0ffu-0003ek-Ps for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 08:43:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: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=RozKN4irD+c6HlJfAmqLSZkvFzhfWCbNGOZYmXWR0n0=; b=DVzlRuWJbcFtYfYn2WWwbIHgwY 2CvTsEqyjWiCzb+SQOwVzCbme8YX/GwQMCYkLnYVTTcDu3JipLUbbyy8/NzjNKc/H5LQByBssU1Vt hLb3fZ+Wlh/Hh8PYUf4A6XjP0EAC2xvrpRAM6W3XJzfVQq5nSy2w+zoYgwesIcL+1dujrZwxW2asZ hoxHkndGjLvYlQF2y1Gi/lWl726jasO67mt7cFYGwI1TCrFb3i/E0rqQfEEuKZ1bD1WrR+i434QMw lVjYuNSbB5Niz1h2dvCxWgPEOKUkNOeECRkim2XnfA+yVlT6b1BPYKXMFQjX/GmVV4C0H9OQrS8b5 6r8XbIyKg0XxwzY+kHyxJWIVT9GkWF7ukkslqPPmwwzg9pZ/K9JRW60QNm7VGpXLGfKiL5/WcBNoQ uVhiPPQDkprV5FMgxDCOe5QloDUQPNER/Fucf6ry6IImMlKDLWsbwi4d0phioqR+pTfsygJZDAKVM mZ1FCcn9KwyMdRn0zmGfRjPW; Received: from muradm by localhost with local (Exim 4.95) (envelope-from ) id 1o0fi2-0000fz-AQ for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 11:46:06 +0300 From: muradm Date: Mon, 13 Jun 2022 11:45:59 +0300 Message-Id: <20220613084604.2575-3-mail@muradm.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613084604.2575-1-mail@muradm.net> References: <20220613084604.2575-1-mail@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 * gnu/packages/admin.scm (greetd): New variable --- gnu/packages/admin.scm | 77 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 6acfff8881..73d70744e1 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -45,6 +45,7 @@ ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2021 muradm ;;; Copyright © 2021 Petr Hodina ;;; Copyright © 2021 Artyom V. Poptsov ;;; Copyright © 2022 Wamm K. D. @@ -66,6 +67,7 @@ ;;; along with GNU Guix. If not, see . (define-module (gnu packages admin) + #:use-module (guix build-system cargo) #:use-module (guix build-system cmake) #:use-module (guix build-system emacs) #:use-module (guix build-system glib-or-gtk) @@ -93,6 +95,7 @@ (define-module (gnu packages admin) #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages compression) + #:use-module (gnu packages crates-io) #:use-module (gnu packages cross-base) #:use-module (gnu packages crypto) #:use-module (gnu packages cryptsetup) @@ -4987,4 +4990,78 @@ (define-public udpcast (home-page "https://www.udpcast.linux.lu") (license license:gpl2+))) +(define-public greetd + (package + (name "greetd") + (version "0.8.0") + (home-page "https://git.sr.ht/~kennylevinsen/greetd") + (source (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0x5c3jkw09kvj2grcxm899y2n6ws8p990cyp9cs0fy6lm4fzlh6v")))) + (build-system cargo-build-system) + (arguments + `(#:cargo-inputs + (("rust-nix" ,rust-nix-0.19) + ("rust-pam-sys" ,rust-pam-sys-0.5) + ("rust-rpassword" ,rust-rpassword-5) + ("rust-users" ,rust-users-0.11) + ("rust-serde" ,rust-serde-1) + ("rust-serde-json" ,rust-serde-json-1) + ("rust-libc" ,rust-libc-0.2) + ("rust-tokio" ,rust-tokio-1) + ("rust-getopts" ,rust-getopts-0.2) + ("rust-thiserror" ,rust-thiserror-1) + ("rust-async-trait" ,rust-async-trait-0.1) + ("rust-enquote" ,rust-enquote-1)) + #:phases + (modify-phases %standard-phases + (delete 'package) + (add-after 'build 'build-man-pages + (lambda* (#:key inputs #:allow-other-keys) + (define (scdoc-cmd doc lvl) + (system (string-append "scdoc < " + doc "-" lvl ".scd > " + doc "." lvl))) + (with-directory-excursion "man" + (scdoc-cmd "greetd" "1") + (scdoc-cmd "greetd" "5") + (scdoc-cmd "greetd-ipc" "7") + (scdoc-cmd "agreety" "1")))) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin")) + (sbin (string-append out "/sbin")) + (share (string-append out "/share")) + (man (string-append share "/man")) + (man1 (string-append man "/man1")) + (man5 (string-append man "/man5")) + (man7 (string-append man "/man7")) + (release "target/release") + (greetd-bin (string-append release "/greetd")) + (agreety-bin (string-append release "/agreety"))) + (install-file greetd-bin sbin) + (install-file agreety-bin bin) + (with-directory-excursion "man" + (install-file "greetd.1" man1) + (install-file "greetd.5" man5) + (install-file "greetd-ipc.7" man7) + (install-file "agreety.1" man1)))))))) + (native-inputs + `(("linux-pam" ,linux-pam) + ("scdoc" ,scdoc))) + (synopsis "minimal and flexible login manager daemon") + (description + "greetd is a minimal and flexible login manager daemon +that makes no assumptions about what you want to launch. +If you can run it from your shell in a TTY, greetd can start it. + +If it can be taught to speak a simple JSON-based IPC protocol, +then it can be a greeter.") + (license license:gpl3+))) From patchwork Mon Jun 13 08:46:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 39933 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 3B15E27BBEA; Mon, 13 Jun 2022 09:56:51 +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 EB08B27BBE9 for ; Mon, 13 Jun 2022 09:56:50 +0100 (BST) Received: from localhost ([::1]:32902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0fsQ-00022d-2k for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 04:56:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0fix-0006nu-33 for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35116) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0fiw-0001P9-Qa for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0fiw-0004m4-MS for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v10 3/7] gnu: admin: Add greetd-pam-mount. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 08:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49969@debbugs.gnu.org Received: via spool by 49969-submit@debbugs.gnu.org id=B49969.165510997018204 (code B ref 49969); Mon, 13 Jun 2022 08:47:02 +0000 Received: (at 49969) by debbugs.gnu.org; 13 Jun 2022 08:46:10 +0000 Received: from localhost ([127.0.0.1]:57225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi6-0004jS-6f for submit@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:10 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:43516 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi4-0004j0-Qc for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:09 -0400 Received: from localhost ([127.0.0.1]:35038) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0ffv-0003en-Qg for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 08:43:55 +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:To:From:Sender:Reply-To:Cc: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=QJcCzGQEbK7Hay3t/cLTMcCKQeBOaopP00hsM6LgYUE=; b=ktpRXa26E8ayj9bbKXfns4R2oJ OsQOM4AUno+KuNeP5pvXI6iq1+QPKLK94gJI7XWZaG/4FVMXXMsGLmHGe06sCVWfUH/m/Nq/KLkHo DyDzQw+qWxne9YwEc2IvjNJLkhnBg4IBA7KGVpFtKXZuoiGrKFKk183qsHeAEbYOwnAyqorElBrxW fsYJfti4Ocj28ss5JsG//gYMgcbiEaIQdfJ2O/Bj1DMEcuUaTv9XPMOjK/qNUYAu3BB+WsEJWD2db Bib4arC8FQixpoGc+MnlH/xnH1kEa6LIv1u0RHlmjUR/Bey58vP5GGAVcYaCRdm8EEiopEBzqTN8g BtYR5yd2LMU5RjmyTEOsR6TCt1SQogAwa50UdDXX+3MUNhI1oWEHuHExKIVW981b/UMDRIlwJfnc2 9lIdX9E+v3cviSqtPXUyVchyXmqoIl0+O+TXEW2IBpxoM9K+r7r/QkzBB532Ux9iKENqZj05JZD7e RE/0YZSagHedBxnTVAilxOgm; Received: from muradm by localhost with local (Exim 4.95) (envelope-from ) id 1o0fi3-0000g2-Am for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 11:46:07 +0300 From: muradm Date: Mon, 13 Jun 2022 11:46:00 +0300 Message-Id: <20220613084604.2575-4-mail@muradm.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613084604.2575-1-mail@muradm.net> References: <20220613084604.2575-1-mail@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 * gnu/packages/admin.scm (greetd-pam-mount): New variable --- gnu/packages/admin.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 73d70744e1..d6e1d819ab 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -5065,3 +5065,35 @@ (define (scdoc-cmd doc lvl) If it can be taught to speak a simple JSON-based IPC protocol, then it can be a greeter.") (license license:gpl3+))) + +(define-public greetd-pam-mount + (package + (inherit pam-mount) + (name "greetd-pam-mount") + (arguments + (substitute-keyword-arguments (package-arguments pam-mount) + ((#:configure-flags flags ''()) + #~(cons* "--with-rundir=/run/greetd" #$flags)) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'patch-config-file-name + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/pam_mount.c" + ((".*define CONFIGFILE .*$") + "#define CONFIGFILE \"/etc/security/greetd_pam_mount.conf.xml\"\n") + (("pam_mount_config") "greetd_pam_mount_config") + (("pam_mount_system_authtok") "greetd_pam_mount_system_authtok")))))))) + (synopsis "pam-mount specifically compiled for use with greetd") + (description + "Pam-mount is a PAM module that can mount volumes when a user logs in. +It supports mounting local filesystems of any kind the normal mount utility +supports. It can also mount encrypted LUKS volumes using the password +supplied by the user when logging in. + +This package inherits pam-mount in the way that it is compiled specifically +for use with greetd daemon. It uses different configuration location and +name space for storing data in PAM. + +greetd-pam-mount is used in configuration of greetd to provide +auto-(mounting/unmounting) of XDG_RUNTIME_DIR in the way that it will not +interfere with default pam-mount configuration."))) From patchwork Mon Jun 13 08:46:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 39934 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 931AA27BBEA; Mon, 13 Jun 2022 09:59:03 +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 CE43C27BBE9 for ; Mon, 13 Jun 2022 09:59:01 +0100 (BST) Received: from localhost ([::1]:35700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0fuW-0004XZ-TD for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 04:59:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0fiy-0006on-F7 for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35119) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0fix-0001PO-VG for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0fix-0004mQ-UC for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v10 4/7] gnu: base: Add greetd-service-type. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 08:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49969@debbugs.gnu.org Received: via spool by 49969-submit@debbugs.gnu.org id=B49969.165510998518273 (code B ref 49969); Mon, 13 Jun 2022 08:47:03 +0000 Received: (at 49969) by debbugs.gnu.org; 13 Jun 2022 08:46:25 +0000 Received: from localhost ([127.0.0.1]:57239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fiH-0004kT-Oz for submit@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:25 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:43518 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi6-0004jK-36 for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:11 -0400 Received: from localhost ([127.0.0.1]:35040) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0ffw-0003eq-U5 for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 08:43:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: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=j2WU1LsszHWe7mflP/Eu6HYcyIxRvEvzFmUrg20g4/w=; b=c1sGUQEYciezdI9HX9/AagiY/z nZJbOmoNiQv1cXnmftR17qF6p1UrPmMtexMbdcYDefdT6tyPpxw40RCK6xt32GsZ3aVJ74yOKIU3m ZrQlptEkmkuNIddOuN3PTzMBPJAyrqGplgTsnsWQqrVDk8NOL110X3w3lk83fhyV2h6DbL5GSKzB9 Y59/PA+rU4Dw5ISmiplO9nlgH1fo+MFshpv7LeqpYgIdzJNhV1HV5oXKxq0ej7CA4TQ0GklvizNzc 0N4PZknWkF01/byOTGhSWk5xK/sKPqd8WXSvXvQ0DteFY8RuUkvLNpoGto2WXx2pT+MdkS9t5/EwQ LZ+MXLNl9BxW/SQW3WKVjKu/Hrit2byx+FKPgSdfbXNFVG4Q3EYNOfJLmRChMIZv22NaKm/1Ctja4 D1mFQRRsUbMvNVYo1Mtq5Wc3fJANgiOVqHXw2i8/CXiKS6/wzZ5y11/pNX5Fi8urDJJVlHIRFuSxh jG2yGrXjRg4kEVKfDQa88c9x; Received: from muradm by localhost with local (Exim 4.95) (envelope-from ) id 1o0fi4-0000g5-C8 for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 11:46:08 +0300 From: muradm Date: Mon, 13 Jun 2022 11:46:01 +0300 Message-Id: <20220613084604.2575-5-mail@muradm.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613084604.2575-1-mail@muradm.net> References: <20220613084604.2575-1-mail@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 * gnu/services/base.scm (greetd-service-type): New variable * gnu/services/base.scm (greetd-configuration): New data type * gnu/services/base.scm (greetd-terminal-configuration): New data type * gnu/services/base.scm (greetd-agreety-session): New data type * gnu/services/base.scm (pam-limits-service-type): Shoul be aware of greetd PAM service * gnu/services/pam-mount.scm (pam-mount-pam-service): Shoul be aware of greetd PAM service --- doc/guix.texi | 137 +++++++++++++++++++++++ gnu/services/base.scm | 223 ++++++++++++++++++++++++++++++++++++- gnu/services/pam-mount.scm | 2 +- 3 files changed, 360 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ea133d519a..997b93c831 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -96,6 +96,7 @@ Copyright @copyright{} 2021 Domagoj Stolfa@* Copyright @copyright{} 2021 Hui Lu@* Copyright @copyright{} 2021 pukkamustard@* Copyright @copyright{} 2021 Alice Brenon@* +Copyright @copyright{} 2021 muradm@* Copyright @copyright{} 2021 Josselin Poiret@* Copyright @copyright{} 2021 Andrew Tropin@* Copyright @copyright{} 2021 Sarah Morgensen@* @@ -18019,6 +18020,142 @@ about the Pluggable Authentication Module (PAM) limits, refer to the @samp{pam_limits} man page from the @code{linux-pam} package. @end deffn +@defvr {Scheme Variable} greetd-service-type +@uref{https://git.sr.ht/~kennylevinsen/greetd, @code{greetd}} is a minimal and +flexible login manager daemon, that makes no assumptions about what you +want to launch. + +If you can run it from your shell in a TTY, greetd can start it. If it +can be taught to speak a simple JSON-based IPC protocol, then it can be +a geeter. + +@code{greetd-service-type} provides necessary infrastructure for logging +in users, including: + +@itemize @bullet +@item +@code{greetd} PAM service + +@item +Special variation of @code{pam-mount} to mount @code{XDG_RUNTIME_DIR} +@end itemize + +Here is example of switching from @code{mingetty-service-type} to +@code{greetd-service-type}, and how different terminals could be: + +@lisp + (append + (modify-services %base-services + ;; greetd-service-type provides "greetd" PAM service + (delete login-service-type) + ;; and can be used in place of mingetty-service-type + (delete mingetty-service-type)) + (list + (service greetd-service-type + (greetd-configuration + (terminals + (list + ;; we can make any terminal active by default + (greetd-terminal-configuration (terminal-vt "1") (terminal-switch #t)) + ;; we can make environment without XDG_RUNTIME_DIR set + ;; even provide our own environment variables + (greetd-terminal-configuration + (terminal-vt "2") + (default-session-command + (greetd-agreety-session + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))) + ;; we can use different shell instead of default bash + (greetd-terminal-configuration + (terminal-vt "3") + (default-session-command + (greetd-agreety-session (command (file-append zsh "/bin/zsh"))))) + ;; we can use any other executable command as greeter + (greetd-terminal-configuration + (terminal-vt "4") + (default-session-command (program-file "my-noop-greeter" #~(exit)))) + (greetd-terminal-configuration (terminal-vt "5")) + (greetd-terminal-configuration (terminal-vt "6")))))) + ;; mingetty-service-type can be used in parallel + ;; if needed to do so, do not (delete login-service-type) + ;; as illustrated above + #| (service mingetty-service-type (mingetty-configuration (tty "tty8"))) |#)) +@end lisp +@end defvr + +@deftp {Data Type} greetd-configuration +Configuration record for the @code{greetd-service-type}. +@table @asis + +@item @code{motd} +A file-like object containing the ``message of the day''. + +@item @code{allow-empty-passwords?} (default: @code{#t}) +Allow empty passwords by default so that first-time users can log in when +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. +@end table +@end deftp + +@deftp {Data Type} greetd-terminal-configuration +Configuration record for per terminal greetd daemon service. + +@table @asis +@item @code{greetd} (default: @code{greetd}) +The greetd package to use. + +@item @code{config-file-name} +Configuration file name to use for greetd daemon. Generally, autogenerated +derivation based on @code{terminal-vt} value. + +@item @code{log-file-name} +Log file name to use for greetd daemon. Generally, autogenerated +name based on @code{terminal-vt} value. + +@item @code{terminal-vt} (default: @samp{"7"}) +The VT to run on. Use of a specific VT with appropriate conflict avoidance +is recommended. + +@item @code{terminal-switch} (default: @code{#f}) +Make this terminal active on start of @code{greetd}. + +@item @code{default-session-user} (default: @samp{"greeter"}) +The user to use for running the greeter. + +@item @code{default-session-command} (default: @code{(greetd-agreety-session)}) +Can be either instance of @code{greetd-agreety-session} configuration or +@code{gexp->script} like object to use as greeter. + +@end table +@end deftp + +@deftp {Data Type} greetd-agreety-session +Configuration record for the agreety greetd greeter. + +@table @asis +@item @code{agreety} (default: @code{greetd}) +The package with @command{/bin/agreety} command. + +@item @code{command} (default: @code{(file-append bash "/bin/bash")}) +Command to be started by @command{/bin/agreety} on successful login. + +@item @code{command-args} (default: @code{'("-l")}) +Command arguments to pass to command. + +@item @code{extra-env} (default: @code{'()}) +Extra environment variables to set on login. + +@item @code{xdg-env?} (default: @code{#t}) +If true @code{XDG_RUNTIME_DIR} and @code{XDG_SESSION_TYPE} will be set +before starting command. One should note that, @code{extra-env} variables +are set right after mentioned variables, so that they can be overriden. + +@end table +@end deftp + @node Scheduled Job Execution @subsection Scheduled Job Execution diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 6865d03f25..0e7bfe7f5a 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -16,6 +16,7 @@ ;;; Copyright © 2021 qblade ;;; Copyright © 2021 Hui Lu ;;; Copyright © 2021, 2022 Maxim Cournoyer +;;; Copyright © 2021 muradm ;;; Copyright © 2022 Guillaume Le Vaillant ;;; ;;; This file is part of GNU Guix. @@ -219,6 +220,11 @@ (define-module (gnu services base) pam-limits-service-type pam-limits-service + greetd-service-type + greetd-configuration + greetd-terminal-configuration + greetd-agreety-session + %base-services)) ;;; Commentary: @@ -1439,7 +1445,7 @@ (define pam-limits-service-type (module "pam_limits.so") (arguments '("conf=/etc/security/limits.conf"))))) (if (member (pam-service-name pam) - '("login" "su" "slim" "gdm-password" "sddm" + '("login" "greetd" "su" "slim" "gdm-password" "sddm" "sudo" "sshd")) (pam-service (inherit pam) @@ -2775,6 +2781,221 @@ (define %qemu-static-networking (provision '(networking)) (name-servers '("10.0.2.3")))) + +;;; +;;; greetd-service-type -- minimal and flexible login manager daemon +;;; + +(define-record-type* + greetd-agreety-session make-greetd-agreety-session + greetd-agreety-session? + (agreety greetd-agreety (default greetd)) + (command greetd-agreety-command (default (file-append bash "/bin/bash"))) + (command-args greetd-agreety-command-args (default '("-l"))) + (extra-env greetd-agreety-extra-env (default '())) + (xdg-env? greetd-agreety-xdg-env? (default #t))) + +(define greetd-agreety-tty-session-command + (match-lambda + (($ _ command args extra-env) + (program-file + "agreety-tty-session-command" + #~(begin + (use-modules (ice-9 match)) + (for-each (match-lambda ((var . val) (setenv var val))) + (quote (#$@extra-env))) + (apply execl #$command #$command (list #$@args))))))) + +(define greetd-agreety-tty-xdg-session-command + (match-lambda + (($ _ command args extra-env) + (program-file + "agreety-tty-xdg-session-command" + #~(begin + (use-modules (ice-9 match)) + (let* + ((username (getenv "USER")) + (useruid (passwd:uid (getpwuid username))) + (useruid (number->string useruid))) + (setenv "XDG_SESSION_TYPE" "tty") + (setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid))) + (for-each (match-lambda ((var . val) (setenv var val))) + (quote (#$@extra-env))) + (apply execl #$command #$command (list #$@args))))))) + +(define (make-greetd-agreety-session-command config command) + (let ((agreety (file-append (greetd-agreety config) "/bin/agreety"))) + (program-file + "agreety-command" + #~(execl #$agreety #$agreety "-c" #$command)))) + +(define (make-greetd-default-session-command config-or-command) + (cond ((greetd-agreety-session? config-or-command) + (cond ((greetd-agreety-xdg-env? config-or-command) + (make-greetd-agreety-session-command + config-or-command + (greetd-agreety-tty-xdg-session-command config-or-command))) + (#t + (make-greetd-agreety-session-command + config-or-command + (greetd-agreety-tty-session-command config-or-command))))) + (#t config-or-command))) + +(define-record-type* + greetd-terminal-configuration make-greetd-terminal-configuration + greetd-terminal-configuration? + (greetd greetd-package (default greetd)) + (config-file-name greetd-config-file-name (thunked) + (default (default-config-file-name this-record))) + (log-file-name greetd-log-file-name (thunked) + (default (default-log-file-name this-record))) + (terminal-vt greetd-terminal-vt (default "7")) + (terminal-switch greetd-terminal-switch (default #f)) + (default-session-user greetd-default-session-user (default "greeter")) + (default-session-command greetd-default-session-command + (default (greetd-agreety-session)) + (sanitize make-greetd-default-session-command))) + +(define (default-config-file-name config) + (string-join (list "config-" (greetd-terminal-vt config) ".toml") "")) + +(define (default-log-file-name config) + (string-join (list "/var/log/greetd-" (greetd-terminal-vt config) ".log") "")) + +(define (make-greetd-terminal-configuration-file config) + (let* + ((config-file-name (greetd-config-file-name config)) + (terminal-vt (greetd-terminal-vt config)) + (terminal-switch (greetd-terminal-switch config)) + (default-session-user (greetd-default-session-user config)) + (default-session-command (greetd-default-session-command config))) + (mixed-text-file + config-file-name + "[terminal]\n" + "vt = " terminal-vt "\n" + "switch = " (if terminal-switch "true" "false") "\n" + "[default_session]\n" + "user = " default-session-user "\n" + "command = " default-session-command "\n"))) + +(define %greetd-accounts + (list (user-account + (name "greeter") + (group "wheel") + (supplementary-groups '("users" "tty" "input" "video" "audio")) + (system? #t)))) + +(define %greetd-file-systems + (list (file-system + (device "none") + (mount-point "/run/greetd/pam_mount") + (type "tmpfs") + (check? #f) + (flags '(no-suid no-dev no-exec)) + (options "mode=0755") + (create-mount-point? #t)))) + +(define %greetd-pam-mount-rules + `((debug (@ (enable "0"))) + (volume (@ (sgrp "users") + (fstype "tmpfs") + (mountpoint "/run/user/%(USERUID)") + (options "noexec,nosuid,nodev,size=1g,mode=0700,uid=%(USERUID),gid=%(USERGID)"))) + (logout (@ (wait "0") + (hup "0") + (term "yes") + (kill "no"))) + (mkmountpoint (@ (enable "1") (remove "true"))))) + +(define-record-type* + greetd-configuration make-greetd-configuration + greetd-configuration? + (motd greetd-motd (default %default-motd)) + (allow-empty-passwords? greetd-allow-empty-passwords? (default #t)) + (terminals greetd-terminals (default '()))) + +(define (make-greetd-pam-mount-conf-file config) + (computed-file + "greetd_pam_mount.conf.xml" + #~(begin + (use-modules (sxml simple)) + (call-with-output-file #$output + (lambda (port) + (sxml->xml + '(*TOP* + (*PI* xml "version='1.0' encoding='utf-8'") + (pam_mount + #$@%greetd-pam-mount-rules + (pmvarrun + #$(file-append greetd-pam-mount + "/sbin/pmvarrun -u '%(USER)' -o '%(OPERATION)'")))) + port)))))) + +(define (greetd-etc-service config) + `(("security/greetd_pam_mount.conf.xml" + ,(make-greetd-pam-mount-conf-file config)))) + +(define (greetd-pam-service config) + (define optional-pam-mount + (pam-entry + (control "optional") + (module #~(string-append #$greetd-pam-mount "/lib/security/pam_mount.so")) + (arguments '("disable_interactive")))) + + (list + (unix-pam-service "greetd" + #:login-uid? #t + #:allow-empty-passwords? + (greetd-allow-empty-passwords? config) + #:motd + (greetd-motd config)) + (lambda (pam) + (if (member (pam-service-name pam) + '("login" "greetd" "su" "slim" "gdm-password")) + (pam-service + (inherit pam) + (auth (append (pam-service-auth pam) + (list optional-pam-mount))) + (session (append (pam-service-session pam) + (list optional-pam-mount)))) + pam)))) + +(define (greetd-shepherd-services config) + (map + (lambda (tc) + (let* + ((greetd-bin (file-append (greetd-package tc) "/sbin/greetd")) + (greetd-conf (make-greetd-terminal-configuration-file tc)) + (greetd-log (greetd-log-file-name tc)) + (greetd-vt (greetd-terminal-vt tc))) + (shepherd-service + (documentation "Minimal and flexible login manager daemon") + (requirement '(user-processes host-name udev virtual-terminal)) + (provision (list (symbol-append + 'term-tty + (string->symbol (greetd-terminal-vt tc))))) + (start #~(make-forkexec-constructor + (list #$greetd-bin "-c" #$greetd-conf) + #:log-file #$greetd-log)) + (stop #~(make-kill-destructor))))) + (greetd-terminals config))) + +(define greetd-service-type + (service-type + (name 'greetd) + (description "Provides necessary infrastructure for logging into the +system including @code{greetd} PAM service, @code{pam-mount} module to +mount/unmount /run/user/ directory for user and @code{greetd} +login manager daemon.") + (extensions + (list + (service-extension account-service-type (const %greetd-accounts)) + (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) + (service-extension shepherd-root-service-type greetd-shepherd-services))) + (default-value (greetd-configuration)))) + (define %base-services ;; Convenience variable holding the basic services. diff --git a/gnu/services/pam-mount.scm b/gnu/services/pam-mount.scm index 33649b0f7c..e60781d05b 100644 --- a/gnu/services/pam-mount.scm +++ b/gnu/services/pam-mount.scm @@ -90,7 +90,7 @@ (define optional-pam-mount (module #~(string-append #$pam-mount "/lib/security/pam_mount.so")))) (list (lambda (pam) (if (member (pam-service-name pam) - '("login" "su" "slim" "gdm-password" "sddm")) + '("login" "greetd" "su" "slim" "gdm-password" "sddm")) (pam-service (inherit pam) (auth (append (pam-service-auth pam) From patchwork Mon Jun 13 08:46:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 39937 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 8B83827BBEA; Mon, 13 Jun 2022 10:04:28 +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 CFED627BBE9 for ; Mon, 13 Jun 2022 10:04:27 +0100 (BST) Received: from localhost ([::1]:38326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0fzm-0006ak-Uc for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 05:04:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0fiz-0006pf-0L for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0fiy-0001Pc-OZ for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0fiy-0004mf-N5 for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v10 5/7] gnu: admin: Add libseat 0.8.0 and move seatd. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 08:47:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49969@debbugs.gnu.org Received: via spool by 49969-submit@debbugs.gnu.org id=B49969.165510998918293 (code B ref 49969); Mon, 13 Jun 2022 08:47:04 +0000 Received: (at 49969) by debbugs.gnu.org; 13 Jun 2022 08:46:29 +0000 Received: from localhost ([127.0.0.1]:57243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fiL-0004ko-PB for submit@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:29 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:43520 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi7-0004ja-0m for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:14 -0400 Received: from localhost ([127.0.0.1]:35042) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0ffy-0003et-2c for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 08:43:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: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=po1J4ShuM0sOY+4h1QcvWtZw4wM1NBH6QqFVX7ESczI=; b=oBDMhm+9s8u6duB5Z+z4nVx1M7 9C2mXtF367azDA8MLZQjsSxv+8KspWLl0mp6XWxa4NVpRQUyZK0P7n0WZNEaFuHrgnHxmNp41+tVi Uf7fVRgIf2H/DSg9IQ5aPwSBilxeI4TwPDzFJPPd+RSTvdqqBhoHr+VE8gsXq0QOBla0cfYN1opmt egOnWnaGpA0J+uPmzIqKt6RrbGCICjNgoxHSQAc8F27n+rlbpN57pKV7pLpJWPhCREJg/S+IBS0lI ocpQMsZglC9snzbjEuLL+vtoBzUvXDssNR43rnMoFTolI6rU6biioJgwjig5uWTzhLxObJcPAKbx9 sLhoAW3fDGgedW5UvYEbYI7UG+trneW2j/oYmpMjgjYGqEveI7fEud9fvCaYbOCe46GUg8jAa/nzG iNOnEvckcPn6lw3BtauhMy+AAWTRXFYC0fNAKQpgpwTilvXvRyED0ib2WAmclscr4AkQGuR1ZhGdT ZOQjA27UQJM1G3d/g5DR9HEm; Received: from muradm by localhost with local (Exim 4.95) (envelope-from ) id 1o0fi5-0000g8-Hy for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 11:46:09 +0300 From: muradm Date: Mon, 13 Jun 2022 11:46:02 +0300 Message-Id: <20220613084604.2575-6-mail@muradm.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613084604.2575-1-mail@muradm.net> References: <20220613084604.2575-1-mail@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 * gnu/packages/admin.scm (libseat): New variable * gnu/packages/admin.scm (seatd): New variable * gnu/packages/freedesktop.scm (seatd): Remove variable * gnu/packages/wm.scm (wlroots): Replace seatd input with libseat --- gnu/packages/admin.scm | 53 ++++++++++++++++++++++++++++++++++++ gnu/packages/freedesktop.scm | 29 -------------------- gnu/packages/wm.scm | 4 ++- 3 files changed, 56 insertions(+), 30 deletions(-) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index d6e1d819ab..eb6450b4da 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -46,6 +46,7 @@ ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Maxime Devos ;;; Copyright © 2021 muradm +;;; Copyright © 2021 pineapples ;;; Copyright © 2021 Petr Hodina ;;; Copyright © 2021 Artyom V. Poptsov ;;; Copyright © 2022 Wamm K. D. @@ -104,6 +105,7 @@ (define-module (gnu packages admin) #:use-module (gnu packages elf) #:use-module (gnu packages file) #:use-module (gnu packages flex) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages gawk) #:use-module (gnu packages gettext) #:use-module (gnu packages gl) @@ -5097,3 +5099,54 @@ (define-public greetd-pam-mount greetd-pam-mount is used in configuration of greetd to provide auto-(mounting/unmounting) of XDG_RUNTIME_DIR in the way that it will not interfere with default pam-mount configuration."))) + +(define-public libseat + (package + (name "libseat") + (version "0.7.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://git.sr.ht/~kennylevinsen/seatd") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "10f8387yy5as547xjjhl0cna6iywdgjmw0iq2nvcs8q6vlpnik4v")))) + (build-system meson-build-system) + (arguments + `(#:configure-flags '("-Dlibseat-logind=elogind" + "-Dserver=disabled"))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (propagated-inputs + `(("elogind" ,elogind))) + (home-page "https://sr.ht/~kennylevinsen/seatd") + (synopsis "Seat management library") + (description + "This package provides a universal seat management library that +allows applications to use whatever seat management is available.") + (license license:expat))) + +(define-public seatd + (package + (inherit libseat) + (name "seatd") + (arguments + `(#:configure-flags '("-Dlibseat-logind=elogind") + #:phases + (modify-phases %standard-phases + (add-after 'install 'remove-libs + (lambda* (#:key outputs #:allow-other-keys) + (with-directory-excursion (assoc-ref outputs "out") + (for-each delete-file-recursively '("lib" "include")))))))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("scdoc" ,scdoc))) + (inputs '()) + (synopsis "Seat management daemon") + (description + "This package provides a minimal seat management daemon whose task is to +mediate access to shared devices, such as graphics and input, for applications +that require it.") + (license license:expat))) diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm index fc2c45c1f1..309876867a 100644 --- a/gnu/packages/freedesktop.scm +++ b/gnu/packages/freedesktop.scm @@ -849,35 +849,6 @@ (define (source-file regexp) with localed. This package is extracted from the broader systemd package.") (license license:lgpl2.1+))) -(define-public seatd - (package - (name "seatd") - (version "0.5.0") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://git.sr.ht/~kennylevinsen/seatd") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1kglq8v4rnr3415mfaghyv2s2f8mxsy5s881gmm2908ig4n4j297")))) - (build-system meson-build-system) - (arguments - `(#:configure-flags '("-Dlogind=enabled"))) - (native-inputs - (list pkg-config scdoc)) - (propagated-inputs - (list elogind)) - (home-page "https://sr.ht/~kennylevinsen/seatd") - (synopsis "Seat management daemon and library") - (description - "This package provides a minimal seat management daemon whose task is to -mediate access to shared devices, such as graphics and input, for applications -that require it. It also provides a universal seat management library that -allows applications to use whatever seat management is available.") - (license license:expat))) - (define-public packagekit (package (name "packagekit") diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm index 123e6ca7e7..24d95ba86c 100644 --- a/gnu/packages/wm.scm +++ b/gnu/packages/wm.scm @@ -54,6 +54,7 @@ ;;; Copyright © 2022 Daniel Meißner ;;; Copyright © 2022 Pier-Hugues Pellerin ;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2022 muradm ;;; ;;; This file is part of GNU Guix. ;;; @@ -88,6 +89,7 @@ (define-module (gnu packages wm) #:use-module (guix utils) #:use-module (gnu packages) #:use-module (gnu packages bash) + #:use-module (gnu packages admin) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages bison) @@ -1537,7 +1539,7 @@ (define-public wlroots libxkbcommon mesa pixman - seatd + libseat wayland wayland-protocols xcb-util-errors From patchwork Mon Jun 13 08:46:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 39935 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 C1EEA27BBEA; Mon, 13 Jun 2022 09:59:42 +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 1A9B127BBE9 for ; Mon, 13 Jun 2022 09:59:42 +0100 (BST) Received: from localhost ([::1]:36152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0fvB-0004rK-5t for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 04:59:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0fiy-0006pb-L5 for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0fiy-0001PW-Bc for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0fiy-0004mX-AB for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v10 6/7] gnu: desktop: Add seatd-service-type. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 08:47:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49969@debbugs.gnu.org Received: via spool by 49969-submit@debbugs.gnu.org id=B49969.165510998518281 (code B ref 49969); Mon, 13 Jun 2022 08:47:04 +0000 Received: (at 49969) by debbugs.gnu.org; 13 Jun 2022 08:46:25 +0000 Received: from localhost ([127.0.0.1]:57241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fiL-0004kg-8z for submit@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:25 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:43522 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi8-0004jg-4k for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:13 -0400 Received: from localhost ([127.0.0.1]:35044) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0ffz-0003ew-3H for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 08:43:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: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=9OKNnQJMWqLxmJgn9iWyU3TM14PZmrTLw/2VCc0jci0=; b=Qd1ZOvZRNA3PQZzqT7MYEYVoiz 0YSxULDGy4UAWMWzNOgqmN+Rrr0yZFjR+ClfiWTzfXw6Jq9xpKgthPTwrt6ejB5jA3Zq3ukPJbDZf qX/E/dr7XLMavvP/e2A2JTkWWH9Dq712J2gixal1zfWiYe7l3I2MCq8Oi2mis/5M60FVSppbM9rWb YP6DaDLt6Xe9aAHjYBXQ28BeAcj/C7CTecEpKNyTcJYAJbfagqEsEvJiIwtvwdveM6jhijMlA/TmT 6EyQMeUcChljYgj/6c0iypvKQb0DiaKrxsvCz3R0gGgceMsHDplEsDHi7TndTI00/+e5NXKUZWVcG SgnCLREHnE2Gd4AqyxkQXyWdhNBSEmCkHLSGwWmszBH7x/qLo/PaLNs3IbqiYlg7C0Pp+YqjEE70L 86pxiHA4XzobqF8BdaRINRrO5g9nEZl/CaRuIAu+l39wo6cG6pCybVz+5eg3JxP5CduNRENtCgI8D aIimArlTDxXma1KQDq39YwYA; Received: from muradm by localhost with local (Exim 4.95) (envelope-from ) id 1o0fi6-0000gB-LM for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 11:46:10 +0300 From: muradm Date: Mon, 13 Jun 2022 11:46:03 +0300 Message-Id: <20220613084604.2575-7-mail@muradm.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613084604.2575-1-mail@muradm.net> References: <20220613084604.2575-1-mail@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 * gnu/services/desktop.scm (seatd-service-type): New variable * gnu/services/desktop.scm (seatd-configuration): New data type fix seatd path --- doc/guix.texi | 46 +++++++++++++++++++++++++++++ gnu/services/desktop.scm | 62 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 997b93c831..799ea932d7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22661,6 +22661,52 @@ and ``passwd'' is with the value @code{passwd}. @end table @end deftp +@defvr {Scheme Variable} seatd-service-type +@uref{https://sr.ht/~kennylevinsen/seatd/, seatd} is a minimal seat +management daemon. + +Seat management takes care of mediating access to shared devices (graphics, +input), without requiring the applications needing access to be root. + +@lisp +(append + (list + ;; make sure seatd is running + (service seatd-service-type)) + + ;; normally one would want %base-services + %base-services) + +@end lisp +@end defvr + +@deftp {Data Type} seatd-configuration +Configuration record for the seatd daemon service. + +@table @asis +@item @code{seatd} (default: @code{seatd}) +The seatd package to use. + +@item @code{user} (default: @samp{"root"}) +User to own the seatd socket. + +@item @code{group} (default: @samp{"users"}) +Group to own the seatd socket. + +@item @code{socket} (default: @samp{"/run/seatd.sock"}) +Where to create the seatd socket. + +@item @code{logfile} (default: @samp{"/var/log/seatd.log"}) +Log file to write to. + +@item @code{loglevel} (default: @samp{"error"}) +Log level to output logs. Possible values: @samp{"silent"}, @samp{"error"}, +@samp{"info"} and @samp{"debug"}. + +@end table +@end deftp + + @node Sound Services @subsection Sound Services diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 0499071436..29a3722f1b 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2020 Tobias Geerinckx-Rice ;;; Copyright © 2020 Reza Alizadeh Majd ;;; Copyright © 2021 Brice Waegeneire +;;; Copyright © 2021 muradm ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,7 +40,9 @@ (define-module (gnu services desktop) #:use-module (gnu services networking) #:use-module (gnu services sound) #:use-module ((gnu system file-systems) - #:select (%elogind-file-systems file-system)) + #:select (%control-groups + %elogind-file-systems + file-system)) #:autoload (gnu services sddm) (sddm-service-type) #:use-module (gnu system) #:use-module (gnu system setuid) @@ -157,6 +160,9 @@ (define-module (gnu services desktop) gnome-keyring-configuration? gnome-keyring-service-type + seatd-configuration + seatd-service-type + %desktop-services)) ;;; Commentary: @@ -1630,6 +1636,60 @@ (define polkit-wheel (define polkit-wheel-service (simple-service 'polkit-wheel polkit-service-type (list polkit-wheel))) + +;;; +;;; seatd-service-type -- minimal seat management daemon +;;; + +(define-record-type* seatd-configuration + make-seatd-configuration + seatd-configuration? + (seatd seatd-package (default seatd)) + (user seatd-user (default "root")) + (group seatd-group (default "users")) + (socket seatd-socket (default "/run/seatd.sock")) + (logfile seatd-logfile (default "/var/log/seatd.log")) + (loglevel seatd-loglevel (default "info"))) + +(define (seatd-shepherd-service config) + (list (shepherd-service + (documentation "Minimal seat management daemon") + (requirement '()) + ;; TODO: once cgroups is separate dependency + ;; here we should depend on it rather than elogind + (provision '(seatd elogind)) + (start #~(make-forkexec-constructor + (list #$(file-append (seatd-package config) "/bin/seatd") + "-u" #$(seatd-user config) + "-g" #$(seatd-group config)) + #:environment-variables + (list (string-append "SEATD_LOGLEVEL=" + #$(seatd-loglevel config)) + (string-append "SEATD_DEFAULTPATH=" + #$(seatd-socket config))) + #:log-file #$(seatd-logfile config))) + (stop #~(make-kill-destructor))))) + +(define seatd-environment + (match-lambda + (($ _ _ _ socket) + `(("SEATD_SOCK" . ,socket))))) + +(define seatd-service-type + (service-type + (name 'seatd) + (description "Seat management takes care of mediating access +to shared devices (graphics, input), without requiring the +applications needing access to be root.") + (extensions + (list + (service-extension session-environment-service-type seatd-environment) + ;; TODO: once cgroups is separate dependency we should not mount it here + ;; for now it is mounted here, because elogind mounts it + (service-extension file-system-service-type (const %control-groups)) + (service-extension shepherd-root-service-type seatd-shepherd-service))) + (default-value (seatd-configuration)))) + ;;; ;;; The default set of desktop services. From patchwork Mon Jun 13 08:46:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 39938 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 6A88127BBEA; Mon, 13 Jun 2022 10:04:50 +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 A76E827BBE9 for ; Mon, 13 Jun 2022 10:04:49 +0100 (BST) Received: from localhost ([::1]:38766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0g08-0006wD-QE for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 05:04:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0fiz-0006pj-E2 for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0fiz-0001Ph-5z for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0fiz-0004mm-4t for guix-patches@gnu.org; Mon, 13 Jun 2022 04:47:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v10 7/7] gnu: tests: Add seatd/greetd based minimal desktop system tests. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 08:47:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49969@debbugs.gnu.org Received: via spool by 49969-submit@debbugs.gnu.org id=B49969.165510998918300 (code B ref 49969); Mon, 13 Jun 2022 08:47:05 +0000 Received: (at 49969) by debbugs.gnu.org; 13 Jun 2022 08:46:29 +0000 Received: from localhost ([127.0.0.1]:57245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fiP-0004l0-7i for submit@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:29 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:43524 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0fi9-0004jm-3W for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 04:46:14 -0400 Received: from localhost ([127.0.0.1]:35046) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o0fg0-0003ez-2d for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 08:44:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: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=V50/s1aHPz1lg/xFgnuRBtKadEuLaqkQs6hVma7/WWM=; b=BiLoKMIMRrSb2ZQmCh3p06N3x4 sFUUCG1kuTa8I+x1KJRMa6n7u5yuBn43g2Wz2/Fj7C+1vOU9Lu3fsXTeiWD2qtr6wVFyfdkjdv00L VDZbj5cQNVE7I/GPRBLZDRCGIYjlna+DQVk488koIe0NBBVRa+0/bkBG5AeqckCFBySFhLH3TcBzK /TKiHTbs/vqlv7xmGwLKkLV3fW2+zlD2irku8/yBMAQzbIwt5bgw07TqmejBKz8nHjdvGaJXh9CZA n8lF0m1ukE/bbXA4JqvIpzcxsL2Lzx8Ce3viUj5+Jv2TcOSud6InNeKvngoBpkPc8ahAjtPHGfDoD xyEOtedYWC/QrlwHCrXrUlRiGF14zVBGz6274txt7JhfEyZ0zCZ4I0yoC2ftqy+qHBWtk5zdXWszS hgvwSRjOcNqV//bSLYonGFau1jBAa1F+VfKaEM4krA8/swbJjrbcl3EDmfgIVhHkEsvHL13vAaQ6u DxuKk0i2PP0LIZ+/q4bsN3c2; Received: from muradm by localhost with local (Exim 4.95) (envelope-from ) id 1o0fi7-0000gE-KI for 49969@debbugs.gnu.org; Mon, 13 Jun 2022 11:46:11 +0300 From: muradm Date: Mon, 13 Jun 2022 11:46:04 +0300 Message-Id: <20220613084604.2575-8-mail@muradm.net> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613084604.2575-1-mail@muradm.net> References: <20220613084604.2575-1-mail@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 * gnu/tests/desktop.scm (minimal-desktop): seatd/greetd based minimal desktop test --- gnu/tests/desktop.scm | 212 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 211 insertions(+), 1 deletion(-) diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm index 57069c0ede..7cc837f42e 100644 --- a/gnu/tests/desktop.scm +++ b/gnu/tests/desktop.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2021 Ludovic Courtès +;;; Copyright © 2021 muradm ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,13 +19,17 @@ (define-module (gnu tests desktop) #:use-module (gnu tests) + #:use-module (gnu packages shells) #:use-module (gnu services) + #:use-module (gnu services base) #:use-module (gnu services dbus) #:use-module (gnu services desktop) + #:use-module (gnu system) #:use-module (gnu system vm) #:use-module (guix gexp) #:use-module (srfi srfi-1) - #:export (%test-elogind)) + #:export (%test-elogind + %test-minimal-desktop)) ;;; @@ -100,3 +105,208 @@ (define %test-elogind #:imported-modules '((gnu services herd) (guix combinators))))) (run-elogind-test (virtual-machine os)))))) + + +;;; +;;; Seatd/greetd based minimal desktop +;;; + +(define %minimal-services + (append + (modify-services %base-services + ;; greetd-service-type provides "greetd" PAM service + (delete login-service-type) + ;; and can be used in place of mingetty-service-type + (delete mingetty-service-type)) + (list + (service seatd-service-type) + (service greetd-service-type + (greetd-configuration + (terminals + (list + ;; we can make any terminal active by default + (greetd-terminal-configuration (terminal-vt "1") (terminal-switch #t)) + ;; we can make environment without XDG_RUNTIME_DIR set + ;; even provide our own environment variables + (greetd-terminal-configuration + (terminal-vt "2") + (default-session-command + (greetd-agreety-session + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))) + ;; we can use different shell instead of default bash + (greetd-terminal-configuration + (terminal-vt "3") + (default-session-command + (greetd-agreety-session (command (file-append zsh "/bin/zsh"))))) + ;; we can use any other executable command as greeter + (greetd-terminal-configuration + (terminal-vt "4") + (default-session-command (program-file "my-noop-greeter" #~(exit)))) + (greetd-terminal-configuration (terminal-vt "5")) + (greetd-terminal-configuration (terminal-vt "6")))))) + ;; mingetty-service-type can be used in parallel + ;; if needed to do so, do not (delete login-service-type) + ;; as illustrated above + #| (service mingetty-service-type (mingetty-configuration (tty "tty8"))) |#))) + +(define-syntax-rule (minimal-operating-system user-services ...) + "Return an operating system that includes USER-SERVICES in addition to +minimal %BASE-SERVICES." + (operating-system (inherit %simple-os) + (services (cons* user-services ... %minimal-services)))) + +(define (run-minimal-desktop-test os vm) + (define test + (with-imported-modules '((gnu build marionette) + (guix build syscalls)) + #~(begin + (use-modules (gnu build marionette) + (guix build syscalls) + (srfi srfi-1) + (srfi srfi-64) + (ice-9 pretty-print)) + + (define marionette + (make-marionette #$vm)) + + (define (file-get-all-strings fname) + (marionette-eval '(use-modules (rnrs io ports)) marionette) + (wait-for-file fname marionette #:read 'get-string-all)) + + (define (wait-for-unix-socket-m socket) + (wait-for-unix-socket socket marionette)) + + (mkdir #$output) + (chdir #$output) + + (test-begin "minimal-desktop") + + (test-assert "seatd is ready" + (wait-for-unix-socket-m "/run/seatd.sock")) + + (test-equal "login user on tty1" + "alice\n" + (begin + ;; Wait for tty1. + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'term-tty1)) + marionette) + (marionette-control "sendkey ctrl-alt-f1" marionette) + + ;; login as root change alice password and exit + ;; then login as alice + (for-each + (lambda (cmd) (marionette-type cmd marionette) (sleep 1)) + (list + "root\n" + "passwd alice\n" + "alice\n" + "alice\n" + "exit\n" + "alice\n" + "alice\n" + "id -un > logged-in\n")) + + (file-get-all-strings "/home/alice/logged-in"))) + + (test-equal "validate user environment" + '("SEATD_SOCK=/run/seatd.sock" + "XDG_RUNTIME_DIR=/run/user/1000" + "XDG_SEAT=seat0" + "XDG_VTNR=1") + + (begin + (marionette-type "env > env\n" marionette) + (sleep 1) + + (define user-env (string-tokenize + (file-get-all-strings "/home/alice/env"))) + + (define (expected-var var) + (any (lambda (s) (string-contains var s)) + '("SEATD_SOCK" + "XDG_RUNTIME_DIR" + "XDG_SEAT" + "XDG_VTNR"))) + + (sort (filter expected-var user-env) string env\n" marionette) + (sleep 1) + + (define (sock-var? var) + (any (lambda (s) (string-contains var s)) + '("SEATD_SOCK" "GREETD_SOCK"))) + + (define (sock-var-sock var) + (car (cdr (string-split var #\=)))) + + (let* + ((out (file-get-all-strings "/home/alice/env")) + (out (string-tokenize out)) + (out (filter sock-var? out)) + (socks (map sock-var-sock out)) + (socks (map wait-for-unix-socket-m socks))) + (and (= 2 (length socks)) (every identity socks))))) + + (test-assert "greetd is ready" + (begin + (marionette-type "ps -C greetd -o pid,args --no-headers > ps-greetd\n" + marionette) + (sleep 1) + + (define (greetd-daemon? cmd) + (string-contains cmd "config")) + + (define (greetd-cmd-to-pid cmd) + (car (string-split cmd #\space))) + + (define (greetd-pid-to-sock pid) + (string-append "/run/greetd-" pid ".sock")) + + (let* ((out (file-get-all-strings "/home/alice/ps-greetd")) + (out (string-split out #\newline)) + (out (map string-trim-both out)) + (out (filter greetd-daemon? out)) + (pids (map greetd-cmd-to-pid out)) + (socks (map greetd-pid-to-sock pids)) + (socks (map wait-for-unix-socket-m socks))) + (every identity socks)))) + + ;; a bit weak, but tests everything at once actually + (test-equal "check /run/user/ mounted and writable" + "alice\n" + (begin + (marionette-type "echo alice > /run/user/1000/test\n" marionette) + (file-get-all-strings "/run/user/1000/test"))) + + (test-assert "screendump" + (begin + (marionette-control (string-append "screendump " #$output + "/tty1.ppm") + marionette) + (file-exists? "tty1.ppm"))) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "minimal-desktop" test)) + +(define %test-minimal-desktop + (system-test + (name "minimal-desktop") + (description + "Test whether we can log in when seatd and greetd is enabled") + (value + (let* ((os (marionette-operating-system + (minimal-operating-system) + #:imported-modules '((gnu services herd) + (guix combinators)))) + (vm (virtual-machine os))) + (run-minimal-desktop-test (virtualized-operating-system os '()) + #~(list #$vm))))))