From patchwork Thu Sep 16 19:47:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32923 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 396A427BBE4; Thu, 16 Sep 2021 20:48:21 +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 9A2CD27BBE1 for ; Thu, 16 Sep 2021 20:48:20 +0100 (BST) Received: from localhost ([::1]:33438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQxMp-0003cZ-M4 for patchwork@mira.cbaines.net; Thu, 16 Sep 2021 15:48:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQxMY-0003Xy-Su for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45109) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQxMY-0001hF-LI for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQxMY-00059u-JS for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v8 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: Thu, 16 Sep 2021 19:48: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.163182165919685 (code B ref 49969); Thu, 16 Sep 2021 19:48:02 +0000 Received: (at 49969) by debbugs.gnu.org; 16 Sep 2021 19:47:39 +0000 Received: from localhost ([127.0.0.1]:56634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMA-00057M-ID for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:38 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58072 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxM5-00056R-AL for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:34 -0400 Received: from [176.234.10.27] (port=7324 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 1mQxM5-0000YE-D3 for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 19:47:33 +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=SGLek0xVbn5bVP+3cCJPpERmTo 94gbh/5G8hDgCEGPwKKa2xcoNLnhXsCX+vbaZWtrsnLzFoyR1E63LdGgdqboapYVgGaiBmIfErvsc cDJ3qiiL1AHhyfJqXAXBOLHZXirODje9WITwc35YFU1JKSzc2AVCBoUz1ybzNn/uKgOf8aoREZX8m Cugz8j54o9dQl+Wev6WJvUuSZxrubHQ6Kq4z2zLmYfF/oJ3AamD9yt5huMhUkjlmkABBmnOkQE9/R A3aMF2nqXuQp6DIU/cAhoCMDdkobLdRh2pcRZ14DFypgCbyt0fxYExOTHUhykVI1TmKSOegUC/eXU 2sMuKmHbdLOuw1bvs6E9+qp43WZp0bg5bgMmoLddxSPVFbV5SgF7QRewbqpkQuZRcbIxOC/BCP8sC uEZZo0UG0uKcB3bt3KjMMlXOGdUnLDNN5yxW2KQqzzj/9rhwA6PdJA8xGkBFapRCrXdHOfv01Ll+Q gkb5Pfbypt4NMiK56El9vwYN; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQxM2-00005e-8X for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 22:47:30 +0300 From: muradm Date: Thu, 16 Sep 2021 22:47:22 +0300 Message-Id: <20210916194728.324-2-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916194728.324-1-mail@muradm.net> References: <20210915162958.28398-1-mail@muradm.net> <20210916194728.324-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 Thu Sep 16 19:47:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32922 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 5DF2627BBE1; Thu, 16 Sep 2021 20:48:20 +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 CA00527BBE1 for ; Thu, 16 Sep 2021 20:48:19 +0100 (BST) Received: from localhost ([::1]:33370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQxMo-0003a0-TS for patchwork@mira.cbaines.net; Thu, 16 Sep 2021 15:48:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQxMZ-0003Y2-L7 for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45111) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQxMZ-0001k1-Di for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQxMZ-0005AA-Cq for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v8 2/7] gnu: admin: Add greetd 0.8.0. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Sep 2021 19:48: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.163182166819763 (code B ref 49969); Thu, 16 Sep 2021 19:48:03 +0000 Received: (at 49969) by debbugs.gnu.org; 16 Sep 2021 19:47:48 +0000 Received: from localhost ([127.0.0.1]:56646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMG-00058P-Q5 for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:48 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58074 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxM7-00056s-Jk for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:38 -0400 Received: from [176.234.10.27] (port=7046 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 1mQxM7-0000YH-DF for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 19:47:35 +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=EDhqCMIsbq+6kKaTdqcMnTnpWb KNYbSY0C6yeZ/y1ZJYVBrstIZhwx/t/gyn7IiblF4urAcZhwq+Y/hUzbjZzOyAoBhzoFm2pUQ9xis KrUidTDBek79TbsovoiDos9ZgVi1nzOApP+0cpLW6BvbX9Cb82D85lSPQngXBRz1xSoVfQa6ukJme JrwKZV2ZewabQrGIFUiUHIvVpphPSPDECU42XYX/Ota6k8FjD7KPOKmG5MBwjN0KYrmTNkYDYCP9W pv/jXu8spBEOi5LB2tXwujDiOrcUCXxFtQa7S+Rb47ubssQbtKUJWTiPoF9v/VPThEuMxsj5iMbtg JckLwDlAoXOG84S271WiJio1ot6gEjwiupOX/qYlciyrBFVfhQaePsgwkvdbkdvZLw3q5me5dqiJB 8zUhIQWHEjj6KbL48HiQytJErT54jat1FU/imO4C8f3oi1wV/awsDlkToLCmr2uBbXdPkXOKCSQdT kT3ABx6A9W6moZm1n+vnFIeW; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQxM4-00005h-9G for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 22:47:32 +0300 From: muradm Date: Thu, 16 Sep 2021 22:47:23 +0300 Message-Id: <20210916194728.324-3-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916194728.324-1-mail@muradm.net> References: <20210915162958.28398-1-mail@muradm.net> <20210916194728.324-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 Thu Sep 16 19:47:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32925 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 5FB1827BBE3; Thu, 16 Sep 2021 20:48:42 +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 0EDBE27BBE1 for ; Thu, 16 Sep 2021 20:48:42 +0100 (BST) Received: from localhost ([::1]:34220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQxNB-00048L-5S for patchwork@mira.cbaines.net; Thu, 16 Sep 2021 15:48:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQxMZ-0003Y1-Gj for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQxMZ-0001iq-8W for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQxMY-0005A1-W7 for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v8 3/7] gnu: admin: Add greetd-pam-mount. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Sep 2021 19:48: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.163182166519744 (code B ref 49969); Thu, 16 Sep 2021 19:48:02 +0000 Received: (at 49969) by debbugs.gnu.org; 16 Sep 2021 19:47:45 +0000 Received: from localhost ([127.0.0.1]:56644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMG-00058F-1H for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:44 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58076 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxM9-000574-DC for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:37 -0400 Received: from [176.234.10.27] (port=6978 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 1mQxM9-0000YK-Ov for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 19:47:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=muradm.net; s=mail; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject: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=e6XcqZmJw11IZlsbhQ3Wm/cwLU cphZNrm4H09QciheNpmGKye5OKqx807v5TV2Flzr6WRaNGXlMXXd18+XBmz3B3dzNtIJEKwEpQfl/ dhrQWJHOgR4q7cferZawIAGNArHqxj8C9tE6MtEnWQixQCWsPj0y5DqNsEQSSPh8JFQSWBTLEac6r 7/q0+kX/ZkKV0r8LVi3Cwv0KDdfQaa3ZwuEYCHi1KI+jq0UIaYXPO10/mgwrdC6kGj9Hy83YOoMU+ hEnFdEFnffBAc6TB9Dk3SCinckYa1MBi/sghvE5bd1p3SFbxVk4ew14IaYuKgPDr0b6JxEe2QsyPD yReatrfOcoeycFj9g+GXTeL0JtR40gUEU+RPnPg1yWHe5M7wBEoSoT5wOETDlnKfFT8qgUE1RCWxp SoeXnr3mTAmYz9MDuCpv1N7u08rOKuCH9wpsH6Yb1/SM+Nt6XlnA7b3baBvpFDsjvlEEdzwSVA6DR mMq/bzdJ25YBeYM7Lz9mxXAQ; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQxM6-00005k-Eu for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 22:47:34 +0300 From: muradm Date: Thu, 16 Sep 2021 22:47:24 +0300 Message-Id: <20210916194728.324-4-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916194728.324-1-mail@muradm.net> References: <20210915162958.28398-1-mail@muradm.net> <20210916194728.324-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 Thu Sep 16 19:47:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32926 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 8442727BBE3; Thu, 16 Sep 2021 20:48:43 +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 9A60527BBE1 for ; Thu, 16 Sep 2021 20:48:42 +0100 (BST) Received: from localhost ([::1]:34276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQxNB-0004AT-OZ for patchwork@mira.cbaines.net; Thu, 16 Sep 2021 15:48:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQxMa-0003Y3-1f for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQxMZ-0001ke-RC for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQxMZ-0005AH-Q5 for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v8 4/7] gnu: base: Add greetd-service-type. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Sep 2021 19:48: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.163182166919776 (code B ref 49969); Thu, 16 Sep 2021 19:48:03 +0000 Received: (at 49969) by debbugs.gnu.org; 16 Sep 2021 19:47:49 +0000 Received: from localhost ([127.0.0.1]:56648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMK-00058i-8p for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:49 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58078 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMA-00057O-U9 for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:42 -0400 Received: from [176.234.10.27] (port=6980 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 1mQxMB-0000YN-Ch for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 19:47:39 +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=NgwnoJlp0tCJ8CJzMug7zEgn1R 3rx0ggdFGrYjWiN1YuAq5dPKg1yYo4ehQr4/UQ82p9g0/A8j6tCHnMtlGFmgvcSViLi70eRm4h0SD u9fyJnwlMN2jk+3Y89oa8R/au8yXnYPnonZ0o3nWbTxm2b8SamBaxgJRxHOAGVnedoUHlkrrBj8sk f1Sxeymq7qNjR1Uoou0QGse3CKvBY5/A91YLG2q/C34jomx/NZDP9/GupYThP44DOVbDLrCcjq3gO SBT/qaKHnv2XvCz8CSuAvC91Pl07YgQKrqNW8PAfQRvUnhYYz6v8kmTjkxwefzkhdun2zmL3ROnSw vu27Vlr41ddaJbjf3NCKqCZqM2RI2Dm7AywJxjYfln6NM0LseodoV1K8T/wl+kY5SfHBVZR//dV94 gxrQP3gEcCzaUek2L+USn+hFDgEjAKl/24zfuRrReAMq4mbRGunWdv7pQ1DtEbmM338Cb4J8ftiTK nYk/wxxGxuYs9f7QfIi2kREK; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQxM8-00005p-Hn for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 22:47:36 +0300 From: muradm Date: Thu, 16 Sep 2021 22:47:25 +0300 Message-Id: <20210916194728.324-5-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916194728.324-1-mail@muradm.net> References: <20210915162958.28398-1-mail@muradm.net> <20210916194728.324-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 Thu Sep 16 19:47:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32928 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 5452227BBE3; Thu, 16 Sep 2021 20:49:17 +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 C772827BBE1 for ; Thu, 16 Sep 2021 20:49:16 +0100 (BST) Received: from localhost ([::1]:34954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQxNj-0004dc-Up for patchwork@mira.cbaines.net; Thu, 16 Sep 2021 15:49:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQxMc-0003YB-1t for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQxMa-0001lx-VD for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQxMa-0005AY-Su for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v8 5/7] gnu: admin: Add libseat 0.6.2 and move seatd. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Sep 2021 19:48: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.163182167819808 (code B ref 49969); Thu, 16 Sep 2021 19:48:04 +0000 Received: (at 49969) by debbugs.gnu.org; 16 Sep 2021 19:47:58 +0000 Received: from localhost ([127.0.0.1]:56652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMU-00059J-4F for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:58 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58080 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMC-00057b-AY for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:43 -0400 Received: from [176.234.10.27] (port=7122 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 1mQxMC-0000YQ-Sn for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 19:47:40 +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=c5uCMRzt6UGeHZ2V3Rkbiwy2VEC1LzbNDcL4i4Gux3I=; b=YBau56MOO6r3ogMeTrW3Yb7lbG jZwYP/t7julZUZAlQDmDAKdYh0mVCvlvQvazzGjgKjHNGJPVBogBBej1YzTloCLMC4OCJAEzGih6t AQN3GHCi3WuNsRkxKxbfODaGRv3+10gXHLmv6bE1OQeJf26F5Hvdw18YynlxkpC5O9pbBm5CcQ8Uv AVDmzdaSboeKzDtICNDyhQtRUvSe7r6fJ2n6wsgUWXDytWRqX5xu4vlmGOqjvbih7HVMdX4ZXx9G6 drsvF01MSIKocrqglbL7bLy+vQ3Q0OQsWQcKqh3ALJWWUlWVRjdeHSyUsPBA7R9m18Sqi6JhuO7xE HNaTtIL45lNFeiB0VL0rVwDF2H9Aqvlke7SC/dxmMzQbI8sBKD68YxGvSm8OFWy6ERznBnzUkOyqs KEwY02L5wCWfQO4eYP0uMTuE8CNAD+Zf8+p0e4Ij3/OzuGQYH7CVXFIXrNIErT7sYHxo1UrNQtUCB g728Qz30USn1VQphHNaCUDAV; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQxMA-00005s-6x for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 22:47:38 +0300 From: muradm Date: Thu, 16 Sep 2021 22:47:26 +0300 Message-Id: <20210916194728.324-6-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916194728.324-1-mail@muradm.net> References: <20210915162958.28398-1-mail@muradm.net> <20210916194728.324-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..c5b719996f 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.2") + (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 + "0c07i1nq0k60xmcsnr37ryqs7nzbg4qfq6fzbnzwbh1yhr8kypcm")))) + (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 Thu Sep 16 19:47:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32927 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 8C47827BBE3; Thu, 16 Sep 2021 20:49:11 +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 0691327BBE1 for ; Thu, 16 Sep 2021 20:49:11 +0100 (BST) Received: from localhost ([::1]:34734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQxNe-0004Ss-5H for patchwork@mira.cbaines.net; Thu, 16 Sep 2021 15:49:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQxMa-0003Y4-MI for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45113) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQxMa-0001l2-FU for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQxMa-0005AR-CZ for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v8 6/7] gnu: desktop: Add seatd-service-type. Resent-From: muradm Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 16 Sep 2021 19:48: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.163182167819800 (code B ref 49969); Thu, 16 Sep 2021 19:48:04 +0000 Received: (at 49969) by debbugs.gnu.org; 16 Sep 2021 19:47:58 +0000 Received: from localhost ([127.0.0.1]:56650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMT-00059H-M0 for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:58 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58082 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxME-00057n-1M for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:43 -0400 Received: from [176.234.10.27] (port=7474 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 1mQxME-0000YT-E6 for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 19:47:42 +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=ZFuEV4g+esE25D4cLA11X5uHwd Z5qavz8aO81Qu+qE4mRw6ggJadfQc6PkQPvuSFqBdawZCgD+7yKIdynFk0Fm73kg2lWmqra6lJwCh 0DFKXl9X0+cq0ckbAuX/kMjJHu4COTEkvQA18ZeVrNemHPLHNrk8mY9LZ4xH+WLxc6+bHfRKlZ1R8 UCPvXVdmyxUXuSYe+Od/Ptnoy14zmnQUdj5xtwjQvWcGp4dlNkNs+PqBO0H4ak9ML4T7Ozao91Hv6 Btb0dQ7JomoPJhQTbV/zS16A6YOb/9YX4Nz5tMvJZqd2LJSWqL68rltwUSYOfdeKv2FgezCNge2go 2SX6pGG91Dhy+Tl5AhMTpBDFOCTmxxEyg0GXVCsFCplhWkJVs4qqAnQI3J6kn27HNGTI28pY55HfR cIzIED9x5zGlUvMoPXDeHNln/141lNaW83USpTBW0bmAsjhaeB0xvJD/WiiGExsUc0FVKUCnYI5DO lACIZsqgb/cPOqDcKo9pcZRS; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQxMB-00005v-HD for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 22:47:39 +0300 From: muradm Date: Thu, 16 Sep 2021 22:47:27 +0300 Message-Id: <20210916194728.324-7-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916194728.324-1-mail@muradm.net> References: <20210915162958.28398-1-mail@muradm.net> <20210916194728.324-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 Thu Sep 16 19:47:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: muradm X-Patchwork-Id: 32924 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 6A4B627BBE1; Thu, 16 Sep 2021 20:48:21 +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 3973A27BBE3 for ; Thu, 16 Sep 2021 20:48:20 +0100 (BST) Received: from localhost ([::1]:33386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQxMp-0003aV-5I for patchwork@mira.cbaines.net; Thu, 16 Sep 2021 15:48:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQxMc-0003YV-4P for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mQxMb-0001lz-F0 for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mQxMb-0005Af-CQ for guix-patches@gnu.org; Thu, 16 Sep 2021 15:48:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v8 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: Thu, 16 Sep 2021 19:48: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.163182167919814 (code B ref 49969); Thu, 16 Sep 2021 19:48:05 +0000 Received: (at 49969) by debbugs.gnu.org; 16 Sep 2021 19:47:59 +0000 Received: from localhost ([127.0.0.1]:56654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMU-00059Q-Kp for submit@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:59 -0400 Received: from nomad-cl1.staging.muradm.net ([139.162.159.157]:58086 helo=nomad-cl1.muradm.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mQxMF-000580-FE for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 15:47:44 -0400 Received: from [176.234.10.27] (port=7126 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 1mQxMG-0000YW-07 for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 19:47:44 +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=XAO1doAA0pg27uPqDgVWIUgvZ9 CgpWZj7z5rLaOIf4F9JJ+ivU++Gfaqg0ex10RFD3ipDYwU3szWchwALA+YTjjfz4N+2/y34lFzGLs HhGXv+ZWnMAi3rK576OMO3VT14aaB02ih9YJioEvYDy2YU6m2WKrIJXC7HZm6F47BZ7u5KD9s40k/ 19a+gwLwxj9cXJ6TCqvYoE2dt3rHjnC+iG/q1pu8NK5x5pVFGpZQJ6BPWsGuXoEGGXu9mreYADgvV kmkezgpCwFrJQ6jvA/56FSqrXmZDI5mdlc7TMvzes22JsfKj9adj64+CUQahGmCNhfrH12fhZL7+5 TmHEDxsHjlXlV495gJrgu91ZriI4m/RWp6AvqiKCltbW9Qx3lMEBEQnLKD4HdndmAise2RJ0ucTB3 Fyp9sPBmJP/lrWsMmgYxeZfnjGhNOkEy37B8XffNjtiS+ZiBhfvs2PzhS0BcLtAeifCCRMlqRO1xr vvszFzITRVPBFo38zVYmPTug; Received: from muradm by localhost with local (Exim 4.94.2) (envelope-from ) id 1mQxMD-00005y-8q for 49969@debbugs.gnu.org; Thu, 16 Sep 2021 22:47:41 +0300 From: muradm Date: Thu, 16 Sep 2021 22:47:28 +0300 Message-Id: <20210916194728.324-8-mail@muradm.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916194728.324-1-mail@muradm.net> References: <20210915162958.28398-1-mail@muradm.net> <20210916194728.324-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))))))