From patchwork Wed Sep 15 16:29:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32866 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 36EE527BBE3; Wed, 15 Sep 2021 17:37:58 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E605A27BBE1 for ; Wed, 15 Sep 2021 17:37:57 +0100 (BST) Received: from localhost ([::1]:49416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXv2-0006o2-W2 for patchwork@mira.cbaines.net; Wed, 15 Sep 2021 12:37:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXoM-0003d7-O7 for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41539) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXoM-0004n0-E9 for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQXoM-0003Dp-B2 for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v7 1/7] gnu: crates-io: Add rust-enquote 1.0.3 and rust-pam-sys 0.5.6. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Sep 2021 16:31: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.163172341112154 (code B ref 49969); Wed, 15 Sep 2021 16:31:02 +0000 Received: (at 49969) by debbugs.gnu.org; 15 Sep 2021 16:30:11 +0000 Received: from localhost ([127.0.0.1]:53059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnW-00039w-GE for submit@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:11 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58050 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnO-00038j-FH for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:03 -0400 Received: from [176.234.10.27] (port=7204 helo=localhost) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mQXnO-0000NH-Ke for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 16:30:02 +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=r4qkw+392FQuQOylqz4YjpcoNsJu3sw8jyNuZdfPhi4=; b=majsDHvQLCrfjY+1brPt5mjaIw a0Bnfs5toyWCVtN9U+HL4LM/t4RldQ4f+yCb3xYWaqFFAguRLs85puphDVRUYImh2qR/L9MYgAjDd ZL4WBGX7RSmMdfScXqO1+x1iqoICJhTGD++bky14dtMDOWv9f0sflXlMyaOSKKjIpUhduWvL7brpc LGrzjRRBCALVj8Hw25QJ6YonJIfusQ5ERt+T+tB6PJRK045goV7URvCvP6VsUUkBASTR9nH/R1jvs ZVmP/oCxOfrI87dKqYBqmHipM2orICSdAVT3zVlBnrayYJ9OPUzW9Rslw1M7y2MUfxVx/qEzg6GMD fXkeUN12NrRFtZUiQscmU1OKEwojKHYuP10rNwOa8Ph3rg+aLEaVI+FaRca0jKcs3WDsyYZ6dKrBi DXFxeoMgasq0wR3iavskT1Jnn9SdojE9duNiUsvSXNuajo35ypJySoiMO21jlD2fpBTboi8wuaSZK pVKPQXf3ds2TvcfB+iuialqI; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQXnM-0007OR-En for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 19:30:00 +0300 From: muradm Date: Wed, 15 Sep 2021 19:29:52 +0300 Message-Id: <20210915162958.28398-2-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915162958.28398-1-mail@muradm.net> References: <20210906152641.11020-1-mail@muradm.net> <20210915162958.28398-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 | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 2b91d4b871..83a8642448 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 ;;; ;;; This file is part of GNU Guix. ;;; @@ -55,6 +56,7 @@ #:use-module (gnu packages glib) #:use-module (gnu packages image) #:use-module (gnu packages jemalloc) + #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages multiprecision) #:use-module (gnu packages nettle) @@ -57376,3 +57378,50 @@ variant of this library is available separately as @code{im}.") (description "Generate Rust register maps (`struct`s) from SVD files") (license (list license:expat license:asl2.0)))) + +(define-public rust-enquote-1 + (package + (name "rust-enquote") + (version "1.0.3") + (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 + "0vm687r2wwgc3d3l2iqhag9wgkql6k93sdvjxvmfkdpksajpij1f")))) + (build-system cargo-build-system) + (synopsis + "A Rust library 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 Wed Sep 15 16:29:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32869 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 5BC7327BBE3; Wed, 15 Sep 2021 17:38:57 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 932F127BBE1 for ; Wed, 15 Sep 2021 17:38:56 +0100 (BST) Received: from localhost ([::1]:53934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXvz-0001LH-L9 for patchwork@mira.cbaines.net; Wed, 15 Sep 2021 12:38:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXoN-0003gF-Lt for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41541) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXoN-0004oC-A0 for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQXoN-0003E4-6x for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v7 2/7] gnu: admin: Add greetd 0.8.0. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Sep 2021 16:31: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.163172341212171 (code B ref 49969); Wed, 15 Sep 2021 16:31:03 +0000 Received: (at 49969) by debbugs.gnu.org; 15 Sep 2021 16:30:12 +0000 Received: from localhost ([127.0.0.1]:53064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnX-0003A8-Ih for submit@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:12 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58052 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnP-00039I-Uk for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:06 -0400 Received: from [176.234.10.27] (port=7276 helo=localhost) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mQXnQ-0000NK-6s for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 16:30:04 +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=vfeLhb630pnD8Et2n1zZ/LdDV0bK0EXXL+TxrK4iKFI=; b=NBbL7BkTtWJsfjYa6VgR2k96K+ 36PCBxbdrR7e+GCNyWY/JevJL6P+uvoZMTbx06zLxez2RqSIANhTF68qI/yN43waVmKC0cl7G+Wxo BRr5VSIeUYUeURmNW+jwdESi9RyQZMD4uij+AiUTra5YaCROZJCHCHdE4xA9vBd1FMoDDpEb4MtYK gefyDC3gWcintc+0YmcOFGI1CNiwHul6hMF5Kec0aciNKAfuoDoglSDelOoJ1bpEhaXBnduBe8oC5 WzAzz7VhKNweH3s+MH4as7kvpR2ICBVfI5m78Hs82bHHuYc2dhXjJs8hA9Cb6SWDxxp+xple0UbK0 Ge+RUaoUEHEu8EjJh9JD8380aTkA1ytmXuj+ifocMkdsEQ3BvhTD7xCahszeyXCDcKmdHP26bJWn/ Q+sWd8S0E+9mO7fKehxM+OSb/sWp++C87e6f8WXSXnxkTg6mgbpuWb91JRHVSVWcA6GBmvQxweEUm jXtr9BPkWam0xubi2CLUdKYu; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQXnN-0007OU-Mt for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 19:30:01 +0300 From: muradm Date: Wed, 15 Sep 2021 19:29:53 +0300 Message-Id: <20210915162958.28398-3-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915162958.28398-1-mail@muradm.net> References: <20210906152641.11020-1-mail@muradm.net> <20210915162958.28398-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 | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 8d6ae9eb1f..bef0ca3745 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 ;;; ;;; This file is part of GNU Guix. ;;; @@ -62,6 +63,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) @@ -88,6 +90,7 @@ #: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) @@ -4813,3 +4816,79 @@ setup, maintenance, supervision, or any long-running processes.") (description "Utility to convert @code{lsof} output to a graph showing FIFO and UNIX interprocess communication.") (license license:bsd-2)))) + +(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 Wed Sep 15 16:29:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32865 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 768B027BBE3; Wed, 15 Sep 2021 17:35:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 412F527BBE1 for ; Wed, 15 Sep 2021 17:35:09 +0100 (BST) Received: from localhost ([::1]:44254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXsK-0003Fl-5c for patchwork@mira.cbaines.net; Wed, 15 Sep 2021 12:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXoN-0003ee-7h for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXoM-0004na-ST for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQXoM-0003Dw-OX for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v7 3/7] gnu: admin: Add greetd-pam-mount. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Sep 2021 16:31: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.163172341112163 (code B ref 49969); Wed, 15 Sep 2021 16:31:02 +0000 Received: (at 49969) by debbugs.gnu.org; 15 Sep 2021 16:30:11 +0000 Received: from localhost ([127.0.0.1]:53061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnX-00039z-1j for submit@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:11 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58054 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnR-00039X-Bo for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:05 -0400 Received: from [176.234.10.27] (port=7488 helo=localhost) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mQXnR-0000NN-LM for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 16:30:05 +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=sqZE6qFYalZFifHvF/PNFwJBO4Fqo2jT0XQxlzCwyVY=; b=CH+PzHcJ2cZ8jKU1PmYVdFW/mb OYJ7T1cg5vdYcvPlTL/Y0Q6pDvzU8yRZlnaFpAOsCUg1ZiFPUMpk0KfUNADVFb/E6JjzY3gy56AF2 AJBmO8WHXHF6B62u/HIYCJ/qWYf7MCL0i131JFSsnQZU4ylOK206hBecTz4KdZNA2JtwbUq+UbaV0 3Wdgg2C4elCOqWFFAzVWR1Ye9c6UyTc5bdXSv4qZsSItgMUQRQx2dPn7zhSsuOZ1Zz77K9pZj/lpA pv0t25EfyriL1a57PZ59uPhd5rR+F7Ios3IaPROqnUyjb7rxwLBOlhmVgPHs++zRng3AtnhvtDMp2 1soJE8Z7xwHo8bC42FvKjhgkBB4KelxtkSV62usgmi0Mv65hvLf1Yge5t1JsWzOS0QXivp1gnqe7w LuPP6EZyGAV0FG9DV/Af4aGfEvqBLkFbahSPhXa6VTqHSGKgz3zhqL1SUqPvElxv/KhJ7YnMpl2ik 8AZNNseAlHwvjqLlPWN47Q25; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQXnP-0007OX-3O for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 19:30:03 +0300 From: muradm Date: Wed, 15 Sep 2021 19:29:54 +0300 Message-Id: <20210915162958.28398-4-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915162958.28398-1-mail@muradm.net> References: <20210906152641.11020-1-mail@muradm.net> <20210915162958.28398-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 bef0ca3745..e46d21844b 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -4892,3 +4892,35 @@ 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+))) + +(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 Wed Sep 15 16:29:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32864 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 9579A27BBE3; Wed, 15 Sep 2021 17:34:14 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A765E27BBE1 for ; Wed, 15 Sep 2021 17:34:13 +0100 (BST) Received: from localhost ([::1]:40738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXrQ-0000uc-KJ for patchwork@mira.cbaines.net; Wed, 15 Sep 2021 12:34:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXoO-0003hY-4e for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXoN-0004oT-NF for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQXoN-0003EB-KK for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v7 4/7] gnu: base: Add greetd-service-type. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Sep 2021 16:31: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.163172341612193 (code B ref 49969); Wed, 15 Sep 2021 16:31:03 +0000 Received: (at 49969) by debbugs.gnu.org; 15 Sep 2021 16:30:16 +0000 Received: from localhost ([127.0.0.1]:53066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnY-0003AG-DE for submit@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:16 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58058 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnT-00039m-7e for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:09 -0400 Received: from [176.234.10.27] (port=7420 helo=localhost) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mQXnT-0000NQ-3R for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 16:30:07 +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=mUh7SwkOQkEPJzi500uy1Z7lTChd7wCakkLpWk0RpWw=; b=iG+MMvLnNWXGm7XGRfE/k/qrni vFvcSHvhez8nfvzoT0j/lQz6oapBv1HPgO32gaEaKAgiIYUf+kS2wDFh/+4cN3f5YyB1U7sQZenDl P0xMLul5Egl1+iRYqcViRPlTZBo5F4F3UryZ63zpwkuppa9mn3AhCTXuk8iUneo1boYfPSV+ARhE7 9GgzA8JK5LZL3qzFAEyGuw8jc/rte5GqlfaOIFnPoO60Ze4S5aSsVwW8U9q8qLFfcblJJP6MDvWxC EB5O77f75rwJa5n7L7Z/viTOv+xyfViu9b+uuvihe9rk00QtLJHoXHomRpaWm6MGBfamSzEpPC9k1 AMzlpI4O1ibopdbwczsil1o9JTvwy33U8p31WH55URpJNl7s2pmYUhL890j5yNDJUJMZIFaZqnS/4 uC5aieVVaLiptd30fEf1sTETVKbaYbNvdXNdaibDe4jlaLTjTxYGzZIAYD7Vernbk/cMepJh3cwVQ xwZf1KjQ1lJi3sdUsklzlBFA; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQXnQ-0007Oa-KR for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 19:30:04 +0300 From: muradm Date: Wed, 15 Sep 2021 19:29:55 +0300 Message-Id: <20210915162958.28398-5-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915162958.28398-1-mail@muradm.net> References: <20210906152641.11020-1-mail@muradm.net> <20210915162958.28398-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 | 133 ++++++++++++++++++++++ gnu/services/base.scm | 218 ++++++++++++++++++++++++++++++++++++- gnu/services/pam-mount.scm | 2 +- 3 files changed, 351 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 964ef6d5f4..c641ffc453 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@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -16156,6 +16157,138 @@ 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{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 50865055fe..fe2c4d6fe5 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -16,6 +16,7 @@ ;;; Copyright © 2021 qblade ;;; Copyright © 2021 Hui Lu ;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2021 muradm ;;; ;;; This file is part of GNU Guix. ;;; @@ -186,6 +187,11 @@ references-file + greetd-service-type + greetd-configuration + greetd-terminal-configuration + greetd-agreety-session + %base-services)) ;;; Commentary: @@ -1401,7 +1407,7 @@ information on the configuration file syntax." (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")) (pam-service (inherit pam) (session (cons pam-limits @@ -2462,6 +2468,216 @@ to handle." (requirement requirement) (name-servers name-servers))))) + +;;; +;;; 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))) + (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 (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-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 + (string-append "/tmp/greetd." #$greetd-vt ".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 98611462c2..d6c65e3760 100644 --- a/gnu/services/pam-mount.scm +++ b/gnu/services/pam-mount.scm @@ -90,7 +90,7 @@ (module #~(string-append #$pam-mount "/lib/security/pam_mount.so")))) (list (lambda (pam) (if (member (pam-service-name pam) - '("login" "su" "slim" "gdm-password")) + '("login" "greetd" "su" "slim" "gdm-password")) (pam-service (inherit pam) (auth (append (pam-service-auth pam) From patchwork Wed Sep 15 16:29:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32868 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 5117127BBE3; Wed, 15 Sep 2021 17:38:23 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C241527BBE1 for ; Wed, 15 Sep 2021 17:38:22 +0100 (BST) Received: from localhost ([::1]:51470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXvR-00089P-Qb for patchwork@mira.cbaines.net; Wed, 15 Sep 2021 12:38:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXoO-0003jM-GP for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXoO-0004ob-4f for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQXoO-0003EI-0Q for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v7 5/7] gnu: admin: Add libseat 0.6.1 and move seatd. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Sep 2021 16:31: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.163172343812307 (code B ref 49969); Wed, 15 Sep 2021 16:31:03 +0000 Received: (at 49969) by debbugs.gnu.org; 15 Sep 2021 16:30:38 +0000 Received: from localhost ([127.0.0.1]:53074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnl-0003By-DC for submit@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:38 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58060 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXna-0003AT-FR for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:15 -0400 Received: from [176.234.10.27] (port=7002 helo=localhost) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mQXna-0000NT-Ns for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 16:30:14 +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=tjquRGNMWORs03M7n46GBXgvUGjXtILCoBV4Fs9Wh0M=; b=kb+uXpwurD+IGrzo01yox4IoY8 NUyJQrgxsvFv50n1iOcGslftGYs1+LV/yRiVfFTvHwvHMLmjWjsPCxvGzyLpjcILIL0xNNV0zN7fF EybpPGCeyw7I3yI7Tq2MDVh7C/oppLNEd/3YH7nQdjqxZa4tIAW7XTAvkik8fE48RbDPAGdPAPt0H 13hfQTlOKXE6wHsbfLHgzXNdnITuUTpYcuUINqkdzCJhb+c9CP+U4/4lCylCfq/i3JtsY9JwncveN dWtODlCpIVxj/l55UplnCsEeyv6dibV8voznjPbFB/HfliV7gBSXJfKFRZFrGUW1+sq6Lh8r5cNHs 4HX47UPNu31BNWlJCSm6PrB5oShm2FUEVNFzQo1+lRZRrnolT4rSRfy+tY1AH+zQcM+5xKwKoDqIR bKXM0bLAZTvhdwSaPUU9i0t3e7QrsREt91AND7qpZft15H6jQ1h6cODulHAVvuzgyeGPfZmr7HAfF yxZQtKbIaVNqysPSp6dC0rQp; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQXnS-0007Od-4H for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 19:30:06 +0300 From: muradm Date: Wed, 15 Sep 2021 19:29:56 +0300 Message-Id: <20210915162958.28398-6-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915162958.28398-1-mail@muradm.net> References: <20210906152641.11020-1-mail@muradm.net> <20210915162958.28398-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/admin.scm | 53 ++++++++++++++++++++++++++++++++++++ gnu/packages/freedesktop.scm | 30 -------------------- 2 files changed, 53 insertions(+), 30 deletions(-) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index e46d21844b..83902a9bce 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 pineapples ;;; Copyright © 2021 muradm ;;; ;;; This file is part of GNU Guix. @@ -99,6 +100,7 @@ #: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) @@ -4817,6 +4819,57 @@ setup, maintenance, supervision, or any long-running processes.") FIFO and UNIX interprocess communication.") (license license:bsd-2)))) +(define-public libseat + (package + (name "libseat") + (version "0.6.1") + (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 + "0fkfnxqz5g2kidhdh7rsa20d8j0pd4fnnz63ddn3n5mlgqckj06s")))) + (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))) + (define-public greetd (package (name "greetd") diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm index 85d9697460..d7b411b5d1 100644 --- a/gnu/packages/freedesktop.scm +++ b/gnu/packages/freedesktop.scm @@ -834,36 +834,6 @@ GNOME Shell. The @command{localectl} command-line tool allows you to interact 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 - `(("pkg-config" ,pkg-config) - ("scdoc" ,scdoc))) - (inputs - `(("elogind" ,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") From patchwork Wed Sep 15 16:29:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32870 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 0576827BBE3; Wed, 15 Sep 2021 17:39:23 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7320D27BBE1 for ; Wed, 15 Sep 2021 17:39:22 +0100 (BST) Received: from localhost ([::1]:54802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXwP-0001wM-IP for patchwork@mira.cbaines.net; Wed, 15 Sep 2021 12:39:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXoP-0003mT-Ck for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXoP-0004oy-01 for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQXoO-0003EX-S2 for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v7 6/7] gnu: desktop: Add seatd-service-type. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Sep 2021 16:31: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.163172343912321 (code B ref 49969); Wed, 15 Sep 2021 16:31:04 +0000 Received: (at 49969) by debbugs.gnu.org; 15 Sep 2021 16:30:39 +0000 Received: from localhost ([127.0.0.1]:53078 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXny-0003Ca-R5 for submit@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:39 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58062 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnb-0003Aa-Vs for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:29 -0400 Received: from [176.234.10.27] (port=7704 helo=localhost) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mQXnc-0000NW-74 for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 16:30:16 +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=SVPToCUdzrnTMne3D6z3KrTaW/NQRsYSWbp0tL/TUtA=; b=AYFTfgT8Lz5VzuPbzdkQv5VZFV OvGdPnekqgtjL3u9eC8dsUECShhE14PP0zNGGbWm+fAgCriF/eRkKzndaG+yrkIfX/2xsU2U6Hf2H 7bTHccfvOUN4cKkU3zGG7FrV1xWnc1i3BNF4fKgdDkJ59be9EIWwv3RmG9kPr0/B4qe5ySwxb8zgu wecGgDKqBZNvq1s35Kfw3zdcftZ2LXd4zqDMTz7H9o9UOS0Qid0X3nYUa9mIs9egC1nYo60jilJjL gsZVVtCiTbpV2QPMxbMeLmgyFJc6G3S78f9N90EqCge9AKFDWn7FZNhgweaavAXSwWxnGpD3WkKGc /WcxfjuxLr0cD+g5Nj3zSIBOZfPxi2wCd5L8syK2q/M909UkX9WjkGXoOjY7FLO5CrqY1hN9MC6ez wIWQSYchPI8hS/33t50/WYm3zR5rtORV5OOLBAUaXyhPzyBy9PHvtkiIxJ3meiybndjLxWYPY9bXG pUUlnvL9k+aqVp3BFJdYSoh2; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQXnZ-0007Og-Mn for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 19:30:13 +0300 From: muradm Date: Wed, 15 Sep 2021 19:29:57 +0300 Message-Id: <20210915162958.28398-7-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915162958.28398-1-mail@muradm.net> References: <20210906152641.11020-1-mail@muradm.net> <20210915162958.28398-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 --- doc/guix.texi | 42 ++++++++++++++++++++++++++++ gnu/services/desktop.scm | 60 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index c641ffc453..764355c69f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20110,6 +20110,48 @@ 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{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 64d0e85301..c42db5987e 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 @@ #: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)) #:use-module (gnu system) #:use-module (gnu system setuid) #:use-module (gnu system shadow) @@ -154,6 +157,9 @@ gnome-keyring-configuration? gnome-keyring-service-type + seatd-configuration + seatd-service-type + %desktop-services)) ;;; Commentary: @@ -1182,6 +1188,58 @@ or setting its password with passwd."))) (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")) + (loglevel seatd-loglevel (default "error"))) + +(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) + "-s" #$(seatd-socket config)) + #:environment-variables + (list (string-append "SEATD_LOGLEVEL=" + #$(seatd-loglevel config))) + #:log-file "/tmp/seatd.log")) + (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 Wed Sep 15 16:29:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32867 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 77F0227BBE3; Wed, 15 Sep 2021 17:38:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DD31A27BBE1 for ; Wed, 15 Sep 2021 17:38:09 +0100 (BST) Received: from localhost ([::1]:50442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQXvE-0007UC-Sv for patchwork@mira.cbaines.net; Wed, 15 Sep 2021 12:38:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQXoO-0003kq-Te for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41544) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQXoO-0004om-Gm for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQXoO-0003EQ-DS for guix-patches@gnu.org; Wed, 15 Sep 2021 12:31:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v7 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: Wed, 15 Sep 2021 16:31: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.163172343812315 (code B ref 49969); Wed, 15 Sep 2021 16:31:04 +0000 Received: (at 49969) by debbugs.gnu.org; 15 Sep 2021 16:30:38 +0000 Received: from localhost ([127.0.0.1]:53076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXny-0003CS-8U for submit@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:38 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58064 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQXnd-0003B1-9n for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 12:30:18 -0400 Received: from [176.234.10.27] (port=7426 helo=localhost) by nomad-cl1.muradm.net with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mQXnd-0000NZ-K6 for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 16:30:17 +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=u/G+wBrFuraegz0F142BXhhegeToVgH/LbZ3a2xCcSM=; b=b4Vq0tn9hHX/1lPhgw+BcqP+4J Y5cb0wteduM8xs9+wpp2gQWyn14/ZJV6RS7/Ro9PXh3ymkoZhz4xWyQQBm1Rua88ohI1GAuzV1vGx 0vvBDsJiRHRUqZ7XOzjmNv3E884d4oSWQotf2eqFYKPfFSiZlH1NoM8Dequ76qw6VBqQ7K4s/GpvO JJASZ2YokFIwTuqOZrW+kVp/A/VKR2evEv04DY0kVr/Awz64q+AL1ZfEnVjC/p7tA5yHIkdY5yJXa f2byFGOqQwg8QDfMUTjEVXpVKvUuQHV79FKqpiVJxUhAaxMzGTxz17SN3UHqWs2CwScTKLlSyKPh1 nooIPASdYeGAw33W+bPQpd2Qeqq42HuELpemhgYLdXOh8HEXFO6Kq7LpIipmvKTXwxMkkuzp/zohA IY2D96FBPfxrzeeUuxUiTz9dNo+iZb4WJTdkjV1hjA+n3e0aonydyCdUa5GzuKa/lPf/h+8ufLAqQ +7cbXXbXZJ8Fhn+zMpwIX1Ui; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQXnb-0007Oj-51 for 49969@debbugs.gnu.org; Wed, 15 Sep 2021 19:30:15 +0300 From: muradm Date: Wed, 15 Sep 2021 19:29:58 +0300 Message-Id: <20210915162958.28398-8-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210915162958.28398-1-mail@muradm.net> References: <20210906152641.11020-1-mail@muradm.net> <20210915162958.28398-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 6aa22fd49b..50aa859869 100644 --- a/gnu/tests/desktop.scm +++ b/gnu/tests/desktop.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 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)) ;;; @@ -103,3 +108,208 @@ #: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))))))