From patchwork Fri Jun 3 10:10:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39724 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 365DB27BBE9; Fri, 3 Jun 2022 11:55:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EADC527BBE9 for ; Fri, 3 Jun 2022 11:55:10 +0100 (BST) Received: from localhost ([::1]:37850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx4xR-0003bk-Td for patchwork@mira.cbaines.net; Fri, 03 Jun 2022 06:55:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx4oc-0000AJ-Vl for guix-patches@gnu.org; Fri, 03 Jun 2022 06:46:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx4oc-0005va-L3 for guix-patches@gnu.org; Fri, 03 Jun 2022 06:46:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nx4oc-0002mM-IR for guix-patches@gnu.org; Fri, 03 Jun 2022 06:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v9 1/7] gnu: crates-io: Add rust-enquote 1.1.0 and rust-pam-sys 0.5.6. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jun 2022 10:46: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.165425314310649 (code B ref 49969); Fri, 03 Jun 2022 10:46:02 +0000 Received: (at 49969) by debbugs.gnu.org; 3 Jun 2022 10:45:43 +0000 Received: from localhost ([127.0.0.1]:55352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4oG-0002le-EL for submit@debbugs.gnu.org; Fri, 03 Jun 2022 06:45:43 -0400 Received: from [192.151.158.155] (port=47952 helo=mail.boiledscript.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4Gb-0001j0-0Y for 49969@debbugs.gnu.org; Fri, 03 Jun 2022 06:10:54 -0400 Received: from localhost (unknown [192.168.203.1]) by mail.boiledscript.com (Postfix) with ESMTP id 8C11E3008F7 for <49969@debbugs.gnu.org>; Fri, 3 Jun 2022 10:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1654251046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZVbUxRj1H1klcwBosvbFQfs0q+GKr8Dcpocbqb5STwI=; b=TEyaYI+bf+cv7Kd9ERny1Rl7CZOMOmpndqTmGJiwEMfXG1WWJodnIXeODE/wCQ/UB30C6p /PvHHxHHX51l2MTlNEPA9NpHmohyAlN0nd/Fkd8FhyJzW9VkP9k4Re9usrbStdc2FCondV NKTJuEVF6ZyUOwXI5yG60K8zvVphlBt1e5OSZhlB7EiIPhrDZFHClvpWMhk/Dn4DdTSXx3 boDyLM6WmsgqUOnexTW9+MSrJr6aiMhchsCJwobVGyFwEYhyuWNni1ZbBgctThevZsf2Zq ECw8Dp95UtYMrln2cR0kCWyfkmh/HJwZ08iEKzwFEdDQYpQccScjcd+/SQZloQ== Date: Fri, 3 Jun 2022 18:10:31 +0800 Message-ID: <20220603181031.1ac07de0@ultrarare.space> In-Reply-To: <20220603180923.0caf6958@ultrarare.space> References: <20220603180923.0caf6958@ultrarare.space> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; none X-Spamd-Bar: / X-Mailman-Approved-At: Fri, 03 Jun 2022 06:45:39 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 03 Jun 2022 06:54:55 -0400 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" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain 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 Signed-off-by: Hilton Chain --- gnu/packages/crates-io.scm | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index 86313f5e4fd3..9374601bb4f3 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -19,6 +19,7 @@ ;;; Copyright © 2021 Antero Mejr ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Vinicius Monego +;;; Copyright © 2021 muradm ;;; Copyright © 2021, 2022 Petr Hodina ;;; Copyright © 2021, 2022 Ricardo Wurmus ;;; Copyright © 2021 Jacob Hrbek @@ -73053,3 +73054,42 @@ (define-public rust-shell2batch-0.4 and automatically convert it to a windows batch file, this library provides a way to convert simple shell commands to windows batch commands.") (license license:asl2.0))) + +(define-public rust-enquote-1 + (package + (name "rust-enquote") + (version "1.1.0") + (home-page "https://github.com/reujab/enquote") + (source (origin + (method url-fetch) + (uri (crate-uri "enquote" version)) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0clrjghlfkkb7sndabs5wch0fz2nif6nj4b117s8kqxx3nqnrhq6")))) + (build-system cargo-build-system) + (synopsis "Rust library that quotes, unquotes, and unescapes strings") + (description "A Rust library quotes, unquotes, and unescapes strings") + (license license:unlicense))) + +(define-public rust-pam-sys-0.5 + (package + (name "rust-pam-sys") + (version "0.5.6") + (home-page "https://github.com/1wilkens/pam-sys") + (source (origin + (method url-fetch) + (uri (crate-uri "pam-sys" version)) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0d14501d5vybjnzxfjf96321xa5wa36x1xvf02h02zq938qmhj6d")))) + (build-system cargo-build-system) + (arguments + `(#:cargo-inputs (("rust-libc" ,rust-libc-0.2)))) + (native-inputs `(("linux-pam" ,linux-pam))) + (synopsis + "Rust FFI wrappers for the Linux Pluggable Authentication Modules (PAM)") + (description + "Rust FFI wrappers for the Linux Pluggable Authentication Modules (PAM)") + (license (list license:expat license:asl2.0)))) From patchwork Fri Jun 3 10:11:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39726 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 B685927BBEA; Fri, 3 Jun 2022 11:55:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D2F0E27BBE9 for ; Fri, 3 Jun 2022 11:55:12 +0100 (BST) Received: from localhost ([::1]:37926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx4xT-0003fd-Qe for patchwork@mira.cbaines.net; Fri, 03 Jun 2022 06:55:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx4uQ-0001ZW-O6 for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33248) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx4uQ-0006vf-DQ for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nx4uQ-0002yY-7r for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH 2/7] gnu: admin: Add greetd 0.8.0. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jun 2022 10:52: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.165425349411370 (code B ref 49969); Fri, 03 Jun 2022 10:52:02 +0000 Received: (at 49969) by debbugs.gnu.org; 3 Jun 2022 10:51:34 +0000 Received: from localhost ([127.0.0.1]:55368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4tu-0002xF-Le for submit@debbugs.gnu.org; Fri, 03 Jun 2022 06:51:33 -0400 Received: from [192.151.158.155] (port=48142 helo=mail.boiledscript.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4Hk-0001kf-2u for 49969@debbugs.gnu.org; Fri, 03 Jun 2022 06:12:05 -0400 Received: from localhost (unknown [192.168.203.1]) by mail.boiledscript.com (Postfix) with ESMTP id A94893008F7 for <49969@debbugs.gnu.org>; Fri, 3 Jun 2022 10:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1654251118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WVrOxeRUe8KQdV8xw4qar6u2s0RTSUp+6KqeC6ua7Cw=; b=LmjoDCm1+5aooK8XT8e82YcQDsVawK7hgts+vv0Aw+pMHwarvUGUJy+DxnCgjH+O+/NFTG TfjZo4hCLudyfEzmkJbcMXj/7Kza+qL42WsxsFf6ynj9y4D+aFn9Fr/PD4AJmJaUBna7iV 9wP+GerV78alXucQv8scp8ZBH6Ib7MO4Abbev48xJ6FgvO/VOoA5jsqe3TWkhIgxFQEDh/ E7kfwuTsdiAoczevT1kW+/IjH7xsXFETRfmy9thCzH5NBoGQ/0MCm0aJKmhnIZ2dVwPSRu jEd5rYnPZwM44f48lPn7dfdjOCAB7obnq3n4F4PxUIzJPpzvkb0c2i+KmsjjIg== Date: Fri, 3 Jun 2022 18:11:43 +0800 Message-ID: <20220603181143.5bef4199@ultrarare.space> In-Reply-To: <20220603181031.1ac07de0@ultrarare.space> References: <20220603180923.0caf6958@ultrarare.space> <20220603181031.1ac07de0@ultrarare.space> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; none X-Spamd-Bar: / X-Mailman-Approved-At: Fri, 03 Jun 2022 06:51:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 03 Jun 2022 06:54:55 -0400 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" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain X-getmail-retrieved-from-mailbox: Patches * gnu/packages/admin.scm (greetd): New variable Signed-off-by: Hilton Chain --- gnu/packages/admin.scm | 80 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 92ee007729ee..d94b113d4e24 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -45,6 +45,7 @@ ;;; Copyright © 2021 Brice Waegeneire ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2021 muradm ;;; Copyright © 2021 Petr Hodina ;;; Copyright © 2021 Artyom V. Poptsov ;;; Copyright © 2022 Wamm K. D. @@ -65,6 +66,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) @@ -92,6 +94,7 @@ (define-module (gnu packages admin) #:use-module (gnu packages c) #:use-module (gnu packages check) #:use-module (gnu packages compression) + #:use-module (gnu packages crates-io) #:use-module (gnu packages cross-base) #:use-module (gnu packages crypto) #:use-module (gnu packages cryptsetup) @@ -100,6 +103,7 @@ (define-module (gnu packages admin) #:use-module (gnu packages elf) #:use-module (gnu packages file) #:use-module (gnu packages flex) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages gawk) #:use-module (gnu packages gettext) #:use-module (gnu packages gl) @@ -4972,4 +4976,80 @@ (define-public udpcast (home-page "https://www.udpcast.linux.lu") (license license:gpl2+))) +(define-public greetd + (package + (name "greetd") + (version "0.8.0") + (home-page "https://git.sr.ht/~kennylevinsen/greetd") + (source (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0x5c3jkw09kvj2grcxm899y2n6ws8p990cyp9cs0fy6lm4fzlh6v")))) + (build-system cargo-build-system) + (arguments + `(#:cargo-inputs (("rust-nix" ,rust-nix-0.19) ("rust-pam-sys" ,rust-pam-sys-0.5) + ("rust-rpassword" ,rust-rpassword-5) + ("rust-users" ,rust-users-0.11) + ("rust-serde" ,rust-serde-1) + ("rust-serde-json" ,rust-serde-json-1) + ("rust-libc" ,rust-libc-0.2) + ("rust-tokio" ,rust-tokio-1) + ("rust-getopts" ,rust-getopts-0.2) + ("rust-thiserror" ,rust-thiserror-1) + ("rust-async-trait" ,rust-async-trait-0.1) + ("rust-enquote" ,rust-enquote-1)) + #:phases + (modify-phases %standard-phases + (delete 'package) + (add-after 'build 'build-man-pages + (lambda* (#:key inputs #:allow-other-keys) + (define (scdoc-cmd doc lvl) + (system (string-append "scdoc < " + doc + "-" + lvl + ".scd > " + doc + "." + lvl))) + (with-directory-excursion "man" + (scdoc-cmd "greetd" "1") + (scdoc-cmd "greetd" "5") + (scdoc-cmd "greetd-ipc" "7") + (scdoc-cmd "agreety" "1")))) + (replace 'install + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) (bin (string-append out + "/bin")) + (sbin (string-append out "/sbin")) + (share (string-append out "/share")) + (man (string-append share "/man")) + (man1 (string-append man "/man1")) + (man5 (string-append man "/man5")) + (man7 (string-append man "/man7")) + (release "target/release") + (greetd-bin (string-append release "/greetd")) + (agreety-bin (string-append release "/agreety"))) + (install-file greetd-bin sbin) + (install-file agreety-bin bin) + (with-directory-excursion "man" + (install-file "greetd.1" man1) + (install-file "greetd.5" man5) + (install-file "greetd-ipc.7" man7) + (install-file "agreety.1" man1)))))))) + (native-inputs `(("linux-pam" ,linux-pam) ("scdoc" ,scdoc))) + (synopsis "Minimal and flexible login manager daemon") + (description + "greetd is a minimal and flexible login manager daemon +that makes no assumptions about what you want to launch. +If you can run it from your shell in a TTY, greetd can start it. + +If it can be taught to speak a simple JSON-based IPC protocol, +then it can be a greeter.") + (license license:gpl3+))) From patchwork Fri Jun 3 10:14:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39729 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 A14FF27BBEA; Fri, 3 Jun 2022 11:55:33 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6C33B27BBE9 for ; Fri, 3 Jun 2022 11:55:33 +0100 (BST) Received: from localhost ([::1]:39176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx4xo-0004Y2-Js for patchwork@mira.cbaines.net; Fri, 03 Jun 2022 06:55:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx4uQ-0001ZX-Up for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33249) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx4uQ-0006vj-Mp for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nx4uQ-0002yg-Ki for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v9 3/7] gnu: admin: Add greetd-pam-mount. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jun 2022 10:52: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.165425349411377 (code B ref 49969); Fri, 03 Jun 2022 10:52:02 +0000 Received: (at 49969) by debbugs.gnu.org; 3 Jun 2022 10:51:34 +0000 Received: from localhost ([127.0.0.1]:55370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4ty-0002xL-0W for submit@debbugs.gnu.org; Fri, 03 Jun 2022 06:51:34 -0400 Received: from [192.151.158.155] (port=48404 helo=mail.boiledscript.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4K6-0001oK-IX for 49969@debbugs.gnu.org; Fri, 03 Jun 2022 06:14:30 -0400 Received: from localhost (unknown [192.168.203.1]) by mail.boiledscript.com (Postfix) with ESMTP id BD7D1300A0B for <49969@debbugs.gnu.org>; Fri, 3 Jun 2022 10:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1654251265; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lbFTTvtHIIQoSCOC/MUp+3CjaIhveJ48hRXfh/6Wz0M=; b=05VWzaQ11MbmycDApvtIkV2obgSgwZ06oyoNbwt6XI2SBzTLDmyUazK48Sf0MfWrCAcj1Z r1UJB+EPipp+oJcYQjcXrYCLZulmXmUZBlaY1r3ptizfWyN5w8+NymCXxmf6a6O1u0fvIz vc0Sxd/mqaOpFcgNRfgN5QKPitY2P9OP3J9CtOvd7eT0MSR3QpsQ+ytk7/A6vGWjOppf2J +LHlSDwnlB6AKiLQkfNin8YFPJZjmo8p5hZHDNrO5ibi8f3MPwTU7Re5Gq2b2PDxPBEXvR aY8CspKiTUxwde8VD6TVRlt6FpJaScWHcqP0zBGC1MohGF11onSq+d2T5proMg== Date: Fri, 3 Jun 2022 18:14:11 +0800 Message-ID: <20220603181411.0a9ec225@ultrarare.space> In-Reply-To: <20220603181143.5bef4199@ultrarare.space> References: <20220603180923.0caf6958@ultrarare.space> <20220603181031.1ac07de0@ultrarare.space> <20220603181143.5bef4199@ultrarare.space> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; none X-Spamd-Bar: / X-Mailman-Approved-At: Fri, 03 Jun 2022 06:51:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 03 Jun 2022 06:54:55 -0400 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" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain X-getmail-retrieved-from-mailbox: Patches * gnu/packages/admin.scm (greetd-pam-mount): New variable Signed-off-by: Hilton Chain --- gnu/packages/admin.scm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index d94b113d4e24..7095259ff9b0 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -5053,3 +5053,35 @@ (define-public greetd 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 Fri Jun 3 10:15:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39728 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 8CB8927BBEA; Fri, 3 Jun 2022 11:55:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 04AAC27BBE9 for ; Fri, 3 Jun 2022 11:55:23 +0100 (BST) Received: from localhost ([::1]:38636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx4xd-0004BU-Ve for patchwork@mira.cbaines.net; Fri, 03 Jun 2022 06:55:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx4uR-0001ZZ-Da for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx4uR-0006vp-29 for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nx4uR-0002yn-1P for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v9 4/7] gnu: base: Add greetd-service-type. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jun 2022 10:52: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.165425349811389 (code B ref 49969); Fri, 03 Jun 2022 10:52:02 +0000 Received: (at 49969) by debbugs.gnu.org; 3 Jun 2022 10:51:38 +0000 Received: from localhost ([127.0.0.1]:55372 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4ty-0002xS-8j for submit@debbugs.gnu.org; Fri, 03 Jun 2022 06:51:38 -0400 Received: from [192.151.158.155] (port=48598 helo=mail.boiledscript.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4LZ-0001r9-Rj for 49969@debbugs.gnu.org; Fri, 03 Jun 2022 06:16:12 -0400 Received: from localhost (unknown [192.168.203.1]) by mail.boiledscript.com (Postfix) with ESMTP id 954C1300A0B for <49969@debbugs.gnu.org>; Fri, 3 Jun 2022 10:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1654251355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PcTXoqDCchNFkstkz6ihSzEE1EluTjfhAW9JS1h8dHQ=; b=u1f/lu0p28maDNAgDyK5Q+YBw5PojxOMiS/2DPle+/T4Ye5Nm5s84Jwh0+OPaC8AOCTP7L 114vVgXbuwi2mrEf2yAls+WbIQBWZaAGX/jhrK3ZhpjJngtOwSCAp4vheBOLTERLJoTxAA qUjgnM+0DC82SbzInVAPhgmWB6fg8RJXMy/eHxjZQ79b4mnmjdGitPHJmQ9RWqvddZxtjP 2Upr6UL85Zvcenzg9yzDYAVmY+SNZVRTfTaaQC4G6QeNuTCRNtdinpS8jFhoMMoouJzoeC vb1ZJuubXbjxQrwQc4VfcpCspzPJ8o2JnlWQzb0WGPi/6VN3p1QdWWZgL+bt/Q== Date: Fri, 3 Jun 2022 18:15:41 +0800 Message-ID: <20220603181541.26a4c4f5@ultrarare.space> In-Reply-To: <20220603181411.0a9ec225@ultrarare.space> References: <20220603180923.0caf6958@ultrarare.space> <20220603181031.1ac07de0@ultrarare.space> <20220603181143.5bef4199@ultrarare.space> <20220603181411.0a9ec225@ultrarare.space> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; none X-Spamd-Bar: / X-Mailman-Approved-At: Fri, 03 Jun 2022 06:51:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 03 Jun 2022 06:54:55 -0400 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" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain 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 Signed-off-by: Hilton Chain --- 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 2bfff7c2ff9e..825c7d93c577 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -96,6 +96,7 @@ Copyright @copyright{} 2021 Hui Lu@* Copyright @copyright{} 2021 pukkamustard@* Copyright @copyright{} 2021 Alice Brenon@* +Copyright @copyright{} 2021 muradm@* Copyright @copyright{} 2021 Josselin Poiret@* Copyright @copyright{} 2021 Andrew Tropin@* Copyright @copyright{} 2021 Sarah Morgensen@* @@ -18018,6 +18019,138 @@ Base Services @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 3fb92e6da071..3a5c85ce61fd 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2020, 2021 Brice Waegeneire ;;; Copyright © 2021 qblade ;;; Copyright © 2021 Hui Lu +;;; Copyright © 2021 muradm ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2022 Guillaume Le Vaillant ;;; @@ -219,6 +220,11 @@ (define-module (gnu services base) pam-limits-service-type pam-limits-service + greetd-service-type + greetd-configuration + greetd-terminal-configuration + greetd-agreety-session + %base-services)) ;;; Commentary: @@ -1438,7 +1444,7 @@ (define pam-limits-service-type (module "pam_limits.so") (arguments '("conf=/etc/security/limits.conf"))))) (if (member (pam-service-name pam) - '("login" "su" "slim" "gdm-password" "sddm")) + '("login" "greetd" "su" "slim" "gdm-password" "sddm")) (pam-service (inherit pam) (session (cons pam-limits @@ -2773,6 +2779,216 @@ (define %qemu-static-networking (provision '(networking)) (name-servers '("10.0.2.3")))) + +;;; +;;; greetd-service-type -- minimal and flexible login manager daemon +;;; + +(define-record-type* + greetd-agreety-session make-greetd-agreety-session + greetd-agreety-session? + (agreety greetd-agreety (default greetd)) + (command greetd-agreety-command (default (file-append bash "/bin/bash"))) + (command-args greetd-agreety-command-args (default '("-l"))) + (extra-env greetd-agreety-extra-env (default '())) + (xdg-env? greetd-agreety-xdg-env? (default #t))) + +(define greetd-agreety-tty-session-command + (match-lambda + (($ _ command args extra-env) + (program-file + "agreety-tty-session-command" + #~(begin + (use-modules (ice-9 match)) + (for-each (match-lambda ((var . val) (setenv var val))) + (quote (#$@extra-env))) + (apply execl #$command #$command (list #$@args))))))) + +(define greetd-agreety-tty-xdg-session-command + (match-lambda + (($ _ command args extra-env) + (program-file + "agreety-tty-xdg-session-command" + #~(begin + (use-modules (ice-9 match)) + (let* + ((username (getenv "USER")) + (useruid (passwd:uid (getpwuid username))) + (useruid (number->string useruid))) + (setenv "XDG_SESSION_TYPE" "tty") + (setenv "XDG_RUNTIME_DIR" (string-append "/run/user/" useruid))) + (for-each (match-lambda ((var . val) (setenv var val))) + (quote (#$@extra-env))) + (apply execl #$command #$command (list #$@args))))))) + +(define (make-greetd-agreety-session-command config command) + (let ((agreety (file-append (greetd-agreety config) "/bin/agreety"))) + (program-file + "agreety-command" + #~(execl #$agreety #$agreety "-c" #$command)))) + +(define (make-greetd-default-session-command config-or-command) + (cond ((greetd-agreety-session? config-or-command) + (cond ((greetd-agreety-xdg-env? config-or-command) + (make-greetd-agreety-session-command + config-or-command + (greetd-agreety-tty-xdg-session-command config-or-command))) + (#t + (make-greetd-agreety-session-command + config-or-command + (greetd-agreety-tty-session-command config-or-command))))) + (#t config-or-command))) + +(define-record-type* + greetd-terminal-configuration make-greetd-terminal-configuration + greetd-terminal-configuration? + (greetd greetd-package (default greetd)) + (config-file-name greetd-config-file-name (thunked) + (default (default-config-file-name this-record))) + (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 33649b0f7c64..e60781d05bbe 100644 --- a/gnu/services/pam-mount.scm +++ b/gnu/services/pam-mount.scm @@ -90,7 +90,7 @@ (define (pam-mount-pam-service config) (module #~(string-append #$pam-mount "/lib/security/pam_mount.so")))) (list (lambda (pam) (if (member (pam-service-name pam) - '("login" "su" "slim" "gdm-password" "sddm")) + '("login" "greetd" "su" "slim" "gdm-password" "sddm")) (pam-service (inherit pam) (auth (append (pam-service-auth pam) From patchwork Fri Jun 3 10:16:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39725 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 A2FF427BBE9; Fri, 3 Jun 2022 11:55:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 166BA27BBEA for ; Fri, 3 Jun 2022 11:55:11 +0100 (BST) Received: from localhost ([::1]:37844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx4xS-0003bV-88 for patchwork@mira.cbaines.net; Fri, 03 Jun 2022 06:55:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx4uT-0001at-86 for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33251) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx4uR-0006vu-Fu for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nx4uR-0002yu-FQ for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v9 5/7] gnu: admin: Add libseat 0.7.0 and move seatd. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jun 2022 10:52: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.165425349911397 (code B ref 49969); Fri, 03 Jun 2022 10:52:03 +0000 Received: (at 49969) by debbugs.gnu.org; 3 Jun 2022 10:51:39 +0000 Received: from localhost ([127.0.0.1]:55374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4u2-0002xe-M1 for submit@debbugs.gnu.org; Fri, 03 Jun 2022 06:51:39 -0400 Received: from [192.151.158.155] (port=48760 helo=mail.boiledscript.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4MZ-0001st-L5 for 49969@debbugs.gnu.org; Fri, 03 Jun 2022 06:17:14 -0400 Received: from localhost (unknown [192.168.203.1]) by mail.boiledscript.com (Postfix) with ESMTP id 4E150300A0B for <49969@debbugs.gnu.org>; Fri, 3 Jun 2022 10:16:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1654251417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F0vHyleS5KGmAOfqHNdqBFNhcsn2oBcn4iBoO8Bsbtc=; b=q5ULlwsP7dj4H+THJyQUilx9YPpoVc5pPgniY3/HBCTsvTiGjdAVYCiBKmAnUD7LvFqvXG p7IL0BJFDTjdJbzGYd8vVcziy0g6LZVCORWq4osexFoRBarm1czH4wdkvYDnXZ+m1mes+B 0DLgZ0/Xi37lcCQIAmVTtEozhDpFruh2kYKaD1ZcN0O5aYA4lyQggyJ7IVs2RNBd5JAUKL /xaLDE5iluCMvLoUa03BptroAP/nac6y9JQBcqxsz0DChjikRNmZsWCQ4HxDzzEzlbSY9I L8HXEt6z59Tgp367bhceI8ZYJmUEFOn6VF93xmkMAr1OFlE0l7FiqUl40pyb8g== Date: Fri, 3 Jun 2022 18:16:44 +0800 Message-ID: <20220603181644.4dd65bf3@ultrarare.space> In-Reply-To: <20220603181541.26a4c4f5@ultrarare.space> References: <20220603180923.0caf6958@ultrarare.space> <20220603181031.1ac07de0@ultrarare.space> <20220603181143.5bef4199@ultrarare.space> <20220603181411.0a9ec225@ultrarare.space> <20220603181541.26a4c4f5@ultrarare.space> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; none X-Spamd-Bar: / X-Mailman-Approved-At: Fri, 03 Jun 2022 06:51:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 03 Jun 2022 06:54:55 -0400 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" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain 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 Signed-off-by: Hilton Chain --- gnu/packages/admin.scm | 51 ++++++++++++++++++++++++++++++++++++ gnu/packages/freedesktop.scm | 29 -------------------- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 7095259ff9b0..774ad88274b2 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -46,6 +46,7 @@ ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Maxime Devos ;;; Copyright © 2021 muradm +;;; Copyright © 2021 pineapples ;;; Copyright © 2021 Petr Hodina ;;; Copyright © 2021 Artyom V. Poptsov ;;; Copyright © 2022 Wamm K. D. @@ -4976,6 +4977,56 @@ (define-public udpcast (home-page "https://www.udpcast.linux.lu") (license license:gpl2+))) +(define-public libseat + (package + (name "libseat") + (version "0.7.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://git.sr.ht/~kennylevinsen/seatd") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "10f8387yy5as547xjjhl0cna6iywdgjmw0iq2nvcs8q6vlpnik4v")))) + (build-system meson-build-system) + (arguments + `(#:configure-flags '("-Dlibseat-logind=elogind" + "-Dserver=disabled"))) + (native-inputs + `(("pkg-config" ,pkg-config))) + (propagated-inputs + `(("elogind" ,elogind))) + (home-page "https://sr.ht/~kennylevinsen/seatd") + (synopsis "Seat management library") + (description + "This package provides a universal seat management library that +allows applications to use whatever seat management is available.") + (license license:expat))) + +(define-public seatd + (package + (inherit libseat) + (name "seatd") + (arguments + `(#:configure-flags '("-Dlibseat-logind=elogind") + #:phases + (modify-phases %standard-phases + (add-after 'install 'remove-libs + (lambda* (#:key outputs #:allow-other-keys) + (with-directory-excursion (assoc-ref outputs "out") + (for-each delete-file-recursively + '("lib" "include")))))))) + (native-inputs `(("pkg-config" ,pkg-config) ("scdoc" ,scdoc))) + (inputs '()) + (synopsis "Seat management daemon") + (description + "This package provides a minimal seat management daemon whose task is to +mediate access to shared devices, such as graphics and input, for applications +that require it.") + (license license:expat))) + (define-public greetd (package (name "greetd") diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm index fc2c45c1f137..309876867a16 100644 --- a/gnu/packages/freedesktop.scm +++ b/gnu/packages/freedesktop.scm @@ -849,35 +849,6 @@ (define-public localed with localed. This package is extracted from the broader systemd package.") (license license:lgpl2.1+))) -(define-public seatd - (package - (name "seatd") - (version "0.5.0") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://git.sr.ht/~kennylevinsen/seatd") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1kglq8v4rnr3415mfaghyv2s2f8mxsy5s881gmm2908ig4n4j297")))) - (build-system meson-build-system) - (arguments - `(#:configure-flags '("-Dlogind=enabled"))) - (native-inputs - (list pkg-config scdoc)) - (propagated-inputs - (list elogind)) - (home-page "https://sr.ht/~kennylevinsen/seatd") - (synopsis "Seat management daemon and library") - (description - "This package provides a minimal seat management daemon whose task is to -mediate access to shared devices, such as graphics and input, for applications -that require it. It also provides a universal seat management library that -allows applications to use whatever seat management is available.") - (license license:expat))) - (define-public packagekit (package (name "packagekit") From patchwork Fri Jun 3 10:17:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39727 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 2EC1127BBEB; Fri, 3 Jun 2022 11:55:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 380B027BBEA for ; Fri, 3 Jun 2022 11:55:23 +0100 (BST) Received: from localhost ([::1]:38688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx4xe-0004Da-12 for patchwork@mira.cbaines.net; Fri, 03 Jun 2022 06:55:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx4uT-0001au-88 for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33252) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx4uR-0006x2-Sy for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nx4uR-0002z2-S8 for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v9 6/7] gnu: desktop: Add seatd-service-type. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jun 2022 10:52: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.165425349911404 (code B ref 49969); Fri, 03 Jun 2022 10:52:03 +0000 Received: (at 49969) by debbugs.gnu.org; 3 Jun 2022 10:51:39 +0000 Received: from localhost ([127.0.0.1]:55376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4u3-0002xm-6S for submit@debbugs.gnu.org; Fri, 03 Jun 2022 06:51:39 -0400 Received: from [192.151.158.155] (port=48930 helo=mail.boiledscript.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4NN-0001uJ-M3 for 49969@debbugs.gnu.org; Fri, 03 Jun 2022 06:17:55 -0400 Received: from localhost (unknown [192.168.203.1]) by mail.boiledscript.com (Postfix) with ESMTP id 4F384300A0B for <49969@debbugs.gnu.org>; Fri, 3 Jun 2022 10:17:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1654251468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PRSXOce/KWZjd7RImPKoiHLofiTC6TX4PcTfHRvZGl8=; b=pxH6xgEQ1PlT2LF7pgkoLu5k7WQdjTUYQ3isDZV7Nirbaxq/UpCgaDjiY6bbryg/TFlfhg nX7JzNXgN0Jp055jQK8/mLxezGXPV5C16h4+hjmrcFClgnjcGZq0jgJzRCm5MZw0hq5Mta rK+o0YfU4CFORbPU5oBnaFY5zxrWdD2b96KJC08GaiFnj3+vOq9sAAzGWgNZvQkDkCP96l Woy4x47UCSI1OufaTPGGXovOFZU72yJJRLcNJqLxw4MudbNmESBeROUFjy1kUXtvcMbiaw mtVQFaH/Kkrd4d785d7DFV9EFrqbdNrl4pJIPlMJrsuufBqmOqAbBFxc/qSO/w== Date: Fri, 3 Jun 2022 18:17:35 +0800 Message-ID: <20220603181735.4ceb2425@ultrarare.space> In-Reply-To: <20220603181644.4dd65bf3@ultrarare.space> References: <20220603180923.0caf6958@ultrarare.space> <20220603181031.1ac07de0@ultrarare.space> <20220603181143.5bef4199@ultrarare.space> <20220603181411.0a9ec225@ultrarare.space> <20220603181541.26a4c4f5@ultrarare.space> <20220603181644.4dd65bf3@ultrarare.space> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; none X-Spamd-Bar: / X-Mailman-Approved-At: Fri, 03 Jun 2022 06:51:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 03 Jun 2022 06:54:55 -0400 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" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain X-getmail-retrieved-from-mailbox: Patches * gnu/services/desktop.scm (seatd-service-type): New variable * gnu/services/desktop.scm (seatd-configuration): New data type Signed-off-by: Hilton Chain --- doc/guix.texi | 42 ++++++++++++++++++++++++++++ gnu/services/desktop.scm | 59 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 825c7d93c577..3f8e61a2b16e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22656,6 +22656,48 @@ Desktop Services @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 0499071436af..1ba91002e444 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -13,6 +13,7 @@ ;;; Copyright © 2020 Tobias Geerinckx-Rice ;;; Copyright © 2020 Reza Alizadeh Majd ;;; Copyright © 2021 Brice Waegeneire +;;; Copyright © 2021 muradm ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,7 +40,9 @@ (define-module (gnu services desktop) #:use-module (gnu services networking) #:use-module (gnu services sound) #:use-module ((gnu system file-systems) - #:select (%elogind-file-systems file-system)) + #:select (%control-groups + %elogind-file-systems + file-system)) #:autoload (gnu services sddm) (sddm-service-type) #:use-module (gnu system) #:use-module (gnu system setuid) @@ -157,6 +160,9 @@ (define-module (gnu services desktop) gnome-keyring-configuration? gnome-keyring-service-type + seatd-configuration + seatd-service-type + %desktop-services)) ;;; Commentary: @@ -1630,6 +1636,57 @@ (define polkit-wheel (define polkit-wheel-service (simple-service 'polkit-wheel polkit-service-type (list polkit-wheel))) + +;;; +;;; seatd-service-type -- minimal seat management daemon +;;; + +(define-record-type* seatd-configuration + make-seatd-configuration + seatd-configuration? + (seatd seatd-package (default seatd)) + (user seatd-user (default "root")) + (group seatd-group (default "users")) + (socket seatd-socket (default "/run/seatd.sock")) + (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)) + #: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 Fri Jun 3 10:18:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 39723 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 A6B8127BBEA; Fri, 3 Jun 2022 11:55:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, SPF_HELO_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0354227BBE9 for ; Fri, 3 Jun 2022 11:55:10 +0100 (BST) Received: from localhost ([::1]:37834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nx4xR-0003b7-0d for patchwork@mira.cbaines.net; Fri, 03 Jun 2022 06:55:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nx4uT-0001av-8N for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33253) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nx4uS-0006x3-9X for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nx4uS-0002z9-8r for guix-patches@gnu.org; Fri, 03 Jun 2022 06:52:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49969] [PATCH v9 7/7] gnu: tests: Add seatd/greetd based minimal desktop system tests. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jun 2022 10:52: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.165425350011411 (code B ref 49969); Fri, 03 Jun 2022 10:52:04 +0000 Received: (at 49969) by debbugs.gnu.org; 3 Jun 2022 10:51:40 +0000 Received: from localhost ([127.0.0.1]:55378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4u3-0002xt-O8 for submit@debbugs.gnu.org; Fri, 03 Jun 2022 06:51:40 -0400 Received: from [192.151.158.155] (port=49052 helo=mail.boiledscript.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nx4O7-0001vc-BP for 49969@debbugs.gnu.org; Fri, 03 Jun 2022 06:18:39 -0400 Received: from localhost (unknown [192.168.203.1]) by mail.boiledscript.com (Postfix) with ESMTP id A5A0D300A0B for <49969@debbugs.gnu.org>; Fri, 3 Jun 2022 10:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1654251513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zb5Mb44EiyZMox+PnjBBx67Q4ApBFm7RQ8MXKJg/xn4=; b=LIdZMf6G+Ymr05hs67+/WnWXyor//AkD8d9oHIyhajFTpDip+eZDMnpvrjQwMwqV1/M/E2 GPUwOHsaFgjaqKRoIfIJWEITLXMZ1sKDa6roRHUxDM7d+/njJ3uaSCh0BiltrNh3vwxBG6 1OTB3ZQo4c5gVgdhQZMUOsOYORa/YjNm5raqEpWXUlgHN6JXGJYJKFwGeDKzsGM7aui4+4 LNdioPXrQdB/lJxjcxICUkxSo5Yo4uYvIKdbejg6J3vvq/sRGluh92n/uKo5O7OrnAeOJp 8KAtU7fLuvwEWNyxX/jU9z1ob0TdezV17aktxfzML68ZD2pLDtS+Dt0kNgZBpw== Date: Fri, 3 Jun 2022 18:18:21 +0800 Message-ID: <20220603181821.112028c2@ultrarare.space> In-Reply-To: <20220603181735.4ceb2425@ultrarare.space> References: <20220603180923.0caf6958@ultrarare.space> <20220603181031.1ac07de0@ultrarare.space> <20220603181143.5bef4199@ultrarare.space> <20220603181411.0a9ec225@ultrarare.space> <20220603181541.26a4c4f5@ultrarare.space> <20220603181644.4dd65bf3@ultrarare.space> <20220603181735.4ceb2425@ultrarare.space> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Authentication-Results: mail.boiledscript.com; none X-Spamd-Bar: / X-Mailman-Approved-At: Fri, 03 Jun 2022 06:51:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 03 Jun 2022 06:54:55 -0400 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" Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches X-Patchwork-Original-From: Hilton Chain via Guix-patches via From: Hilton Chain X-getmail-retrieved-from-mailbox: Patches * gnu/tests/desktop.scm (minimal-desktop): seatd/greetd based minimal desktop test Signed-off-by: Hilton Chain --- 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 57069c0edee5..7cc837f42e72 100644 --- a/gnu/tests/desktop.scm +++ b/gnu/tests/desktop.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2021 Ludovic Courtès +;;; Copyright © 2021 muradm ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,13 +19,17 @@ (define-module (gnu tests desktop) #:use-module (gnu tests) + #:use-module (gnu packages shells) #:use-module (gnu services) + #:use-module (gnu services base) #:use-module (gnu services dbus) #:use-module (gnu services desktop) + #:use-module (gnu system) #:use-module (gnu system vm) #:use-module (guix gexp) #:use-module (srfi srfi-1) - #:export (%test-elogind)) + #:export (%test-elogind + %test-minimal-desktop)) ;;; @@ -100,3 +105,208 @@ (define %test-elogind #:imported-modules '((gnu services herd) (guix combinators))))) (run-elogind-test (virtual-machine os)))))) + + +;;; +;;; Seatd/greetd based minimal desktop +;;; + +(define %minimal-services + (append + (modify-services %base-services + ;; greetd-service-type provides "greetd" PAM service + (delete login-service-type) + ;; and can be used in place of mingetty-service-type + (delete mingetty-service-type)) + (list + (service seatd-service-type) + (service greetd-service-type + (greetd-configuration + (terminals + (list + ;; we can make any terminal active by default + (greetd-terminal-configuration (terminal-vt "1") (terminal-switch #t)) + ;; we can make environment without XDG_RUNTIME_DIR set + ;; even provide our own environment variables + (greetd-terminal-configuration + (terminal-vt "2") + (default-session-command + (greetd-agreety-session + (extra-env '(("MY_VAR" . "1"))) + (xdg-env? #f)))) + ;; we can use different shell instead of default bash + (greetd-terminal-configuration + (terminal-vt "3") + (default-session-command + (greetd-agreety-session (command (file-append zsh "/bin/zsh"))))) + ;; we can use any other executable command as greeter + (greetd-terminal-configuration + (terminal-vt "4") + (default-session-command (program-file "my-noop-greeter" #~(exit)))) + (greetd-terminal-configuration (terminal-vt "5")) + (greetd-terminal-configuration (terminal-vt "6")))))) + ;; mingetty-service-type can be used in parallel + ;; if needed to do so, do not (delete login-service-type) + ;; as illustrated above + #| (service mingetty-service-type (mingetty-configuration (tty "tty8"))) |#))) + +(define-syntax-rule (minimal-operating-system user-services ...) + "Return an operating system that includes USER-SERVICES in addition to +minimal %BASE-SERVICES." + (operating-system (inherit %simple-os) + (services (cons* user-services ... %minimal-services)))) + +(define (run-minimal-desktop-test os vm) + (define test + (with-imported-modules '((gnu build marionette) + (guix build syscalls)) + #~(begin + (use-modules (gnu build marionette) + (guix build syscalls) + (srfi srfi-1) + (srfi srfi-64) + (ice-9 pretty-print)) + + (define marionette + (make-marionette #$vm)) + + (define (file-get-all-strings fname) + (marionette-eval '(use-modules (rnrs io ports)) marionette) + (wait-for-file fname marionette #:read 'get-string-all)) + + (define (wait-for-unix-socket-m socket) + (wait-for-unix-socket socket marionette)) + + (mkdir #$output) + (chdir #$output) + + (test-begin "minimal-desktop") + + (test-assert "seatd is ready" + (wait-for-unix-socket-m "/run/seatd.sock")) + + (test-equal "login user on tty1" + "alice\n" + (begin + ;; Wait for tty1. + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'term-tty1)) + marionette) + (marionette-control "sendkey ctrl-alt-f1" marionette) + + ;; login as root change alice password and exit + ;; then login as alice + (for-each + (lambda (cmd) (marionette-type cmd marionette) (sleep 1)) + (list + "root\n" + "passwd alice\n" + "alice\n" + "alice\n" + "exit\n" + "alice\n" + "alice\n" + "id -un > logged-in\n")) + + (file-get-all-strings "/home/alice/logged-in"))) + + (test-equal "validate user environment" + '("SEATD_SOCK=/run/seatd.sock" + "XDG_RUNTIME_DIR=/run/user/1000" + "XDG_SEAT=seat0" + "XDG_VTNR=1") + + (begin + (marionette-type "env > env\n" marionette) + (sleep 1) + + (define user-env (string-tokenize + (file-get-all-strings "/home/alice/env"))) + + (define (expected-var var) + (any (lambda (s) (string-contains var s)) + '("SEATD_SOCK" + "XDG_RUNTIME_DIR" + "XDG_SEAT" + "XDG_VTNR"))) + + (sort (filter expected-var user-env) string env\n" marionette) + (sleep 1) + + (define (sock-var? var) + (any (lambda (s) (string-contains var s)) + '("SEATD_SOCK" "GREETD_SOCK"))) + + (define (sock-var-sock var) + (car (cdr (string-split var #\=)))) + + (let* + ((out (file-get-all-strings "/home/alice/env")) + (out (string-tokenize out)) + (out (filter sock-var? out)) + (socks (map sock-var-sock out)) + (socks (map wait-for-unix-socket-m socks))) + (and (= 2 (length socks)) (every identity socks))))) + + (test-assert "greetd is ready" + (begin + (marionette-type "ps -C greetd -o pid,args --no-headers > ps-greetd\n" + marionette) + (sleep 1) + + (define (greetd-daemon? cmd) + (string-contains cmd "config")) + + (define (greetd-cmd-to-pid cmd) + (car (string-split cmd #\space))) + + (define (greetd-pid-to-sock pid) + (string-append "/run/greetd-" pid ".sock")) + + (let* ((out (file-get-all-strings "/home/alice/ps-greetd")) + (out (string-split out #\newline)) + (out (map string-trim-both out)) + (out (filter greetd-daemon? out)) + (pids (map greetd-cmd-to-pid out)) + (socks (map greetd-pid-to-sock pids)) + (socks (map wait-for-unix-socket-m socks))) + (every identity socks)))) + + ;; a bit weak, but tests everything at once actually + (test-equal "check /run/user/ mounted and writable" + "alice\n" + (begin + (marionette-type "echo alice > /run/user/1000/test\n" marionette) + (file-get-all-strings "/run/user/1000/test"))) + + (test-assert "screendump" + (begin + (marionette-control (string-append "screendump " #$output + "/tty1.ppm") + marionette) + (file-exists? "tty1.ppm"))) + + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "minimal-desktop" test)) + +(define %test-minimal-desktop + (system-test + (name "minimal-desktop") + (description + "Test whether we can log in when seatd and greetd is enabled") + (value + (let* ((os (marionette-operating-system + (minimal-operating-system) + #:imported-modules '((gnu services herd) + (guix combinators)))) + (vm (virtual-machine os))) + (run-minimal-desktop-test (virtualized-operating-system os '()) + #~(list #$vm))))))