[PATCH 0/7] gnu: desktop: Add seatd-service-type and greetd-service-type

DoneSubmitted by muradm.
Details
8 participants
  • Hilton Chain
  • Lars-Dominik Braun
  • Leo Famulari
  • muradm
  • Maxime Devos
  • norgli
  • Xinglu Chen
  • Tom Fitzhenry
Owner
unassigned
Severity
normal
M
M
muradm wrote on 9 Aug 2021 21:02
(address . guix-patches@gnu.org)(name . muradm)(address . mail@muradm.net)
20210809190257.7280-1-mail@muradm.net
This patch series introduces two new services;

- seatd-service-type: simple seat management daemon
- greetd-service-type: simple login daemon

Both services are very minimalistic in nature. Simple seatd daemon could
be said as replacement for elogind-service-type. greetd daemon is simple
replacement for mingetty/agetty.

In addition to the base services, special build of pam-mount module is
included as seatd-pam-mount. It is used to provide auto-(mounting/unmounting)
of XDG_RUNTIME_DIR. Special build is required to avoid interference with
default pam-mount if used in the system.

greetd provides agreety terminal greeter out of the box. Current
greetd-service-type includes configuration for greetd-agreety-session
variations, i.e. only terminal are supported at the moment.

Next step would be adding gtkgreet and/or wlgreet alternatives for
graphical greeter.

muradm (7):
gnu: rust-enquote: Add rust-enquote 1.0.3
gnu: rust-pam-sys: Add rust-pam-sys 0.5.6
gnu: greetd: Add greetd 0.7.0
gnu: seatd-pam-mount: Add seatd-pam-mount
gnu: desktop: Add seatd-service-type
gnu: desktop: Add greetd-service-type
doc: Add desktop seatd-service-type and greetd-service-type.

doc/guix.texi | 151 +++++++++++++++++++++
gnu/packages/admin.scm | 20 +++
gnu/packages/crates-io.scm | 48 +++++++
gnu/packages/freedesktop.scm | 71 ++++++++++
gnu/services/desktop.scm | 256 ++++++++++++++++++++++++++++++++++-
5 files changed, 545 insertions(+), 1 deletion(-)

--
2.32.0
M
M
muradm wrote on 9 Aug 2021 21:17
[PATCH 1/7] gnu: rust-enquote: Add rust-enquote 1.0.3
(address . 49969@debbugs.gnu.org)(name . muradm)(address . mail@muradm.net)
20210809191803.7833-1-mail@muradm.net
* gnu/packages/crates-io.scm (rust-enquote-1): Add rust-enquote 1.0.3
---
gnu/packages/crates-io.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 24cc772ba7..16620218b3 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Antero Mejr <antero@kodmin.com>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 muradm <muradm@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56972,3 +56973,24 @@ 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
+     "This Rust library quotes, unquotes, and unescapes strings.")
+    (description
+     "This Rust library quotes, unquotes, and unescapes strings.")
+    (license license:unlicense)))
-- 
2.32.0
M
M
muradm wrote on 9 Aug 2021 21:17
[PATCH 2/7] gnu: rust-pam-sys: Add rust-pam-sys 0.5.6
(address . 49969@debbugs.gnu.org)(name . muradm)(address . mail@muradm.net)
20210809191803.7833-2-mail@muradm.net
* gnu/packages/crates-io.scm (rust-pam-sys): Add rust-pam-sys 0.5.6
---
gnu/packages/crates-io.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (36 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 16620218b3..fc235c2aa6 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -56994,3 +56994,29 @@ variant of this library is available separately as @code{im}.")
     (description
      "This Rust library quotes, unquotes, and unescapes strings.")
     (license license:unlicense)))
+
+(define-public rust-pam-sys-0.5.6
+  (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))))
-- 
2.32.0
M
M
muradm wrote on 9 Aug 2021 21:17
[PATCH 3/7] gnu: greetd: Add greetd 0.7.0
(address . 49969@debbugs.gnu.org)(name . muradm)(address . mail@muradm.net)
20210809191803.7833-3-mail@muradm.net
* gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
---
gnu/packages/freedesktop.scm | 71 ++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)

Toggle diff (105 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 693a79c738..62c47ad70e 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -62,6 +64,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages disk)
@@ -862,6 +865,74 @@ 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 greetd
+  (package
+    (name "greetd")
+    (version "0.7.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 "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-nix" ,rust-nix-0.17)
+        ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+        ("rust-rpassword" ,rust-rpassword-4)
+        ("rust-users" ,rust-users-0.9)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-tokio" ,rust-tokio-0.2)
+        ("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)
+         (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)
+               (mkdir-p man1)
+               (mkdir-p man5)
+               (mkdir-p man7)
+               (with-directory-excursion "man"
+                 (system "scdoc < greetd-1.scd > greetd.1")
+                 (system "scdoc < greetd-5.scd > greetd.5")
+                 (system "scdoc < greetd-ipc-7.scd > greetd-ipc.7")
+                 (system "scdoc < agreety-1.scd > agreety.1"))
+               (install-file "man/greetd.1" man1)
+               (install-file "man/greetd.5" man5)
+               (install-file "man/greetd-ipc.7" man7)
+               (install-file "man/agreety.1" man1)
+               #t))))))
+    (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.")
+    (license license:gpl3+)))
+
 (define-public packagekit
   (package
     (name "packagekit")
-- 
2.32.0
M
M
muradm wrote on 9 Aug 2021 21:18
[PATCH 4/7] gnu: seatd-pam-mount: Add seatd-pam-mount
(address . 49969@debbugs.gnu.org)(name . muradm)(address . mail@muradm.net)
20210809191803.7833-4-mail@muradm.net
This package inherits pam-mount in the way that it is compiled
specifically for use with seatd daemon. It uses different
configuration location and name space for storing data in PAM.

seatd-pam-mount is used in configuration of seatd to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR in the way that
it will not interfere with default pam-mount configuration.

* gnu/packages/admin.scm (seatd-pam-mount): Add seatd-pam-mount
---
gnu/packages/admin.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index eda269f148..adc5f4d8fd 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -42,6 +42,7 @@
 ;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
 ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4247,6 +4248,25 @@ supports.  It can also mount encrypted LUKS volumes using the password
 supplied by the user when logging in.")
     (license (list license:gpl2+ license:lgpl2.1+))))
 
+(define-public seatd-pam-mount
+  (package
+    (inherit pam-mount)
+    (name "seatd-pam-mount")
+    (arguments
+     (substitute-keyword-arguments (package-arguments pam-mount)
+       ((#:configure-flags flags ''())
+        `(cons* "--with-rundir=/run/seatd" ,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/seatd_pam_mount.conf.xml\"\n")
+                 (("pam_mount_config") "seatd_pam_mount_config")
+                 (("pam_mount_system_authtok") "seatd_pam_mount_system_authtok"))))))))
+    (synopsis "pam-mount specifically compiled for use with seatd/greetd")))
+
 (define-public jc
   (package
     (name "jc")
-- 
2.32.0
M
M
muradm wrote on 9 Aug 2021 21:18
[PATCH 5/7] gnu: desktop: Add seatd-service-type
(address . 49969@debbugs.gnu.org)(name . muradm)(address . mail@muradm.net)
20210809191803.7833-5-mail@muradm.net
A seat management daemon, that does everything it needs to do.
Nothing more, nothing less. Depends only on libc.

* gnu/services/desktop.scm: Add seatd-service-type
---
gnu/services/desktop.scm | 117 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 116 insertions(+), 1 deletion(-)

Toggle diff (151 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 64d0e85301..cc13859532 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; 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 (%elogind-file-systems
+                          %control-groups
+                          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,115 @@ or setting its password with passwd.")))
 (define polkit-wheel-service
   (simple-service 'polkit-wheel polkit-service-type (list polkit-wheel)))
 
+
+;;;
+;;; seatd-service-type -- Seat management daemon
+;;;
+
+;; TODO: separate service-type is needed for cgroups
+(define %seatd-file-systems
+  (append
+   (list (file-system
+           (device "none")
+           (mount-point "/run/seatd/pam_mount")
+           (type "tmpfs")
+           (check? #f)
+           (flags '(no-suid no-dev no-exec))
+           (options "mode=0755")
+           (create-mount-point? #t)))
+   %control-groups))
+
+(define %seatd-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* <seatd-configuration> 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")))
+
+(define (make-seatd-pam-mount-configuration-file config)
+  (computed-file
+   "seatd_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
+               #$@%seatd-pam-mount-rules
+               (pmvarrun
+                #$(file-append seatd-pam-mount
+                               "/sbin/pmvarrun -u '%(USER)' -o '%(OPERATION)'"))))
+            port))))))
+
+(define (seatd-pam-mount-etc-service config)
+  `(("security/seatd_pam_mount.conf.xml"
+     ,(make-seatd-pam-mount-configuration-file config))))
+
+(define (seatd-pam-mount-pam-service config)
+  (define optional-pam-mount
+    (pam-entry
+     (control "optional")
+     (module #~(string-append #$seatd-pam-mount "/lib/security/pam_mount.so"))))
+  (list (lambda (pam)
+          (if (member (pam-service-name pam)
+                      '("login" "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 (seatd-shepherd-service config)
+  (list (shepherd-service
+         (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))))
+         (stop #~(make-kill-destructor)))))
+
+(define seatd-environment
+  (match-lambda
+    (($ <seatd-configuration> _ _ _ socket)
+     `(("SEATD_SOCK" . ,socket)))))
+
+(define seatd-service-type
+  (service-type (name 'seatd)
+                (extensions
+                 (list
+                  (service-extension session-environment-service-type
+                                     seatd-environment)
+                  (service-extension file-system-service-type
+                                     (const %seatd-file-systems))
+                  (service-extension etc-service-type
+                                     seatd-pam-mount-etc-service)
+                  (service-extension pam-root-service-type
+                                     seatd-pam-mount-pam-service)
+                  (service-extension shepherd-root-service-type
+                                     seatd-shepherd-service)))
+                (default-value (seatd-configuration))))
+
 
 ;;;
 ;;; The default set of desktop services.
-- 
2.32.0
M
M
muradm wrote on 9 Aug 2021 21:18
[PATCH 6/7] gnu: desktop: Add greetd-service-type
(address . 49969@debbugs.gnu.org)(name . muradm)(address . mail@muradm.net)
20210809191803.7833-6-mail@muradm.net
greetd is a minimal and flexible login manager daemon that makes
no assumptions about what you want to launch.

Currently, only agreety configuration is provided.

* gnu/services/desktop.scm: Add greetd-service-type
---
gnu/services/desktop.scm | 139 +++++++++++++++++++++++++++++++++++++++
1 file changed, 139 insertions(+)

Toggle diff (166 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index cc13859532..601b9921a4 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -49,6 +49,7 @@
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnome)
@@ -160,6 +161,11 @@
             seatd-configuration
             seatd-service-type
 
+            greetd-configuration
+            greetd-agreety-tty-session
+            greetd-agreety-tty-xdg-session
+            greetd-service-type
+
             %desktop-services))
 
 ;;; Commentary:
@@ -1297,6 +1303,139 @@ or setting its password with passwd.")))
                                      seatd-shepherd-service)))
                 (default-value (seatd-configuration))))
 
+
+;;;
+;;; greetd-service-type -- minimal and flexible login manager daemon
+;;;
+
+(define %greetd-accounts
+  (list (user-account (name "greeter") (group "wheel") (system? #t))))
+
+(define-record-type* <greetd-agreety-session>
+  greetd-agreety-session make-greetd-agreety-session
+  greetd-agreety-session?
+  (package greetd-agreety-command-package (default bash))
+  (command-bin greetd-agreety-command-bin (default "/bin/bash"))
+  (command-args greetd-agreety-command-args (default '("-l")))
+  (extra-env greetd-agreety-extra-env (default '()))
+  (command-generator greetd-agreety-command-generator))
+
+(define greetd-agreety-tty-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> pkg command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-session-command"
+      #~(begin
+          (use-modules (ice-9 match))
+          (let* ((abs-cmd-bin #$(file-append pkg command-bin)))
+            (for-each
+             (match-lambda ((var . val) (setenv var val)))
+             (quote (#$@extra-env)))
+            (apply execl abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-xdg-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> package command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-xdg-session-command"
+      #~(begin
+          (use-modules (ice-9 popen) (ice-9 rdelim) (ice-9 match))
+          (let*
+              ((pmvarrun-bin #$(file-append seatd-pam-mount "/sbin/pmvarrun"))
+               (username (getenv "USER"))
+               (useruid (passwd:uid (getpwuid username)))
+               (useruid (number->string useruid))
+               (pmvarrun-cmd (string-join (list pmvarrun-bin "-u" username "-o" "0") " "))
+               (pmvarrun-port (open-input-pipe pmvarrun-cmd))
+               (session-id (read-line pmvarrun-port))
+               (session-id (string-append username "-" session-id))
+               (abs-cmd-bin #$(file-append package command-bin)))
+            (close-pipe pmvarrun-port)
+            (setenv "XDG_SESSION_ID" session-id)
+            (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 abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-session-command)))
+
+(define greetd-agreety-tty-xdg-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-xdg-session-command)))
+
+(define-record-type* <greetd-configuration> greetd-configuration
+  make-greetd-configuration
+  greetd-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"))
+  (default-session-user greetd-default-session-user (default "greeter"))
+  (default-session-command greetd-default-session-command
+    (default greetd-agreety-tty-session)))
+
+(define (default-config-file-name config)
+  (string-join (list "config-" (greetd-terminal-vt config) ".toml") ""))
+
+(define make-greetd-default-session-command
+  (match-lambda
+    (($ <greetd-configuration> greetd _ _ _ default-session-command)
+     (cond ((greetd-agreety-session? default-session-command)
+            (let*
+                ((generator (greetd-agreety-command-generator
+                             default-session-command))
+                 (command (apply generator (list default-session-command)))
+                 (agreety-bin (file-append greetd "/bin/agreety")))
+              (program-file
+               "agreety-command"
+               #~(execl #$agreety-bin #$agreety-bin "-c" #$command))))
+           (else (program-file "agreety-command-exit" #~(exit #f)))))))
+
+(define (greetd-configuration-file config)
+  (let*
+      ((config-file-name (greetd-config-file-name config))
+       (terminal-vt (greetd-terminal-vt config))
+       (default-session-user (greetd-default-session-user config))
+       (default-session-command (make-greetd-default-session-command config)))
+    (mixed-text-file
+     config-file-name
+     "[terminal]\n"
+     "vt = " terminal-vt "\n"
+     "[default_session]\n"
+     "user = " default-session-user "\n"
+     "command = " default-session-command "\n")))
+
+(define (greetd-shepherd-service config)
+  (let*
+      ((greetd-bin (file-append (greetd-package config) "/sbin/greetd"))
+       (greetd-conf (greetd-configuration-file config)))
+    (list
+     (shepherd-service
+      (requirement '(user-processes host-name udev virtual-terminal))
+      (provision (list (symbol-append
+                        'term-tty
+                        (string->symbol (greetd-terminal-vt config)))))
+      (start #~(make-forkexec-constructor
+                (list #$greetd-bin "-c" #$greetd-conf)))
+      (stop #~(make-kill-destructor))))))
+
+(define greetd-service-type
+  (service-type
+   (name 'greetd)
+   (extensions
+    (list
+     (service-extension shepherd-root-service-type
+                        greetd-shepherd-service)
+     (service-extension account-service-type
+                        (const %greetd-accounts))))
+   (default-value (greetd-configuration))))
+
 
 ;;;
 ;;; The default set of desktop services.
-- 
2.32.0
M
M
muradm wrote on 9 Aug 2021 21:18
[PATCH 7/7] doc: Add desktop seatd-service-type and greetd-service-type.
(address . 49969@debbugs.gnu.org)(name . muradm)(address . mail@muradm.net)
20210809191803.7833-7-mail@muradm.net
* doc/guix.texi (Desktop Services): Provide documentation for
seatd-service-type and greetd-service-type including configuration
and sample usage.
---
doc/guix.texi | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 151 insertions(+)

Toggle diff (171 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 4eb5324b51..6c76a8d68a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -94,6 +94,7 @@ Copyright @copyright{} 2021 Xinglu Chen@*
 Copyright @copyright{} 2021 Raghav Gururajan@*
 Copyright @copyright{} 2021 Domagoj Stolfa@*
 Copyright @copyright{} 2021 Hui Lu@*
+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
@@ -19694,6 +19695,156 @@ and ``passwd'' is with the value @code{passwd}.
 @end table
 @end deftp
 
+@defvr {Scheme Variable} seatd-service-type
+A minimal seat management daemon, and a universal seat management library.
+
+Seat management takes care of mediating access to shared devices (graphics,
+input), without requiring the applications needing access to be root.
+
+In general should be used as replacement to @code{elogind-service-type}.
+And currently should be used with @code{greetd-service-type}.
+
+@lisp
+
+(append
+  (list
+   ;; make sure seatd is running
+   (service seatd-service-type)
+
+   ;; let's make terminals 1, 2 and 3 be an XDG terminal
+   ;; with XDG variables set on login.
+   (service greetd-service-type
+            (greetd-configuration
+             (terminal-vt "1")
+             (default-session-command greetd-agreety-tty-xdg-session)))
+   (service greetd-service-type
+            (greetd-configuration
+             (terminal-vt "2")
+             (default-session-command greetd-agreety-tty-xdg-session)))
+   (service greetd-service-type
+            (greetd-configuration
+             (terminal-vt "3")
+             (default-session-command greetd-agreety-tty-xdg-session)))
+
+   ;; let's make terminals 4, 5 and 6 be a plain bash terminal session
+   (service greetd-service-type
+            (greetd-configuration (terminal-vt "4")))
+   (service greetd-service-type
+            (greetd-configuration (terminal-vt "5")))
+   (service greetd-service-type
+            (greetd-configuration (terminal-vt "6"))))
+
+  (modify-services %desktop-services
+    ;; seatd/greetd combination can replace these
+    (delete elogind-service-type)
+    (delete agetty-service-type)
+    (delete mingetty-service-type)))
+
+@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/socket"})
+Where to create the seatd socket.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} greetd-service-type
+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.
+@end defvr
+
+@deftp {Data Type} greetd-configuration
+Configuration record for the 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{default-session-user} (default: @samp{"greeter"})
+The user to use for running the greeter.
+
+@item @code{default-session-command} (default: @code{greetd-agreety-tty-session})
+The command-line to run to start the default session.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{greetd-agreety-tty-session} - bash terminal session
+
+@item
+@code{greetd-agreety-tty-xdg-session} - bash terminal session with XDG environment
+
+@item
+@code{greetd-agreety-session} - custom instance of terminal session
+@end itemize
+
+@end table
+@end deftp
+
+@deftp {Data Type} greetd-agreety-session
+Configuration record for the agreety greetd greeter.
+
+@table @asis
+@item @code{package} (default: @code{bash})
+The package of command.
+
+@item @code{command-bin} (default: @samp{"/bin/bash"})
+Path to binary relative to @code{package}.
+
+@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{command-generator}
+Function that receives instance of this configuration as an argument and
+returns @code{program-file} that can be used with @code{agreety} greeter.
+
+Both @code{greetd-agreety-tty-session} and @code{greetd-agreety-tty-xdg-session}
+uses @code{greetd-agreety-session} under the hood.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} greetd-agreety-tty-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login.
+@end defvr
+
+@defvr {Scheme Variable} greetd-agreety-tty-xdg-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login. Additionally, will set @code{XDG_SESSION_ID}, @code{XDG_SESSION_TYPE} and
+@code{XDG_RUNTIME_DIR} environment variables for session.
+@end defvr
 
 @node Sound Services
 @subsection Sound Services
-- 
2.32.0
M
M
muradm wrote on 10 Aug 2021 21:36
[PATCH v2 0/7] gnu: desktop: Add seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210810193626.9186-1-mail@muradm.net
This patch series introduces two new services;

- seatd-service-type: simple seat management daemon
- greetd-service-type: simple login daemon

Both services are very minimalistic in nature. Simple seatd daemon
could be said as replacement for elogind-service-type. greetd daemon
is simple replacement for mingetty/agetty.

In addition to the base services, special build of pam-mount module is
included as greetd-pam-mount. It is used to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR. Special build is
required to avoid interference with default pam-mount, if used in
the system.

greetd provides agreety terminal greeter out of the box. Current
greetd-service-type includes configuration for greetd-agreety-session
variations, i.e. only terminal are supported at the moment.

Next step would be adding gtkgreet and/or wlgreet alternatives for
graphical greeter.

muradm (7):
gnu: crates-io: Add rust-enquote 1.0.3
gnu: crates-io: Add rust-pam-sys 0.5.6
gnu: freedesktop: Add greetd 0.7.0
gnu: admin: Add greetd-pam-mount
gnu: desktop: Add seatd-service-type
gnu: desktop: Add greetd-service-type
doc: Add desktop seatd-service-type and greetd-service-type

doc/guix.texi | 183 ++++++++++++++++++++++++
gnu/packages/admin.scm | 20 +++
gnu/packages/crates-io.scm | 49 +++++++
gnu/packages/freedesktop.scm | 80 +++++++++++
gnu/services/desktop.scm | 269 ++++++++++++++++++++++++++++++++++-
5 files changed, 600 insertions(+), 1 deletion(-)

--
2.32.0
M
M
muradm wrote on 10 Aug 2021 22:07
[PATCH v2 2/7] gnu: crates-io: Add rust-pam-sys 0.5.6
(address . 49969@debbugs.gnu.org)
20210810200756.9581-2-mail@muradm.net
* gnu/packages/crates-io.scm (rust-pam-sys): Add rust-pam-sys 0.5.6
---
gnu/packages/crates-io.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index b458080ca7..b365a2c8c0 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -56,6 +56,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages llvm)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages pcre)
@@ -56994,3 +56995,29 @@ variant of this library is available separately as @code{im}.")
     (description
      "This Rust library quotes, unquotes, and unescapes strings.")
     (license license:unlicense)))
+
+(define-public rust-pam-sys-0.5.6
+  (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))))
-- 
2.32.0
M
M
muradm wrote on 10 Aug 2021 22:07
[PATCH v2 1/7] gnu: crates-io: Add rust-enquote 1.0.3
(address . 49969@debbugs.gnu.org)
20210810200756.9581-1-mail@muradm.net
* gnu/packages/crates-io.scm (rust-enquote-1): Add rust-enquote 1.0.3
---
gnu/packages/crates-io.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 24cc772ba7..b458080ca7 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Antero Mejr <antero@kodmin.com>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56972,3 +56973,24 @@ 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
+     "This Rust library quotes, unquotes, and unescapes strings.")
+    (description
+     "This Rust library quotes, unquotes, and unescapes strings.")
+    (license license:unlicense)))
-- 
2.32.0
M
M
muradm wrote on 10 Aug 2021 22:07
[PATCH v2 3/7] gnu: freedesktop: Add greetd 0.7.0
(address . 49969@debbugs.gnu.org)
20210810200756.9581-3-mail@muradm.net
* gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
---
gnu/packages/freedesktop.scm | 80 ++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)

Toggle diff (114 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 693a79c738..631d36e765 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -62,6 +64,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages disk)
@@ -862,6 +865,83 @@ 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 greetd
+  (package
+    (name "greetd")
+    (version "0.7.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 "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-nix" ,rust-nix-0.17)
+        ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+        ("rust-rpassword" ,rust-rpassword-4)
+        ("rust-users" ,rust-users-0.9)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-tokio" ,rust-tokio-0.2)
+        ("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
+         ;; once https://todo.sr.ht/~kennylevinsen/greetd/25
+         ;; is solved, below patch can be removed
+         (add-after 'unpack 'patch-terminal-switch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "greetd/src/server.rs"
+               (("switch: true,")
+                "switch: false,"))))
+         (delete 'package)
+         (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)
+               (mkdir-p man1)
+               (mkdir-p man5)
+               (mkdir-p man7)
+               (with-directory-excursion "man"
+                 (system "scdoc < greetd-1.scd > greetd.1")
+                 (system "scdoc < greetd-5.scd > greetd.5")
+                 (system "scdoc < greetd-ipc-7.scd > greetd-ipc.7")
+                 (system "scdoc < agreety-1.scd > agreety.1"))
+               (install-file "man/greetd.1" man1)
+               (install-file "man/greetd.5" man5)
+               (install-file "man/greetd-ipc.7" man7)
+               (install-file "man/agreety.1" man1)
+               #t))))))
+    (native-inputs
+     `(("linux-pam" ,linux-pam)
+       ("scdoc" ,scdoc)))
+    (synopsis
+     "greetd is a minimal and flexible login manager daemon
+that makes no assumptions about what you want to launch.")
+    (description
+     "greetd is a minimal and flexible login manager daemon
+that makes no assumptions about what you want to launch.")
+    (license license:gpl3+)))
+
 (define-public packagekit
   (package
     (name "packagekit")
-- 
2.32.0
M
M
muradm wrote on 10 Aug 2021 22:07
[PATCH v2 4/7] gnu: admin: Add greetd-pam-mount
(address . 49969@debbugs.gnu.org)
20210810200756.9581-4-mail@muradm.net
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.

* gnu/packages/admin.scm (greetd-pam-mount): Add greetd-pam-mount
---
gnu/packages/admin.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index eda269f148..e805b219c5 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -42,6 +42,7 @@
 ;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
 ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4247,6 +4248,25 @@ supports.  It can also mount encrypted LUKS volumes using the password
 supplied by the user when logging in.")
     (license (list license:gpl2+ license:lgpl2.1+))))
 
+(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")))
+
 (define-public jc
   (package
     (name "jc")
-- 
2.32.0
M
M
muradm wrote on 10 Aug 2021 22:07
[PATCH v2 5/7] gnu: desktop: Add seatd-service-type
(address . 49969@debbugs.gnu.org)
20210810200756.9581-5-mail@muradm.net
A seat management daemon, that does everything it needs to do.
Nothing more, nothing less. Depends only on libc.

* gnu/services/desktop.scm: Add seatd-service-type
---
gnu/services/desktop.scm | 59 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)

Toggle diff (93 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 64d0e85301..bfba9bccec 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; 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,57 @@ 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> 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/socket"))
+  (loglevel seatd-loglevel (default "error")))
+
+(define (seatd-shepherd-service config)
+  (list (shepherd-service
+         (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
+    (($ <seatd-configuration> _ _ _ socket)
+     `(("SEATD_SOCK" . ,socket)))))
+
+(define seatd-service-type
+  (service-type
+   (name 'seatd)
+   (extensions
+    (list
+     (service-extension session-environment-service-type
+                        seatd-environment)
+     ;; TODO: once cgroups is separate dependency
+     ;; we should not mount it here
+     (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.
-- 
2.32.0
M
M
muradm wrote on 10 Aug 2021 22:07
[PATCH v2 7/7] doc: Add desktop seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210810200756.9581-7-mail@muradm.net
* doc/guix.texi (Desktop Services): Provide documentation for
seatd-service-type and greetd-service-type including configuration
and sample usage.
---
doc/guix.texi | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 183 insertions(+)

Toggle diff (203 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 4eb5324b51..586b879608 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -94,6 +94,7 @@ Copyright @copyright{} 2021 Xinglu Chen@*
 Copyright @copyright{} 2021 Raghav Gururajan@*
 Copyright @copyright{} 2021 Domagoj Stolfa@*
 Copyright @copyright{} 2021 Hui Lu@*
+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
@@ -19694,6 +19695,188 @@ and ``passwd'' is with the value @code{passwd}.
 @end table
 @end deftp
 
+@defvr {Scheme Variable} seatd-service-type
+A minimal seat management daemon, and a universal seat management library.
+
+Seat management takes care of mediating access to shared devices (graphics,
+input), without requiring the applications needing access to be root.
+
+In general should be used as replacement to @code{elogind-service-type}.
+
+@lisp
+(append
+  (list
+   ;; make sure seatd is running
+   (service seatd-service-type)
+
+   (service greetd-service-type
+            (greetd-configuration
+             (terminals
+              (list
+               ;; lets have terminals 1, 2 and 3 run default XDG terminal session
+               (greetd-terminal-configuration (terminal-vt "1"))
+               (greetd-terminal-configuration (terminal-vt "2"))
+               (greetd-terminal-configuration (terminal-vt "3"))
+               ;; and terminals 4, 5 and 6 plain bash terminal session
+               ;; although not so plain, just to illustrate flexibility
+               (greetd-terminal-configuration
+                (terminal-vt "4")
+                (default-session-command greetd-agreety-tty-session))
+               (greetd-terminal-configuration
+                (terminal-vt "5")
+                (default-session-command greetd-agreety-tty-session))
+               (greetd-terminal-configuration
+                (terminal-vt "6")
+                (default-session-command greetd-agreety-tty-session))))))
+
+  ;; normaly one would want %base-services
+  (modify-services %desktop-services
+    ;; seatd/greetd combination can replace these
+    (delete elogind-service-type)
+    (delete agetty-service-type)
+    (delete mingetty-service-type)))
+
+@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/socket"})
+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
+
+@defvr {Scheme Variable} greetd-service-type
+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.
+
+@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
+
+@end defvr
+
+@deftp {Data Type} greetd-configuration
+Configuration record for the greetd service.
+
+@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{default-session-user} (default: @samp{"greeter"})
+The user to use for running the greeter.
+
+@item @code{default-session-command} (default: @code{greetd-agreety-tty-xdg-session})
+The command-line to run to start the default session.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{greetd-agreety-tty-session} - bash terminal session
+
+@item
+@code{greetd-agreety-tty-xdg-session} - bash terminal session with XDG environment
+
+@item
+@code{greetd-agreety-session} - custom instance of terminal session
+@end itemize
+
+@end table
+@end deftp
+
+@deftp {Data Type} greetd-agreety-session
+Configuration record for the agreety greetd greeter.
+
+@table @asis
+@item @code{package} (default: @code{bash})
+The package of command.
+
+@item @code{command-bin} (default: @samp{"/bin/bash"})
+Path to binary relative to @code{package}.
+
+@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{command-generator}
+Function that receives instance of this configuration as an argument and
+returns @code{program-file} that can be used with @code{agreety} greeter.
+
+Both @code{greetd-agreety-tty-session} and @code{greetd-agreety-tty-xdg-session}
+uses @code{greetd-agreety-session} under the hood.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} greetd-agreety-tty-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login.
+@end defvr
+
+@defvr {Scheme Variable} greetd-agreety-tty-xdg-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login. Additionally, will set @code{XDG_SESSION_TYPE} and
+@code{XDG_RUNTIME_DIR} environment variables for session.
+@end defvr
+
 
 @node Sound Services
 @subsection Sound Services
-- 
2.32.0
M
M
muradm wrote on 10 Aug 2021 22:07
[PATCH v2 6/7] gnu: desktop: Add greetd-service-type
(address . 49969@debbugs.gnu.org)
20210810200756.9581-6-mail@muradm.net
greetd is a minimal and flexible login manager daemon that makes
no assumptions about what you want to launch.

Currently, only agreety configuration is provided.

* gnu/services/desktop.scm: Add greetd-service-type
---
gnu/services/desktop.scm | 210 +++++++++++++++++++++++++++++++++++++++
1 file changed, 210 insertions(+)

Toggle diff (230 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index bfba9bccec..be6bb0a86f 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -49,6 +49,7 @@
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnome)
@@ -1239,6 +1240,215 @@ or setting its password with passwd.")))
                         seatd-shepherd-service)))
    (default-value (seatd-configuration))))
 
+
+;;;
+;;; greetd-service-type -- minimal and flexible login manager daemon
+;;;
+
+(define-record-type* <greetd-agreety-session>
+  greetd-agreety-session make-greetd-agreety-session
+  greetd-agreety-session?
+  (package greetd-agreety-command-package (default bash))
+  (command-bin greetd-agreety-command-bin (default "/bin/bash"))
+  (command-args greetd-agreety-command-args (default '("-l")))
+  (extra-env greetd-agreety-extra-env (default '()))
+  (command-generator greetd-agreety-command-generator))
+
+(define greetd-agreety-tty-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> pkg command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-session-command"
+      #~(begin
+          (use-modules (ice-9 match))
+          (let* ((abs-cmd-bin #$(file-append pkg command-bin)))
+            (for-each
+             (match-lambda ((var . val) (setenv var val)))
+             (quote (#$@extra-env)))
+            (apply execl abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-xdg-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> package command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-xdg-session-command"
+      #~(begin
+          (use-modules (ice-9 popen) (ice-9 rdelim) (ice-9 match))
+          (let*
+              ((username (getenv "USER"))
+               (useruid (passwd:uid (getpwuid username)))
+               (useruid (number->string useruid))
+               (abs-cmd-bin #$(file-append package command-bin)))
+            (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 abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-session-command)))
+
+(define greetd-agreety-tty-xdg-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-xdg-session-command)))
+
+(define-record-type* <greetd-terminal-configuration>
+  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"))
+  (default-session-user greetd-default-session-user (default "greeter"))
+  (default-session-command greetd-default-session-command
+    (default greetd-agreety-tty-xdg-session)))
+
+(define (default-config-file-name config)
+  (string-join (list "config-" (greetd-terminal-vt config) ".toml") ""))
+
+(define make-greetd-terminal-default-session-command
+  (match-lambda
+    (($ <greetd-terminal-configuration> greetd _ _ _ default-session-command)
+     (cond ((greetd-agreety-session? default-session-command)
+            (let*
+                ((generator (greetd-agreety-command-generator
+                             default-session-command))
+                 (command (apply generator (list default-session-command)))
+                 (agreety-bin (file-append greetd "/bin/agreety")))
+              (program-file
+               "agreety-command"
+               #~(execl #$agreety-bin #$agreety-bin "-c" #$command))))
+           (else (program-file "agreety-command-exit" #~(exit #f)))))))
+
+(define (make-greetd-terminal-configuration-file config)
+  (let*
+      ((config-file-name (greetd-config-file-name config))
+       (terminal-vt (greetd-terminal-vt config))
+       (default-session-user (greetd-default-session-user config))
+       (default-session-command (make-greetd-terminal-default-session-command config)))
+    (mixed-text-file
+     config-file-name
+     "[terminal]\n"
+     "vt = " terminal-vt "\n"
+     "[default_session]\n"
+     "user = " default-session-user "\n"
+     "command = " default-session-command "\n")))
+
+(define %default-motd
+  (plain-file "motd" "This is the GNU operating system, welcome!\n\n"))
+
+(define %greetd-accounts
+  (list (user-account (name "greeter") (group "wheel") (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>
+  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"))))
+
+  (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
+        (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)
+   (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))))
+
 
 ;;;
 ;;; The default set of desktop services.
-- 
2.32.0
X
X
Xinglu Chen wrote on 11 Aug 2021 13:16
Re: [bug#49969] [PATCH v2 1/7] gnu: crates-io: Add rust-enquote 1.0.3
87o8a41bb5.fsf@yoctocell.xyz
On Tue, Aug 10 2021, muradm wrote:

Toggle quote (40 lines)
> * gnu/packages/crates-io.scm (rust-enquote-1): Add rust-enquote 1.0.3
> ---
> gnu/packages/crates-io.scm | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
> index 24cc772ba7..b458080ca7 100644
> --- a/gnu/packages/crates-io.scm
> +++ b/gnu/packages/crates-io.scm
> @@ -18,6 +18,7 @@
> ;;; Copyright © 2021 Antero Mejr <antero@kodmin.com>
> ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
> ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
> +;;; Copyright © 2021 muradm <mail@muradm.net>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -56972,3 +56973,24 @@ 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
> + "This Rust library quotes, unquotes, and unescapes strings.")

The synopsis should not end with a period. “This” doesn’t really bring
anything, maybe something like

Rust library that quotes, unquotes, and unescapes strings

See “16.4.4 Synopses and Descriptions” in the manual for more details.
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmETsX4VHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5NkAP/2kUoyRibQ28hvTWHn647Oc6Pq2D
9fnR+rRkBxHOCkbqwh0u8enwClaKQb2YKIbIHR/qAw0RkJ1T8148hVl6PHUSM74M
Itz9kS5ybdirSpH0hlJoVX18ORUpwhLIYbWDo3tEr/ETPSjPGCU2k8HaI275I7y0
dM8odQmm5Ep32sHOu+t9jJQFVNzRDEVyc49l3cqyFhksuagdVmkaDfG95ZYinTRu
eq2K36ZtNNYFGryzb6F+IvcickkcGBqVOAw0HmOhQn5HqEwPj345EPlOhbqlq4JZ
+urdGsdXfli98e+Ko58h3JW0reiTUl9cdqjPJCg1ro8eJi/tZqhsjgNR9PzMl92X
awsaLCgboum6FIl41ynokBSCr+Bh/QgDcpjpMO4VJLV2rjSdnRW2MZZ4ObIGcXks
W4acMLa10TW/8Eb+QzttVI5TllqqF6Tw2eB23xYPMStZcPdvpAfGZBeKv4gRIexy
4JHOB+ZCb+aqnCScoCOz2jiAhinu3sCyGlc8wIbNNkU0uGxkPypmAMygjfGLkefb
pWNNKWvx5ngs5XU3k7sJLU9BkcApFLuZaHY/n/CSWGEFp8aJobu/WlH/BP1ao4U3
+eMtLMNggWmlbp6HQdRw7M1pOGO4ouSbXAFyQB0PvRSiZZhd6Y6sUbsZ3/pSDw4Q
IWqJL1VCUAxW7dFo
=Gf13
-----END PGP SIGNATURE-----

X
X
Xinglu Chen wrote on 11 Aug 2021 13:20
Re: [bug#49969] [PATCH v2 2/7] gnu: crates-io: Add rust-pam-sys 0.5.6
87lf581b48.fsf@yoctocell.xyz
On Tue, Aug 10 2021, muradm wrote:

Toggle quote (45 lines)
> * gnu/packages/crates-io.scm (rust-pam-sys): Add rust-pam-sys 0.5.6
> ---
> gnu/packages/crates-io.scm | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
> index b458080ca7..b365a2c8c0 100644
> --- a/gnu/packages/crates-io.scm
> +++ b/gnu/packages/crates-io.scm
> @@ -56,6 +56,7 @@
> #:use-module (gnu packages image)
> #:use-module (gnu packages jemalloc)
> #:use-module (gnu packages llvm)
> + #:use-module (gnu packages linux)
> #:use-module (gnu packages multiprecision)
> #:use-module (gnu packages nettle)
> #:use-module (gnu packages pcre)
> @@ -56994,3 +56995,29 @@ variant of this library is available separately as @code{im}.")
> (description
> "This Rust library quotes, unquotes, and unescapes strings.")
> (license license:unlicense)))
> +
> +(define-public rust-pam-sys-0.5.6
> + (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).")

The synopsis should not end with a period.

Toggle quote (3 lines)
> + (description
> + "Rust FFI wrappers for the Linux Pluggable Authentication Modules (PAM).")

The description should contain one or more complete sentences, see
“16.4.4 Synopses and Descriptions” in the manual.
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmETsncVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5IN4P/A9KDh2SAPQBcFGqr4NmWPW9+rqc
bWHTIWc9swbwpO67L9b0io313B7UuTDsOch7bbVzQ+avX88jS8fgGWQVgKT80YAz
zZPuJR1mTGNpVz2PFNReZz1jI3E/uL43m79GJOuOJKJoa+h4uo1ZWKw5WPYr9kCW
O2pYd14g0Xa/Iik19gYSXixNE1yw2jbawFZroZx+HoBnn+qf0RiZG5bnZszAEsE6
8ZtufSk0UU+ZgWJkryFbw1Pv/6+4uO3AAjBMDMftJ+KeBLm+3YJDDN5REyiRiY8k
yYI0gdUv522jKHb4BWvMB0jh3sOkdLB/277goyOTwZ8Ky1S3lggVRFGytNqDTsC/
qHA0V+XhUyKxHctrRfwGxLppzm/1XWrBagnjcKzXbwjcA0m10rLw0WWaOkXUtwq5
XS/hMKClb9cZ4PMCNnovWOTy5RdFalHojuh1LaCU5DApOX6Fj/pT+7iOs+qe3it9
Aqp6GemzJgCrjKvj1PI/lad4RddLT1FN0ErGDKpFX0xpiJiAfCGzHgFA3CeSS91h
VdCUJ7yhHxWOe7DQVOJQ17tk/33psDWne/YCL+hb6GiCiOYt5OJ6AXK610sfrFqq
HVDEh92Uip9EHrAdSchVeSgss+U1fRX9KgeWHXjyz3p7BYkyEgeFu8Ks++KRtub+
9ho2gRCcKViK5/b7
=uPj6
-----END PGP SIGNATURE-----

X
X
Xinglu Chen wrote on 11 Aug 2021 13:29
Re: [bug#49969] [PATCH v2 3/7] gnu: freedesktop: Add greetd 0.7.0
87im0c1app.fsf@yoctocell.xyz
On Tue, Aug 10 2021, muradm wrote:

Toggle quote (94 lines)
> * gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
> ---
> gnu/packages/freedesktop.scm | 80 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 80 insertions(+)
>
> diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
> index 693a79c738..631d36e765 100644
> --- a/gnu/packages/freedesktop.scm
> +++ b/gnu/packages/freedesktop.scm
> @@ -24,6 +24,7 @@
> ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
> ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
> ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
> +;;; Copyright © 2021 muradm <mail@muradm.net>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -46,6 +47,7 @@
> #:use-module (guix packages)
> #:use-module (guix download)
> #:use-module (guix git-download)
> + #:use-module (guix build-system cargo)
> #:use-module (guix build-system cmake)
> #:use-module (guix build-system gnu)
> #:use-module (guix build-system meson)
> @@ -62,6 +64,7 @@
> #:use-module (gnu packages check)
> #:use-module (gnu packages cmake)
> #:use-module (gnu packages compression)
> + #:use-module (gnu packages crates-io)
> #:use-module (gnu packages cryptsetup)
> #:use-module (gnu packages databases)
> #:use-module (gnu packages disk)
> @@ -862,6 +865,83 @@ 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 greetd
> + (package
> + (name "greetd")
> + (version "0.7.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 "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
> + (build-system cargo-build-system)
> + (arguments
> + `(#:cargo-inputs
> + (("rust-nix" ,rust-nix-0.17)
> + ("rust-pam-sys" ,rust-pam-sys-0.5.6)
> + ("rust-rpassword" ,rust-rpassword-4)
> + ("rust-users" ,rust-users-0.9)
> + ("rust-serde" ,rust-serde-1)
> + ("rust-serde-json" ,rust-serde-json-1)
> + ("rust-libc" ,rust-libc-0.2)
> + ("rust-tokio" ,rust-tokio-0.2)
> + ("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
> + ;; once https://todo.sr.ht/~kennylevinsen/greetd/25
> + ;; is solved, below patch can be removed
> + (add-after 'unpack 'patch-terminal-switch
> + (lambda* (#:key inputs #:allow-other-keys)
> + (substitute* "greetd/src/server.rs"
> + (("switch: true,")
> + "switch: false,"))))
> + (delete 'package)
> + (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)
> + (mkdir-p man1)
> + (mkdir-p man5)
> + (mkdir-p man7)

No need to ‘mkdir-p’ if you will call ‘install-file’ on the directory.

Toggle quote (10 lines)
> + (with-directory-excursion "man"
> + (system "scdoc < greetd-1.scd > greetd.1")
> + (system "scdoc < greetd-5.scd > greetd.5")
> + (system "scdoc < greetd-ipc-7.scd > greetd-ipc.7")
> + (system "scdoc < agreety-1.scd > agreety.1"))
> + (install-file "man/greetd.1" man1)
> + (install-file "man/greetd.5" man5)
> + (install-file "man/greetd-ipc.7" man7)
> + (install-file "man/agreety.1" man1)

Why not put these four lines inside the (with-directory-excursion "man"
…) form, and remove the "man" prefix?

Toggle quote (2 lines)
> + #t))))))

Phases don’t need to return #t once the ‘core-updates’ branch gets
merged.

Toggle quote (7 lines)
> + (native-inputs
> + `(("linux-pam" ,linux-pam)
> + ("scdoc" ,scdoc)))
> + (synopsis
> + "greetd is a minimal and flexible login manager daemon
> +that makes no assumptions about what you want to launch.")

The synosis is a bit long, maybe

Minimal and flexible login manager daemon

Toggle quote (4 lines)
> + (description
> + "greetd is a minimal and flexible login manager daemon
> +that makes no assumptions about what you want to launch.")

“what you want to launch” sounds a bit vague, is it referring to desktop
environment, window manager, or something else?
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmETtIMVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5m84P/j/tu5uMTWDt79GVQUok5vcWdBjJ
Mzrehd6oSTMG3xzV8CJQtJ02r81faxlTzNiAAc2RxYj9uzSKC4XwU8u4ZUbdSrlf
EqN4NtaM2ooC7aJZS8JNvAZWIDQUTZ6Y1oRBqvkBRrSKu/gP+cGFyBnM1rahXwrK
jgzYWhRZeTuDA3zI05mx8oBRruKqL/KqeI9YhWD6eWfluSupzqqNCMdeDeSD3xL1
5Dq7dnCfmbFiznUq+Q1IqODpgS8el7QD5Xs2CXn/yHvr7cJxOj5pIpJYfkXm9vjW
/NJCB3N0Y1SAJ+iiulB0QHMJMZvng0fkpnYspA0G0+OetabhxzyfIfXzzkqFsJ+T
KtWmbOu507AvWnfedyrvuTqtLcaNg2cS8kmcseDNoHU55/Qqvn7ajB5swFGf9JMJ
zGfLIzDiD9v9h23ulxr+huXHaE3jTwSv1Q6TdGn/z+Wov7YPvleOD+HzIyqL18Zz
9Xn1ktdoZ8NJ/jmSgAjuV2Ct6jnnUesGkkowpkwcTVpGjk5rJVG18RiUVU3sqV5M
47AwJ2O4OwdhYhDpfZSbDt1WzCYCo0ABlBBvw9STnaF5u+LsPpJYbq4Nazpa6HcV
9CtoFmCM8x66FfEX8iAC9MPJxEZxLWnjZS9ilFccvbTGDfxzEPKywirMBDwAe1Or
/Kgn71SuoHfr8XvN
=zh3E
-----END PGP SIGNATURE-----

X
X
Xinglu Chen wrote on 11 Aug 2021 13:32
Re: [bug#49969] [PATCH v2 4/7] gnu: admin: Add greetd-pam-mount
87fsvg1akn.fsf@yoctocell.xyz
On Tue, Aug 10 2021, muradm wrote:

Toggle quote (8 lines)
> 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.

It might be a good idea to put this in a comment in the code too. :-)

Toggle quote (40 lines)
> * gnu/packages/admin.scm (greetd-pam-mount): Add greetd-pam-mount
> ---
> gnu/packages/admin.scm | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index eda269f148..e805b219c5 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -42,6 +42,7 @@
> ;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
> ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
> +;;; Copyright © 2021 muradm <mail@muradm.net>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -4247,6 +4248,25 @@ supports. It can also mount encrypted LUKS volumes using the password
> supplied by the user when logging in.")
> (license (list license:gpl2+ license:lgpl2.1+))))
>
> +(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")))

The description should also be updated.
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmETtTgVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5jCoP/ApifqyH998ZCkKAtzBckcr1aPC3
W9R9Z2+GuDtZerAQ2/ab2H3kaHEIpThK+vWxq7DY1OeiOuiaTeon7ZZ9PADoIYN6
2Zto/OFhiL+4+WXD9uYkCdp9rVW3QnN05inrnlGcjNg/tqH80dzeQJgSlyGkbEKu
NicD/PutIr1nGFrQVxNtk5cBKfsCkzMI0eJ1bYrCP96xHRAACKl1k8wjk0USvxpn
u7eZldVkVDj/WXuGTIWh63kkqIf5LBOVkPXcMp5ehX0+XMuuFIsjKONy2QJL3IlR
bmdAt5TvcGA0JpwMBBIAJ2bPfEjwSWf5mpKZAxX4yKRld/VH54vmr/ByK6SRqo7t
bv0tGDeo8pQDTZFX3tANAx9AgblwjXkVl6wv3/EdP1ItJZXEbshweIa0FzJPxkJJ
7/7g7HXf+MTP2iwNiiFvkeHNt3e96V9YVbc47Ap1uggt6zHML+JK6DylJek7SIjO
mAS7QsBVyZm4s4Oz7B7/jg+TiIyL6n8YqRvGenqZsFmlrGya0QGXJ82cggwioQ+B
ZFGtnayd8f/FbQPYyqmRGJZ8puKvaqDES/4uQXabVbcsbwSbETTcaLCxASHPrFwO
DKFGijpylXVP06AuRypIKh/pZIevgoGJO5Sr783CnTSLZpTwlcFPiHpEqTvcMOaZ
ojRfnKaTDtsg+FtY
=4rXY
-----END PGP SIGNATURE-----

X
X
Xinglu Chen wrote on 11 Aug 2021 13:52
Re: [bug#49969] [PATCH v2 5/7] gnu: desktop: Add seatd-service-type
87czqk19mi.fsf@yoctocell.xyz
On Tue, Aug 10 2021, muradm wrote:

Toggle quote (3 lines)
> A seat management daemon, that does everything it needs to do.
> Nothing more, nothing less. Depends only on libc.

I don’t it is necessary to put this in the commit log.

Toggle quote (73 lines)
> * gnu/services/desktop.scm: Add seatd-service-type
> ---
> gnu/services/desktop.scm | 59 +++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 58 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
> index 64d0e85301..bfba9bccec 100644
> --- a/gnu/services/desktop.scm
> +++ b/gnu/services/desktop.scm
> @@ -13,6 +13,7 @@
> ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
> ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
> +;;; Copyright © 2021 muradm <mail@muradm.net>
> ;;;
> ;;; 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,57 @@ 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> 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/socket"))
> + (loglevel seatd-loglevel (default "error")))
> +
> +(define (seatd-shepherd-service config)
> + (list (shepherd-service
> + (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)))))

‘documentation’ field is missing.

Toggle quote (21 lines)
> +
> +(define seatd-environment
> + (match-lambda
> + (($ <seatd-configuration> _ _ _ socket)
> + `(("SEATD_SOCK" . ,socket)))))
> +
> +(define seatd-service-type
> + (service-type
> + (name 'seatd)
> + (extensions
> + (list
> + (service-extension session-environment-service-type
> + seatd-environment)
> + ;; TODO: once cgroups is separate dependency
> + ;; we should not mount it here
> + (service-extension file-system-service-type
> + (const %control-groups))
> + (service-extension shepherd-root-service-type
> + seatd-shepherd-service)))
> + (default-value (seatd-configuration))))

Missing ‘description’ field.

It might also be a good idea to write a system test for the service, you
can look at the (gnu tests …) modules for examples.

I am not familiar with how seatd works, so I can’t really comment too
much. :-)
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmETugUVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5g/sP/09zoh8FJFVKkhKxz8A12hXJ2zbK
7t7mF4zCif13GMTtGEtE5RQSTufyDg8nuI/i2cuhsFkdFNzviTUD2ch13uNyljzQ
lIsURJZAMtW4gU3WMhmI3hoXuIrlplvAroKZgruP449C7v5qR6PS21ywZdXHuRew
JC9KTylWh3neIk8Dzdj87ti15UuMOWQeGbllEJc93lPj1n3OLcKkeNjgPJ+5InOg
jWgVGx8gBTKMdayShk22U8EpxgpqvqRHDVXbGQsl8NdCS+ucR+014BpD1UI4B+ly
rv7VsNCay0/vye+xxl9oj23ftGeiXupQKFNv1jiFgxHGxm5X60c4nqg67P70MUGO
MuesnFDvqX6gySi/LCWgZ0AHNCVeJAgZUJ0TufVn7lgAYA6JpGsmsZw5ifTjgdOP
h6B8r7H45UkM+SLP9t7KzNMWIJy9HB7bdacqeFiQw7vgD8yuz/FynQDnY55bNgMM
XnStazcSkpfR+lYFQ0xIkK+6X9XCxfJZzAiGpxNVBIiEf+iRObnaBL3uqfXbsLMc
RA9+oHzFvLYqT4DBc1gmPpijSJ9GnGesTVtKaCFDZRnk8/JJvQXnog/egbUBb9VD
iG2NbUN3dCiJxQCeaSaIdTBoiNjyZQqoZ+JTjSY0cpGVz7o1SqHnVw45XqfCpdH/
Dw0sUQwHDMC5n2+X
=/VUR
-----END PGP SIGNATURE-----

M
M
muradm wrote on 11 Aug 2021 21:12
Re: [bug#49969] [PATCH v2 1/7] gnu: crates-io: Add rust-enquote 1.0.3
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 49969@debbugs.gnu.org)
87pmuj6bj4.fsf@muradm.net
Noted for next update, thanks

Xinglu Chen <public@yoctocell.xyz> writes:

Toggle quote (56 lines)
> On Tue, Aug 10 2021, muradm wrote:
>
>> * gnu/packages/crates-io.scm (rust-enquote-1): Add rust-enquote
>> 1.0.3
>> ---
>> gnu/packages/crates-io.scm | 22 ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/gnu/packages/crates-io.scm
>> b/gnu/packages/crates-io.scm
>> index 24cc772ba7..b458080ca7 100644
>> --- a/gnu/packages/crates-io.scm
>> +++ b/gnu/packages/crates-io.scm
>> @@ -18,6 +18,7 @@
>> ;;; Copyright © 2021 Antero Mejr <antero@kodmin.com>
>> ;;; Copyright © 2021 Maxim Cournoyer
>> <maxim.cournoyer@gmail.com>
>> ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
>> +;;; Copyright © 2021 muradm <mail@muradm.net>
>> ;;;
>> ;;; This file is part of GNU Guix.
>> ;;;
>> @@ -56972,3 +56973,24 @@ 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
>> + "This Rust library quotes, unquotes, and unescapes
>> strings.")
>
> The synopsis should not end with a period. “This” doesn’t
> really bring
> anything, maybe something like
>
> Rust library that quotes, unquotes, and unescapes strings
>
> See “16.4.4 Synopses and Descriptions” in the manual for more
> details.
M
M
muradm wrote on 11 Aug 2021 21:12
Re: [bug#49969] [PATCH v2 2/7] gnu: crates-io: Add rust-pam-sys 0.5.6
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 49969@debbugs.gnu.org)
87mtpn6bii.fsf@muradm.net
Noted for next update, thanks

Xinglu Chen <public@yoctocell.xyz> writes:

Toggle quote (61 lines)
> On Tue, Aug 10 2021, muradm wrote:
>
>> * gnu/packages/crates-io.scm (rust-pam-sys): Add rust-pam-sys
>> 0.5.6
>> ---
>> gnu/packages/crates-io.scm | 27 +++++++++++++++++++++++++++
>> 1 file changed, 27 insertions(+)
>>
>> diff --git a/gnu/packages/crates-io.scm
>> b/gnu/packages/crates-io.scm
>> index b458080ca7..b365a2c8c0 100644
>> --- a/gnu/packages/crates-io.scm
>> +++ b/gnu/packages/crates-io.scm
>> @@ -56,6 +56,7 @@
>> #:use-module (gnu packages image)
>> #:use-module (gnu packages jemalloc)
>> #:use-module (gnu packages llvm)
>> + #:use-module (gnu packages linux)
>> #:use-module (gnu packages multiprecision)
>> #:use-module (gnu packages nettle)
>> #:use-module (gnu packages pcre)
>> @@ -56994,3 +56995,29 @@ variant of this library is available
>> separately as @code{im}.")
>> (description
>> "This Rust library quotes, unquotes, and unescapes
>> strings.")
>> (license license:unlicense)))
>> +
>> +(define-public rust-pam-sys-0.5.6
>> + (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).")
>
> The synopsis should not end with a period.
>
>> + (description
>> + "Rust FFI wrappers for the Linux Pluggable Authentication
>> Modules (PAM).")
>
> The description should contain one or more complete sentences,
> see
> “16.4.4 Synopses and Descriptions” in the manual.
M
M
muradm wrote on 11 Aug 2021 22:10
Re: [bug#49969] [PATCH v2 3/7] gnu: freedesktop: Add greetd 0.7.0
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 49969@debbugs.gnu.org)
87k0kr68u7.fsf@muradm.net
Xinglu Chen <public@yoctocell.xyz> writes:

Toggle quote (108 lines)
> On Tue, Aug 10 2021, muradm wrote:
>
>> * gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
>> ---
>> gnu/packages/freedesktop.scm | 80
>> ++++++++++++++++++++++++++++++++++++
>> 1 file changed, 80 insertions(+)
>>
>> diff --git a/gnu/packages/freedesktop.scm
>> b/gnu/packages/freedesktop.scm
>> index 693a79c738..631d36e765 100644
>> --- a/gnu/packages/freedesktop.scm
>> +++ b/gnu/packages/freedesktop.scm
>> @@ -24,6 +24,7 @@
>> ;;; Copyright © 2020 Raghav Gururajan
>> <raghavgururajan@disroot.org>
>> ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
>> ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
>> +;;; Copyright © 2021 muradm <mail@muradm.net>
>> ;;;
>> ;;; This file is part of GNU Guix.
>> ;;;
>> @@ -46,6 +47,7 @@
>> #:use-module (guix packages)
>> #:use-module (guix download)
>> #:use-module (guix git-download)
>> + #:use-module (guix build-system cargo)
>> #:use-module (guix build-system cmake)
>> #:use-module (guix build-system gnu)
>> #:use-module (guix build-system meson)
>> @@ -62,6 +64,7 @@
>> #:use-module (gnu packages check)
>> #:use-module (gnu packages cmake)
>> #:use-module (gnu packages compression)
>> + #:use-module (gnu packages crates-io)
>> #:use-module (gnu packages cryptsetup)
>> #:use-module (gnu packages databases)
>> #:use-module (gnu packages disk)
>> @@ -862,6 +865,83 @@ 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 greetd
>> + (package
>> + (name "greetd")
>> + (version "0.7.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
>> "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
>> + (build-system cargo-build-system)
>> + (arguments
>> + `(#:cargo-inputs
>> + (("rust-nix" ,rust-nix-0.17)
>> + ("rust-pam-sys" ,rust-pam-sys-0.5.6)
>> + ("rust-rpassword" ,rust-rpassword-4)
>> + ("rust-users" ,rust-users-0.9)
>> + ("rust-serde" ,rust-serde-1)
>> + ("rust-serde-json" ,rust-serde-json-1)
>> + ("rust-libc" ,rust-libc-0.2)
>> + ("rust-tokio" ,rust-tokio-0.2)
>> + ("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
>> + ;; once https://todo.sr.ht/~kennylevinsen/greetd/25
>> + ;; is solved, below patch can be removed
>> + (add-after 'unpack 'patch-terminal-switch
>> + (lambda* (#:key inputs #:allow-other-keys)
>> + (substitute* "greetd/src/server.rs"
>> + (("switch: true,")
>> + "switch: false,"))))
>> + (delete 'package)
>> + (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)
>> + (mkdir-p man1)
>> + (mkdir-p man5)
>> + (mkdir-p man7)
>
> No need to ‘mkdir-p’ if you will call ‘install-file’ on the
> directory.
>

Didn't work for me, without it I get:
In procedure copy-file: No such file or directory

Toggle quote (16 lines)
>> + (with-directory-excursion "man"
>> + (system "scdoc < greetd-1.scd > greetd.1")
>> + (system "scdoc < greetd-5.scd > greetd.5")
>> + (system "scdoc < greetd-ipc-7.scd >
>> greetd-ipc.7")
>> + (system "scdoc < agreety-1.scd > agreety.1"))
>> + (install-file "man/greetd.1" man1)
>> + (install-file "man/greetd.5" man5)
>> + (install-file "man/greetd-ipc.7" man7)
>> + (install-file "man/agreety.1" man1)
>
> Why not put these four lines inside the
> (with-directory-excursion "man"
> …) form, and remove the "man" prefix?
>

Refactored, scdoc moved to 'build-man-pages after 'build, install
minimized

(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))))))))

Noted for next update, thanks

Toggle quote (7 lines)
>> + #t))))))
>
> Phases don’t need to return #t once the ‘core-updates’ branch
> gets
> merged.
>

Left over, i was using this to fail package build, noted for next
update, thanks

Toggle quote (12 lines)
>> + (native-inputs
>> + `(("linux-pam" ,linux-pam)
>> + ("scdoc" ,scdoc)))
>> + (synopsis
>> + "greetd is a minimal and flexible login manager daemon
>> +that makes no assumptions about what you want to launch.")
>
> The synosis is a bit long, maybe
>
> Minimal and flexible login manager daemon
>

Noted for next update, thanks

Toggle quote (8 lines)
>> + (description
>> + "greetd is a minimal and flexible login manager daemon
>> +that makes no assumptions about what you want to launch.")
>
> “what you want to launch” sounds a bit vague, is it referring to
> desktop
> environment, window manager, or something else?

As description says anything, it is from official documentation.
Launches any thing,
could be DE, WM, Emacs, top etc. literally any thing :)
M
M
muradm wrote on 11 Aug 2021 22:15
Re: [bug#49969] [PATCH v2 4/7] gnu: admin: Add greetd-pam-mount
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 49969@debbugs.gnu.org)
87h7fv68lw.fsf@muradm.net
Noted for next update, thanks

Xinglu Chen <public@yoctocell.xyz> writes:

Toggle quote (62 lines)
> On Tue, Aug 10 2021, muradm wrote:
>
>> 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.
>
> It might be a good idea to put this in a comment in the code
> too. :-)
>
>> * gnu/packages/admin.scm (greetd-pam-mount): Add
>> greetd-pam-mount
>> ---
>> gnu/packages/admin.scm | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>>
>> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
>> index eda269f148..e805b219c5 100644
>> --- a/gnu/packages/admin.scm
>> +++ b/gnu/packages/admin.scm
>> @@ -42,6 +42,7 @@
>> ;;; Copyright © 2021 David Larsson
>> <david.larsson@selfhosted.xyz>
>> ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
>> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
>> +;;; Copyright © 2021 muradm <mail@muradm.net>
>> ;;;
>> ;;; This file is part of GNU Guix.
>> ;;;
>> @@ -4247,6 +4248,25 @@ supports. It can also mount encrypted
>> LUKS volumes using the password
>> supplied by the user when logging in.")
>> (license (list license:gpl2+ license:lgpl2.1+))))
>>
>> +(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")))
>
> The description should also be updated.
M
M
muradm wrote on 11 Aug 2021 22:31
Re: [bug#49969] [PATCH v2 5/7] gnu: desktop: Add seatd-service-type
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 49969@debbugs.gnu.org)
87eeaz67v3.fsf@muradm.net
Noted for next update, thanks

Xinglu Chen <public@yoctocell.xyz> writes:

Toggle quote (117 lines)
> On Tue, Aug 10 2021, muradm wrote:
>
>> A seat management daemon, that does everything it needs to do.
>> Nothing more, nothing less. Depends only on libc.
>
> I don’t it is necessary to put this in the commit log.
>
>> * gnu/services/desktop.scm: Add seatd-service-type
>> ---
>> gnu/services/desktop.scm | 59
>> +++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 58 insertions(+), 1 deletion(-)
>>
>> diff --git a/gnu/services/desktop.scm
>> b/gnu/services/desktop.scm
>> index 64d0e85301..bfba9bccec 100644
>> --- a/gnu/services/desktop.scm
>> +++ b/gnu/services/desktop.scm
>> @@ -13,6 +13,7 @@
>> ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
>> ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
>> ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
>> +;;; Copyright © 2021 muradm <mail@muradm.net>
>> ;;;
>> ;;; 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,57 @@ 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> 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/socket"))
>> + (loglevel seatd-loglevel (default "error")))
>> +
>> +(define (seatd-shepherd-service config)
>> + (list (shepherd-service
>> + (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)))))
>
> ‘documentation’ field is missing.
>
>> +
>> +(define seatd-environment
>> + (match-lambda
>> + (($ <seatd-configuration> _ _ _ socket)
>> + `(("SEATD_SOCK" . ,socket)))))
>> +
>> +(define seatd-service-type
>> + (service-type
>> + (name 'seatd)
>> + (extensions
>> + (list
>> + (service-extension session-environment-service-type
>> + seatd-environment)
>> + ;; TODO: once cgroups is separate dependency
>> + ;; we should not mount it here
>> + (service-extension file-system-service-type
>> + (const %control-groups))
>> + (service-extension shepherd-root-service-type
>> + seatd-shepherd-service)))
>> + (default-value (seatd-configuration))))
>
> Missing ‘description’ field.
>
> It might also be a good idea to write a system test for the
> service, you
> can look at the (gnu tests …) modules for examples.
>
> I am not familiar with how seatd works, so I can’t really
> comment too
> much. :-)
X
X
Xinglu Chen wrote on 12 Aug 2021 13:45
Re: [bug#49969] [PATCH v2 3/7] gnu: freedesktop: Add greetd 0.7.0
(name . muradm)(address . mail@muradm.net)(address . 49969@debbugs.gnu.org)
8735rej38q.fsf@yoctocell.xyz
On Wed, Aug 11 2021, muradm wrote:

Toggle quote (113 lines)
> Xinglu Chen <public@yoctocell.xyz> writes:
>
>> On Tue, Aug 10 2021, muradm wrote:
>>
>>> * gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
>>> ---
>>> gnu/packages/freedesktop.scm | 80
>>> ++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 80 insertions(+)
>>>
>>> diff --git a/gnu/packages/freedesktop.scm
>>> b/gnu/packages/freedesktop.scm
>>> index 693a79c738..631d36e765 100644
>>> --- a/gnu/packages/freedesktop.scm
>>> +++ b/gnu/packages/freedesktop.scm
>>> @@ -24,6 +24,7 @@
>>> ;;; Copyright © 2020 Raghav Gururajan
>>> <raghavgururajan@disroot.org>
>>> ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
>>> ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
>>> +;;; Copyright © 2021 muradm <mail@muradm.net>
>>> ;;;
>>> ;;; This file is part of GNU Guix.
>>> ;;;
>>> @@ -46,6 +47,7 @@
>>> #:use-module (guix packages)
>>> #:use-module (guix download)
>>> #:use-module (guix git-download)
>>> + #:use-module (guix build-system cargo)
>>> #:use-module (guix build-system cmake)
>>> #:use-module (guix build-system gnu)
>>> #:use-module (guix build-system meson)
>>> @@ -62,6 +64,7 @@
>>> #:use-module (gnu packages check)
>>> #:use-module (gnu packages cmake)
>>> #:use-module (gnu packages compression)
>>> + #:use-module (gnu packages crates-io)
>>> #:use-module (gnu packages cryptsetup)
>>> #:use-module (gnu packages databases)
>>> #:use-module (gnu packages disk)
>>> @@ -862,6 +865,83 @@ 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 greetd
>>> + (package
>>> + (name "greetd")
>>> + (version "0.7.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
>>> "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
>>> + (build-system cargo-build-system)
>>> + (arguments
>>> + `(#:cargo-inputs
>>> + (("rust-nix" ,rust-nix-0.17)
>>> + ("rust-pam-sys" ,rust-pam-sys-0.5.6)
>>> + ("rust-rpassword" ,rust-rpassword-4)
>>> + ("rust-users" ,rust-users-0.9)
>>> + ("rust-serde" ,rust-serde-1)
>>> + ("rust-serde-json" ,rust-serde-json-1)
>>> + ("rust-libc" ,rust-libc-0.2)
>>> + ("rust-tokio" ,rust-tokio-0.2)
>>> + ("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
>>> + ;; once https://todo.sr.ht/~kennylevinsen/greetd/25
>>> + ;; is solved, below patch can be removed
>>> + (add-after 'unpack 'patch-terminal-switch
>>> + (lambda* (#:key inputs #:allow-other-keys)
>>> + (substitute* "greetd/src/server.rs"
>>> + (("switch: true,")
>>> + "switch: false,"))))
>>> + (delete 'package)
>>> + (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)
>>> + (mkdir-p man1)
>>> + (mkdir-p man5)
>>> + (mkdir-p man7)
>>
>> No need to ‘mkdir-p’ if you will call ‘install-file’ on the
>> directory.
>>
>
> Didn't work for me, without it I get:
> In procedure copy-file: No such file or directory

Hmm, weird, the docs for ‘install-file’ says

-- Scheme Procedure: install-file FILE DIRECTORY
Create DIRECTORY if it does not exist and copy FILE in there under
the same name.

Toggle quote (54 lines)
>>> + (with-directory-excursion "man"
>>> + (system "scdoc < greetd-1.scd > greetd.1")
>>> + (system "scdoc < greetd-5.scd > greetd.5")
>>> + (system "scdoc < greetd-ipc-7.scd >
>>> greetd-ipc.7")
>>> + (system "scdoc < agreety-1.scd > agreety.1"))
>>> + (install-file "man/greetd.1" man1)
>>> + (install-file "man/greetd.5" man5)
>>> + (install-file "man/greetd-ipc.7" man7)
>>> + (install-file "man/agreety.1" man1)
>>
>> Why not put these four lines inside the
>> (with-directory-excursion "man"
>> …) form, and remove the "man" prefix?
>>
>
> Refactored, scdoc moved to 'build-man-pages after 'build, install
> minimized
>
> (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))))))))
>
> Noted for next update, thanks

The phases LGTM!

Toggle quote (12 lines)
>>> + (description
>>> + "greetd is a minimal and flexible login manager daemon
>>> +that makes no assumptions about what you want to launch.")
>>
>> “what you want to launch” sounds a bit vague, is it referring to
>> desktop
>> environment, window manager, or something else?
>
> As description says anything, it is from official documentation.
> Launches any thing,
> could be DE, WM, Emacs, top etc. literally any thing :)

Ah, OK, then maybe “what program” instead of just “what”? Someone might
try to launch a missile with it ;-)
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmEVCdUVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5T8gP/2WB5hJuPYczu+Svb8oiRP44rUfZ
EdCjnAlz52c80pU2ljB/gS+lr0s5bZrgzgA9DFVUP+4OpPqH4b4+CY5FqzcciXEK
cDT8uGQVuZWvoOH5jUm2gLx9tmf+TptGZrTxJkuJzuMBAg1mi8wgFYPoiEH8S3Qt
YkdxSr3bTPOk/hMgo0yL4SWiqzDlqN3btldNPbimWWT8/tNFowsKySUN96KXH5bl
L+q7JLbNsd7LzWrB95m/CXXG6L+D9dlmhQby5vlbrQeMDOFHbqfSRr2mrD00AcKP
SNHcZ/8RKLOrklBOq1wFcPQQhLZ/F5rh+WPM6CQm+Xz+NxxHAenPA+z7BihvlS/Q
ipde6EOfE6xd6p07vurAzGbhCgBpC+YpmUgTT5E5AQ6f/kWBeeXHue7zyOAqRdap
bEmIUcoEa40voKQLbQ8o/pFBgRzWfvsoM6OUnM+Nn6OCL5uY8FkYCchpBI/D34SG
r62sqgCjVg/tzVvzmtoFg5Su4S42j2+zIgV4qGdnUwpaXmfU/JzmaXm/+KLMTFs8
Q6GncMLdGXeh38jXzu7t0BqVg1p2qJ3kWwajuhUeGyLmbfWiTZt0J29l+14C4vYb
V0e1woHuCIcpbzfpy3tm5GCotct2ut2ufayrDqXzgxZh7XyR1Ao/8EX/e4anCT0s
g5+FfpBxyAvvTpFe
=FG85
-----END PGP SIGNATURE-----

M
M
muradm wrote on 12 Aug 2021 21:51
(name . Xinglu Chen)(address . public@yoctocell.xyz)(address . 49969@debbugs.gnu.org)
87bl62qw4k.fsf@muradm.net
Xinglu Chen <public@yoctocell.xyz> writes:

Toggle quote (125 lines)
> On Wed, Aug 11 2021, muradm wrote:
>
>> Xinglu Chen <public@yoctocell.xyz> writes:
>>
>>> On Tue, Aug 10 2021, muradm wrote:
>>>
>>>> * gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
>>>> ---
>>>> gnu/packages/freedesktop.scm | 80
>>>> ++++++++++++++++++++++++++++++++++++
>>>> 1 file changed, 80 insertions(+)
>>>>
>>>> diff --git a/gnu/packages/freedesktop.scm
>>>> b/gnu/packages/freedesktop.scm
>>>> index 693a79c738..631d36e765 100644
>>>> --- a/gnu/packages/freedesktop.scm
>>>> +++ b/gnu/packages/freedesktop.scm
>>>> @@ -24,6 +24,7 @@
>>>> ;;; Copyright © 2020 Raghav Gururajan
>>>> <raghavgururajan@disroot.org>
>>>> ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
>>>> ;;; Copyright © 2021 pineapples
>>>> <guixuser6392@protonmail.com>
>>>> +;;; Copyright © 2021 muradm <mail@muradm.net>
>>>> ;;;
>>>> ;;; This file is part of GNU Guix.
>>>> ;;;
>>>> @@ -46,6 +47,7 @@
>>>> #:use-module (guix packages)
>>>> #:use-module (guix download)
>>>> #:use-module (guix git-download)
>>>> + #:use-module (guix build-system cargo)
>>>> #:use-module (guix build-system cmake)
>>>> #:use-module (guix build-system gnu)
>>>> #:use-module (guix build-system meson)
>>>> @@ -62,6 +64,7 @@
>>>> #:use-module (gnu packages check)
>>>> #:use-module (gnu packages cmake)
>>>> #:use-module (gnu packages compression)
>>>> + #:use-module (gnu packages crates-io)
>>>> #:use-module (gnu packages cryptsetup)
>>>> #:use-module (gnu packages databases)
>>>> #:use-module (gnu packages disk)
>>>> @@ -862,6 +865,83 @@ 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 greetd
>>>> + (package
>>>> + (name "greetd")
>>>> + (version "0.7.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
>>>> "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
>>>> + (build-system cargo-build-system)
>>>> + (arguments
>>>> + `(#:cargo-inputs
>>>> + (("rust-nix" ,rust-nix-0.17)
>>>> + ("rust-pam-sys" ,rust-pam-sys-0.5.6)
>>>> + ("rust-rpassword" ,rust-rpassword-4)
>>>> + ("rust-users" ,rust-users-0.9)
>>>> + ("rust-serde" ,rust-serde-1)
>>>> + ("rust-serde-json" ,rust-serde-json-1)
>>>> + ("rust-libc" ,rust-libc-0.2)
>>>> + ("rust-tokio" ,rust-tokio-0.2)
>>>> + ("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
>>>> + ;; once https://todo.sr.ht/~kennylevinsen/greetd/25
>>>> + ;; is solved, below patch can be removed
>>>> + (add-after 'unpack 'patch-terminal-switch
>>>> + (lambda* (#:key inputs #:allow-other-keys)
>>>> + (substitute* "greetd/src/server.rs"
>>>> + (("switch: true,")
>>>> + "switch: false,"))))
>>>> + (delete 'package)
>>>> + (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)
>>>> + (mkdir-p man1)
>>>> + (mkdir-p man5)
>>>> + (mkdir-p man7)
>>>
>>> No need to ‘mkdir-p’ if you will call ‘install-file’ on the
>>> directory.
>>>
>>
>> Didn't work for me, without it I get:
>> In procedure copy-file: No such file or directory
>
> Hmm, weird, the docs for ‘install-file’ says
>
> -- Scheme Procedure: install-file FILE DIRECTORY
> Create DIRECTORY if it does not exist and copy FILE in
> there under
> the same name.
>

Yeah, you are right, there was wrong excursions when i tested,
now works as expected, i think i just forgot to delete this
comment,
thanks.

Toggle quote (77 lines)
>>>> + (with-directory-excursion "man"
>>>> + (system "scdoc < greetd-1.scd > greetd.1")
>>>> + (system "scdoc < greetd-5.scd > greetd.5")
>>>> + (system "scdoc < greetd-ipc-7.scd >
>>>> greetd-ipc.7")
>>>> + (system "scdoc < agreety-1.scd >
>>>> agreety.1"))
>>>> + (install-file "man/greetd.1" man1)
>>>> + (install-file "man/greetd.5" man5)
>>>> + (install-file "man/greetd-ipc.7" man7)
>>>> + (install-file "man/agreety.1" man1)
>>>
>>> Why not put these four lines inside the
>>> (with-directory-excursion "man"
>>> …) form, and remove the "man" prefix?
>>>
>>
>> Refactored, scdoc moved to 'build-man-pages after 'build,
>> install
>> minimized
>>
>> (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))))))))
>>
>> Noted for next update, thanks
>
> The phases LGTM!
>
>>>> + (description
>>>> + "greetd is a minimal and flexible login manager daemon
>>>> +that makes no assumptions about what you want to launch.")
>>>
>>> “what you want to launch” sounds a bit vague, is it referring
>>> to
>>> desktop
>>> environment, window manager, or something else?
>>
>> As description says anything, it is from official
>> documentation.
>> Launches any thing,
>> could be DE, WM, Emacs, top etc. literally any thing :)
>
> Ah, OK, then maybe “what program” instead of just “what”?
> Someone might
> try to launch a missile with it ;-)

/gnu/store/....-missiles-1.01/bin/launch why not? :D

in next update, i will try to put some more sentences from greetd
description, it might be more useful may be.
M
M
muradm wrote on 12 Aug 2021 23:55
[PATCH 00/10] gnu: desktop: Add seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210812215557.23835-1-mail@muradm.net
This patch series introduces two new services;

- seatd-service-type: simple seat management daemon
- greetd-service-type: simple login daemon

Both services are very minimalistic in nature. Simple seatd daemon
could be said as replacement for elogind-service-type. greetd daemon
is simple replacement for mingetty.

In addition to the base services, special build of pam-mount module is
included as greetd-pam-mount. It is used to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR. Special build is
required to avoid interference with default pam-mount, if used in
the system.

greetd provides agreety terminal greeter out of the box. Current
greetd-service-type includes configuration for greetd-agreety-session
variations, i.e. only terminal are supported at the moment.

Next step would be adding gtkgreet and/or wlgreet alternatives for
graphical greeter.

muradm (10):
gnu: crates-io: Add rust-enquote 1.0.3
gnu: crates-io: Add rust-pam-sys 0.5.6
gnu: freedesktop: Add greetd 0.7.0
gnu: admin: Add greetd-pam-mount
gnu: desktop: Add seatd-service-type
gnu: desktop: Add greetd-service-type
gnu: base: Add greetd to applied PAM services
gnu: pam-mount: Add greetd to applied PAM services
gnu: tests: Add seatd/greetd based minimal desktop system tests
doc: Add desktop seatd-service-type and greetd-service-type

doc/guix.texi | 183 ++++++++++++++++++++++
gnu/packages/admin.scm | 33 ++++
gnu/packages/crates-io.scm | 49 ++++++
gnu/packages/freedesktop.scm | 86 +++++++++++
gnu/services/base.scm | 3 +-
gnu/services/desktop.scm | 285 ++++++++++++++++++++++++++++++++++-
gnu/services/pam-mount.scm | 3 +-
gnu/tests/desktop.scm | 191 ++++++++++++++++++++++-
8 files changed, 829 insertions(+), 4 deletions(-)

--
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:00
(address . 49969@debbugs.gnu.org)
20210812220022.24025-1-mail@muradm.net
This patch series introduces two new services;

- seatd-service-type: simple seat management daemon
- greetd-service-type: simple login daemon

Both services are very minimalistic in nature. Simple seatd daemon
could be said as replacement for elogind-service-type. greetd daemon
is simple replacement for mingetty.

In addition to the base services, special build of pam-mount module is
included as greetd-pam-mount. It is used to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR. Special build is
required to avoid interference with default pam-mount, if used in
the system.

greetd provides agreety terminal greeter out of the box. Current
greetd-service-type includes configuration for greetd-agreety-session
variations, i.e. only terminal are supported at the moment.

Next step would be adding gtkgreet and/or wlgreet alternatives for
graphical greeter.

muradm (10):
gnu: crates-io: Add rust-enquote 1.0.3
gnu: crates-io: Add rust-pam-sys 0.5.6
gnu: freedesktop: Add greetd 0.7.0
gnu: admin: Add greetd-pam-mount
gnu: desktop: Add seatd-service-type
gnu: desktop: Add greetd-service-type
gnu: base: Add greetd to applied PAM services
gnu: pam-mount: Add greetd to applied PAM services
gnu: tests: Add seatd/greetd based minimal desktop system tests
doc: Add desktop seatd-service-type and greetd-service-type

doc/guix.texi | 183 ++++++++++++++++++++++
gnu/packages/admin.scm | 33 ++++
gnu/packages/crates-io.scm | 49 ++++++
gnu/packages/freedesktop.scm | 86 +++++++++++
gnu/services/base.scm | 3 +-
gnu/services/desktop.scm | 285 ++++++++++++++++++++++++++++++++++-
gnu/services/pam-mount.scm | 3 +-
gnu/tests/desktop.scm | 191 ++++++++++++++++++++++-
8 files changed, 829 insertions(+), 4 deletions(-)

--
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 01/10] gnu: crates-io: Add rust-enquote 1.0.3
(address . 49969@debbugs.gnu.org)
20210812220420.24118-2-mail@muradm.net
* gnu/packages/crates-io.scm (rust-enquote-1): Add rust-enquote 1.0.3
---
gnu/packages/crates-io.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 24cc772ba7..6484d4c4fc 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Antero Mejr <antero@kodmin.com>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56972,3 +56973,24 @@ 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)))
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 02/10] gnu: crates-io: Add rust-pam-sys 0.5.6
(address . 49969@debbugs.gnu.org)
20210812220420.24118-3-mail@muradm.net
* gnu/packages/crates-io.scm (rust-pam-sys): Add rust-pam-sys 0.5.6
---
gnu/packages/crates-io.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 6484d4c4fc..d91417d76f 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -55,6 +55,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)
@@ -56994,3 +56995,29 @@ variant of this library is available separately as @code{im}.")
     (description
      "A Rust library quotes, unquotes, and unescapes strings")
     (license license:unlicense)))
+
+(define-public rust-pam-sys-0.5.6
+  (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))))
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 00/10] gnu: desktop: Add seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210812220420.24118-1-mail@muradm.net
This patch series introduces two new services;

- seatd-service-type: simple seat management daemon
- greetd-service-type: simple login daemon

Both services are very minimalistic in nature. Simple seatd daemon
could be said as replacement for elogind-service-type. greetd daemon
is simple replacement for mingetty.

In addition to the base services, special build of pam-mount module is
included as greetd-pam-mount. It is used to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR. Special build is
required to avoid interference with default pam-mount, if used in
the system.

greetd provides agreety terminal greeter out of the box. Current
greetd-service-type includes configuration for greetd-agreety-session
variations, i.e. only terminal are supported at the moment.

Next step would be adding gtkgreet and/or wlgreet alternatives for
graphical greeter.

muradm (10):
gnu: crates-io: Add rust-enquote 1.0.3
gnu: crates-io: Add rust-pam-sys 0.5.6
gnu: freedesktop: Add greetd 0.7.0
gnu: admin: Add greetd-pam-mount
gnu: desktop: Add seatd-service-type
gnu: desktop: Add greetd-service-type
gnu: base: Add greetd to applied PAM services
gnu: pam-mount: Add greetd to applied PAM services
gnu: tests: Add seatd/greetd based minimal desktop system tests
doc: Add desktop seatd-service-type and greetd-service-type

doc/guix.texi | 183 ++++++++++++++++++++++
gnu/packages/admin.scm | 33 ++++
gnu/packages/crates-io.scm | 49 ++++++
gnu/packages/freedesktop.scm | 86 +++++++++++
gnu/services/base.scm | 3 +-
gnu/services/desktop.scm | 285 ++++++++++++++++++++++++++++++++++-
gnu/services/pam-mount.scm | 3 +-
gnu/tests/desktop.scm | 191 ++++++++++++++++++++++-
8 files changed, 829 insertions(+), 4 deletions(-)

--
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH 03/10] gnu: freedesktop: Add greetd 0.7.0
(address . 49969@debbugs.gnu.org)
20210812220420.24118-4-mail@muradm.net
* gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
---
gnu/packages/freedesktop.scm | 86 ++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)

Toggle diff (120 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 693a79c738..0be7d0fe4d 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -62,6 +64,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages disk)
@@ -862,6 +865,89 @@ 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 greetd
+  (package
+    (name "greetd")
+    (version "0.7.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 "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-nix" ,rust-nix-0.17)
+        ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+        ("rust-rpassword" ,rust-rpassword-4)
+        ("rust-users" ,rust-users-0.9)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-tokio" ,rust-tokio-0.2)
+        ("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
+         ;; once https://todo.sr.ht/~kennylevinsen/greetd/25
+         ;; is solved, below patch can be removed
+         (add-after 'unpack 'patch-terminal-switch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "greetd/src/server.rs"
+               (("switch: true,")
+                "switch: false,"))))
+         (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+)))
+
 (define-public packagekit
   (package
     (name "packagekit")
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 04/10] gnu: admin: Add greetd-pam-mount
(address . 49969@debbugs.gnu.org)
20210812220420.24118-5-mail@muradm.net
* gnu/packages/admin.scm (greetd-pam-mount): Add greetd-pam-mount
---
gnu/packages/admin.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

Toggle diff (53 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index eda269f148..e5ed1785d8 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -42,6 +42,7 @@
 ;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
 ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4247,6 +4248,38 @@ supports.  It can also mount encrypted LUKS volumes using the password
 supplied by the user when logging in.")
     (license (list license:gpl2+ license:lgpl2.1+))))
 
+(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.")))
+
 (define-public jc
   (package
     (name "jc")
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 05/10] gnu: desktop: Add seatd-service-type
(address . 49969@debbugs.gnu.org)
20210812220420.24118-6-mail@muradm.net
* gnu/services/desktop.scm: Add seatd-service-type
---
gnu/services/desktop.scm | 60 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)

Toggle diff (94 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 64d0e85301..a63a2936a7 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; 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> 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
+    (($ <seatd-configuration> _ _ _ 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
+     (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.
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 07/10] gnu: base: Add greetd to applied PAM services
(address . 49969@debbugs.gnu.org)
20210812220420.24118-8-mail@muradm.net
* gnu/services/base.scm (pam-limits-service-type): add greetd PAM
service to applicable PAM services
---
gnu/services/base.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (23 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index c784d312b1..446ecc30f8 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2021 qblade <qblade@protonmail.com>
 ;;; Copyright © 2021 Hui Lu <luhuins@163.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1392,7 +1393,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
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 08/10] gnu: pam-mount: Add greetd to applied PAM services
(address . 49969@debbugs.gnu.org)
20210812220420.24118-9-mail@muradm.net
* gnu/services/pam-mount.scm (pam-mount-service-type): add greetd PAM
service to applicable PAM services
---
gnu/services/pam-mount.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (22 lines)
diff --git a/gnu/services/pam-mount.scm b/gnu/services/pam-mount.scm
index 98611462c2..7b25efeb50 100644
--- a/gnu/services/pam-mount.scm
+++ b/gnu/services/pam-mount.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -90,7 +91,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)
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 09/10] gnu: tests: Add seatd/greetd based minimal desktop system tests
(address . 49969@debbugs.gnu.org)
20210812220420.24118-10-mail@muradm.net
* gnu/tests/desktop.scm (minimal-desktop): seatd/greetd based minimal desktop
---
gnu/tests/desktop.scm | 191 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 190 insertions(+), 1 deletion(-)

Toggle diff (219 lines)
diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm
index 6aa22fd49b..c57c4a4462 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 <ludo@gnu.org>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,12 +20,15 @@
 (define-module (gnu tests desktop)
   #:use-module (gnu tests)
   #: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 +107,188 @@
                #:imported-modules '((gnu services herd)
                                     (guix combinators)))))
       (run-elogind-test (virtual-machine os))))))
+
+
+;;;
+;;; Seatd/greetd based minimal desktop
+;;;
+
+(define %minimal-services
+  (append
+   (list
+    (service seatd-service-type)
+    (service greetd-service-type
+             (greetd-configuration
+              (terminals
+               (list
+                (greetd-terminal-configuration (terminal-vt "1"))
+                (greetd-terminal-configuration (terminal-vt "2"))
+                (greetd-terminal-configuration (terminal-vt "3"))
+                (greetd-terminal-configuration (terminal-vt "4"))
+                (greetd-terminal-configuration (terminal-vt "5"))
+                (greetd-terminal-configuration (terminal-vt "6")))))))
+   (modify-services %base-services
+     (delete login-service-type)
+     (delete mingetty-service-type))))
+
+(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"
+                "\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<?)))
+
+          (test-assert "validate SEATD_SOCK and GREETD_SOCK"
+            (begin
+              (marionette-type "env > 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/<uid> 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))))))
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 10/10] doc: Add desktop seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210812220420.24118-11-mail@muradm.net
* doc/guix.texi (Desktop Services): Provide documentation for
seatd-service-type and greetd-service-type including configuration
and sample usage.
---
doc/guix.texi | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 183 insertions(+)

Toggle diff (203 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 78c1c09858..1e5838ce32 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -94,6 +94,7 @@ Copyright @copyright{} 2021 Xinglu Chen@*
 Copyright @copyright{} 2021 Raghav Gururajan@*
 Copyright @copyright{} 2021 Domagoj Stolfa@*
 Copyright @copyright{} 2021 Hui Lu@*
+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
@@ -19694,6 +19695,188 @@ and ``passwd'' is with the value @code{passwd}.
 @end table
 @end deftp
 
+@defvr {Scheme Variable} seatd-service-type
+A minimal seat management daemon, and a universal seat management library.
+
+Seat management takes care of mediating access to shared devices (graphics,
+input), without requiring the applications needing access to be root.
+
+In general should be used as replacement to @code{elogind-service-type}.
+
+@lisp
+(append
+  (list
+   ;; make sure seatd is running
+   (service seatd-service-type)
+
+   (service greetd-service-type
+            (greetd-configuration
+             (terminals
+              (list
+               ;; lets have terminals 1, 2 and 3 run default XDG terminal session
+               (greetd-terminal-configuration (terminal-vt "1"))
+               (greetd-terminal-configuration (terminal-vt "2"))
+               (greetd-terminal-configuration (terminal-vt "3"))
+               ;; and terminals 4, 5 and 6 plain bash terminal session
+               ;; although not so plain, just to illustrate flexibility
+               (greetd-terminal-configuration
+                (terminal-vt "4")
+                (default-session-command greetd-agreety-tty-session))
+               (greetd-terminal-configuration
+                (terminal-vt "5")
+                (default-session-command greetd-agreety-tty-session))
+               (greetd-terminal-configuration
+                (terminal-vt "6")
+                (default-session-command greetd-agreety-tty-session))))))
+
+  ;; normaly one would want %base-services
+  (modify-services %base-services
+    ;; seatd/greetd combination can replace these
+    ;; greetd provides its own PAM service
+    (delete login-service-type)
+    (delete mingetty-service-type)))
+
+@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
+
+@defvr {Scheme Variable} greetd-service-type
+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.
+
+@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
+
+@end defvr
+
+@deftp {Data Type} greetd-configuration
+Configuration record for the greetd service.
+
+@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{default-session-user} (default: @samp{"greeter"})
+The user to use for running the greeter.
+
+@item @code{default-session-command} (default: @code{greetd-agreety-tty-xdg-session})
+The command-line to run to start the default session.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{greetd-agreety-tty-session} - bash terminal session
+
+@item
+@code{greetd-agreety-tty-xdg-session} - bash terminal session with XDG environment
+
+@item
+@code{greetd-agreety-session} - custom instance of terminal session
+@end itemize
+
+@end table
+@end deftp
+
+@deftp {Data Type} greetd-agreety-session
+Configuration record for the agreety greetd greeter.
+
+@table @asis
+@item @code{package} (default: @code{bash})
+The package of command.
+
+@item @code{command-bin} (default: @samp{"/bin/bash"})
+Path to binary relative to @code{package}.
+
+@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{command-generator}
+Function that receives instance of this configuration as an argument and
+returns @code{program-file} that can be used with @code{agreety} greeter.
+
+Both @code{greetd-agreety-tty-session} and @code{greetd-agreety-tty-xdg-session}
+uses @code{greetd-agreety-session} under the hood.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} greetd-agreety-tty-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login.
+@end defvr
+
+@defvr {Scheme Variable} greetd-agreety-tty-xdg-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login. Additionally, will set @code{XDG_SESSION_TYPE} and
+@code{XDG_RUNTIME_DIR} environment variables for session.
+@end defvr
+
 
 @node Sound Services
 @subsection Sound Services
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 00:04
[PATCH v3 06/10] gnu: desktop: Add greetd-service-type
(address . 49969@debbugs.gnu.org)
20210812220420.24118-7-mail@muradm.net
Currently, only agreety configuration is provided.

* gnu/services/desktop.scm: Add greetd-service-type
---
gnu/services/desktop.scm | 225 +++++++++++++++++++++++++++++++++++++++
1 file changed, 225 insertions(+)

Toggle diff (252 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index a63a2936a7..b7ac08cf20 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -49,6 +49,7 @@
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnome)
@@ -160,6 +161,12 @@
             seatd-configuration
             seatd-service-type
 
+            greetd-configuration
+            greetd-terminal-configuration
+            greetd-service-type
+            greetd-agreety-tty-session
+            greetd-agreety-tty-xdg-session
+
             %desktop-services))
 
 ;;; Commentary:
@@ -1240,6 +1247,224 @@ applications needing access to be root.")
      (service-extension shepherd-root-service-type seatd-shepherd-service)))
    (default-value (seatd-configuration))))
 
+
+;;;
+;;; greetd-service-type -- minimal and flexible login manager daemon
+;;;
+
+(define-record-type* <greetd-agreety-session>
+  greetd-agreety-session make-greetd-agreety-session
+  greetd-agreety-session?
+  (package greetd-agreety-command-package (default bash))
+  (command-bin greetd-agreety-command-bin (default "/bin/bash"))
+  (command-args greetd-agreety-command-args (default '("-l")))
+  (extra-env greetd-agreety-extra-env (default '()))
+  (command-generator greetd-agreety-command-generator))
+
+(define greetd-agreety-tty-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> pkg command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-session-command"
+      #~(begin
+          (use-modules (ice-9 match))
+          (let* ((abs-cmd-bin #$(file-append pkg command-bin)))
+            (for-each
+             (match-lambda ((var . val) (setenv var val)))
+             (quote (#$@extra-env)))
+            (apply execl abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-xdg-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> package command-bin 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))
+               (abs-cmd-bin #$(file-append package command-bin)))
+            (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 abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-session-command)))
+
+(define greetd-agreety-tty-xdg-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-xdg-session-command)))
+
+(define-record-type* <greetd-terminal-configuration>
+  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"))
+  (default-session-user greetd-default-session-user (default "greeter"))
+  (default-session-command greetd-default-session-command
+    (default greetd-agreety-tty-xdg-session)))
+
+(define (default-config-file-name config)
+  (string-join (list "config-" (greetd-terminal-vt config) ".toml") ""))
+
+(define make-greetd-terminal-default-session-command
+  (match-lambda
+    (($ <greetd-terminal-configuration> greetd _ _ _ default-session-command)
+     (cond ((greetd-agreety-session? default-session-command)
+            (let*
+                ((generator (greetd-agreety-command-generator
+                             default-session-command))
+                 (command (apply generator (list default-session-command)))
+                 (agreety-bin (file-append greetd "/bin/agreety")))
+              (program-file
+               "agreety-command"
+               #~(execl #$agreety-bin #$agreety-bin "-c" #$command))))
+           (else (program-file "agreety-command-exit" #~(exit #f)))))))
+
+(define (make-greetd-terminal-configuration-file config)
+  (let*
+      ((config-file-name (greetd-config-file-name config))
+       (terminal-vt (greetd-terminal-vt config))
+       (default-session-user (greetd-default-session-user config))
+       (default-session-command (make-greetd-terminal-default-session-command config)))
+    (mixed-text-file
+     config-file-name
+     "[terminal]\n"
+     "vt = " terminal-vt "\n"
+     "[default_session]\n"
+     "user = " default-session-user "\n"
+     "command = " default-session-command "\n")))
+
+(define %default-motd
+  (plain-file "motd" "This is the GNU operating system, welcome!\n\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>
+  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"))))
+
+  (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/<uid> 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))))
+
 
 ;;;
 ;;; The default set of desktop services.
-- 
2.32.0
M
M
muradm wrote on 13 Aug 2021 22:43
[PATCH v3 03/10] gnu: freedesktop: Add greetd 0.7.0
(address . 49969@debbugs.gnu.org)
20210813204321.2111-1-mail@muradm.net
* gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
---
gnu/packages/freedesktop.scm | 86 ++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)

Toggle diff (120 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 693a79c738..0be7d0fe4d 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -62,6 +64,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages disk)
@@ -862,6 +865,89 @@ 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 greetd
+  (package
+    (name "greetd")
+    (version "0.7.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 "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-nix" ,rust-nix-0.17)
+        ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+        ("rust-rpassword" ,rust-rpassword-4)
+        ("rust-users" ,rust-users-0.9)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-tokio" ,rust-tokio-0.2)
+        ("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
+         ;; once https://todo.sr.ht/~kennylevinsen/greetd/25
+         ;; is solved, below patch can be removed
+         (add-after 'unpack 'patch-terminal-switch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "greetd/src/server.rs"
+               (("switch: true,")
+                "switch: false,"))))
+         (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+)))
+
 (define-public packagekit
   (package
     (name "packagekit")
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:31
[PATCH v4 00/10] gnu: desktop: Add seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210819143133.6398-1-mail@muradm.net
This patch series introduces two new services;

- seatd-service-type: simple seat management daemon
- greetd-service-type: simple login daemon

Both services are very minimalistic in nature. Simple seatd daemon
could be said as replacement for elogind-service-type. greetd daemon
is simple replacement for mingetty.

In addition to the base services, special build of pam-mount module is
included as greetd-pam-mount. It is used to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR. Special build is
required to avoid interference with default pam-mount, if used in
the system.

greetd provides agreety terminal greeter out of the box. Current
greetd-service-type includes configuration for greetd-agreety-session
variations, i.e. only terminal are supported at the moment.

Next step would be adding gtkgreet and/or wlgreet alternatives for
graphical greeter.

muradm (10):
gnu: crates-io: Add rust-enquote 1.0.3
gnu: crates-io: Add rust-pam-sys 0.5.6
gnu: freedesktop: Add greetd 0.7.0
gnu: admin: Add greetd-pam-mount
gnu: desktop: Add seatd-service-type
gnu: desktop: Add greetd-service-type
gnu: base: Add greetd to applied PAM services
gnu: pam-mount: Add greetd to applied PAM services
gnu: tests: Add seatd/greetd based minimal desktop system tests
doc: Add desktop seatd-service-type and greetd-service-type

doc/guix.texi | 187 +++++++++++++++++++++++
gnu/packages/admin.scm | 33 ++++
gnu/packages/crates-io.scm | 49 ++++++
gnu/packages/freedesktop.scm | 120 +++++++++++++++
gnu/services/base.scm | 3 +-
gnu/services/desktop.scm | 288 ++++++++++++++++++++++++++++++++++-
gnu/services/pam-mount.scm | 3 +-
gnu/tests/desktop.scm | 191 ++++++++++++++++++++++-
8 files changed, 870 insertions(+), 4 deletions(-)

--
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:38
[PATCH v4 02/10] gnu: crates-io: Add rust-pam-sys 0.5.6
(address . 49969@debbugs.gnu.org)
20210819143906.6705-2-mail@muradm.net
* gnu/packages/crates-io.scm (rust-pam-sys): Add rust-pam-sys 0.5.6
---
gnu/packages/crates-io.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 6484d4c4fc..d91417d76f 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -55,6 +55,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)
@@ -56994,3 +56995,29 @@ variant of this library is available separately as @code{im}.")
     (description
      "A Rust library quotes, unquotes, and unescapes strings")
     (license license:unlicense)))
+
+(define-public rust-pam-sys-0.5.6
+  (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))))
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:38
[PATCH v4 01/10] gnu: crates-io: Add rust-enquote 1.0.3
(address . 49969@debbugs.gnu.org)
20210819143906.6705-1-mail@muradm.net
* gnu/packages/crates-io.scm (rust-enquote-1): Add rust-enquote 1.0.3
---
gnu/packages/crates-io.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 24cc772ba7..6484d4c4fc 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Antero Mejr <antero@kodmin.com>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56972,3 +56973,24 @@ 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)))
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:38
[PATCH v4 03/10] gnu: freedesktop: Add greetd 0.7.0
(address . 49969@debbugs.gnu.org)
20210819143906.6705-3-mail@muradm.net
* gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
---
gnu/packages/freedesktop.scm | 120 +++++++++++++++++++++++++++++++++++
1 file changed, 120 insertions(+)

Toggle diff (154 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 693a79c738..ba5f6b0f99 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -62,6 +64,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages disk)
@@ -862,6 +865,123 @@ 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 greetd
+  (package
+    (name "greetd")
+    (version "0.7.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 "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-nix" ,rust-nix-0.17)
+        ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+        ("rust-rpassword" ,rust-rpassword-4)
+        ("rust-users" ,rust-users-0.9)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-tokio" ,rust-tokio-0.2)
+        ("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
+         ;; issue with terminal activation solved by this feature:
+         ;; https://lists.sr.ht/~kennylevinsen/greetd-devel/patches/24441
+         ;; greetd-next builds from head of #24441
+         ;; below substitute is provided as workaround for tagged version
+         (add-after 'unpack 'patch-terminal-switch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "greetd/src/server.rs"
+               (("switch: true,")
+                "switch: false,"))))
+         (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+)))
+
+(define-public greetd-next
+  (package
+    (inherit greetd)
+    (name "greetd")
+    (version "0.7.0-next")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url (package-home-page greetd))
+                    (commit "87e92776543c224676d64316f4519b509c21a0d5")))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "13dblvhx5vbsx0yqyz2sq1ayffqwadbkn90p52wd5b66ij1z6v1a"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments greetd)
+       ((#:cargo-inputs inputs)
+        `(("rust-nix" ,rust-nix-0.19)
+           ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+           ("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 phases)
+        `(modify-phases ,phases
+           (delete 'patch-terminal-switch)))))))
+
 (define-public packagekit
   (package
     (name "packagekit")
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:39
[PATCH v4 04/10] gnu: admin: Add greetd-pam-mount
(address . 49969@debbugs.gnu.org)
20210819143906.6705-4-mail@muradm.net
* gnu/packages/admin.scm (greetd-pam-mount): Add greetd-pam-mount
---
gnu/packages/admin.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

Toggle diff (53 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 007f15f9f5..c9bfe0b667 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -42,6 +42,7 @@
 ;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
 ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4247,6 +4248,38 @@ supports.  It can also mount encrypted LUKS volumes using the password
 supplied by the user when logging in.")
     (license (list license:gpl2+ license:lgpl2.1+))))
 
+(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.")))
+
 (define-public jc
   (package
     (name "jc")
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:39
[PATCH v4 05/10] gnu: desktop: Add seatd-service-type
(address . 49969@debbugs.gnu.org)
20210819143906.6705-5-mail@muradm.net
* gnu/services/desktop.scm: Add seatd-service-type
---
gnu/services/desktop.scm | 60 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)

Toggle diff (94 lines)
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 <me@tobias.gr>
 ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; 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> 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
+    (($ <seatd-configuration> _ _ _ 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.
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:39
[PATCH v4 06/10] gnu: desktop: Add greetd-service-type
(address . 49969@debbugs.gnu.org)
20210819143906.6705-6-mail@muradm.net
Currently, only agreety configuration is provided.

* gnu/services/desktop.scm: Add greetd-service-type
---
gnu/services/desktop.scm | 228 +++++++++++++++++++++++++++++++++++++++
1 file changed, 228 insertions(+)

Toggle diff (255 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index c42db5987e..e37811cf94 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -49,6 +49,7 @@
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnome)
@@ -160,6 +161,12 @@
             seatd-configuration
             seatd-service-type
 
+            greetd-configuration
+            greetd-terminal-configuration
+            greetd-service-type
+            greetd-agreety-tty-session
+            greetd-agreety-tty-xdg-session
+
             %desktop-services))
 
 ;;; Commentary:
@@ -1240,6 +1247,227 @@ applications needing access to be root.")
      (service-extension shepherd-root-service-type seatd-shepherd-service)))
    (default-value (seatd-configuration))))
 
+
+;;;
+;;; greetd-service-type -- minimal and flexible login manager daemon
+;;;
+
+(define-record-type* <greetd-agreety-session>
+  greetd-agreety-session make-greetd-agreety-session
+  greetd-agreety-session?
+  (package greetd-agreety-command-package (default bash))
+  (command-bin greetd-agreety-command-bin (default "/bin/bash"))
+  (command-args greetd-agreety-command-args (default '("-l")))
+  (extra-env greetd-agreety-extra-env (default '()))
+  (command-generator greetd-agreety-command-generator))
+
+(define greetd-agreety-tty-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> pkg command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-session-command"
+      #~(begin
+          (use-modules (ice-9 match))
+          (let* ((abs-cmd-bin #$(file-append pkg command-bin)))
+            (for-each
+             (match-lambda ((var . val) (setenv var val)))
+             (quote (#$@extra-env)))
+            (apply execl abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-xdg-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> package command-bin 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))
+               (abs-cmd-bin #$(file-append package command-bin)))
+            (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 abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-session-command)))
+
+(define greetd-agreety-tty-xdg-session
+  (greetd-agreety-session
+   (command-generator greetd-agreety-tty-xdg-session-command)))
+
+(define-record-type* <greetd-terminal-configuration>
+  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-tty-xdg-session)))
+
+(define (default-config-file-name config)
+  (string-join (list "config-" (greetd-terminal-vt config) ".toml") ""))
+
+(define make-greetd-terminal-default-session-command
+  (match-lambda
+    (($ <greetd-terminal-configuration> greetd _ _ _ _ default-session-command)
+     (cond ((greetd-agreety-session? default-session-command)
+            (let*
+                ((generator (greetd-agreety-command-generator
+                             default-session-command))
+                 (command (apply generator (list default-session-command)))
+                 (agreety-bin (file-append greetd "/bin/agreety")))
+              (program-file
+               "agreety-command"
+               #~(execl #$agreety-bin #$agreety-bin "-c" #$command))))
+           (else (program-file "agreety-command-exit" #~(exit #f)))))))
+
+(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 (make-greetd-terminal-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 %default-motd
+  (plain-file "motd" "This is the GNU operating system, welcome!\n\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>
+  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"))))
+
+  (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/<uid> 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))))
+
 
 ;;;
 ;;; The default set of desktop services.
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:39
[PATCH v4 07/10] gnu: base: Add greetd to applied PAM services
(address . 49969@debbugs.gnu.org)
20210819143906.6705-7-mail@muradm.net
* gnu/services/base.scm (pam-limits-service-type): add greetd PAM
service to applicable PAM services
---
gnu/services/base.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (23 lines)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index c784d312b1..446ecc30f8 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2021 qblade <qblade@protonmail.com>
 ;;; Copyright © 2021 Hui Lu <luhuins@163.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1392,7 +1393,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
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:39
[PATCH v4 08/10] gnu: pam-mount: Add greetd to applied PAM services
(address . 49969@debbugs.gnu.org)
20210819143906.6705-8-mail@muradm.net
* gnu/services/pam-mount.scm (pam-mount-service-type): add greetd PAM
service to applicable PAM services
---
gnu/services/pam-mount.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (22 lines)
diff --git a/gnu/services/pam-mount.scm b/gnu/services/pam-mount.scm
index 98611462c2..7b25efeb50 100644
--- a/gnu/services/pam-mount.scm
+++ b/gnu/services/pam-mount.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -90,7 +91,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)
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:39
[PATCH v4 09/10] gnu: tests: Add seatd/greetd based minimal desktop system tests
(address . 49969@debbugs.gnu.org)
20210819143906.6705-9-mail@muradm.net
* gnu/tests/desktop.scm (minimal-desktop): seatd/greetd based
minimal desktop
---
gnu/tests/desktop.scm | 191 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 190 insertions(+), 1 deletion(-)

Toggle diff (219 lines)
diff --git a/gnu/tests/desktop.scm b/gnu/tests/desktop.scm
index 6aa22fd49b..2517eb7b30 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 <ludo@gnu.org>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,12 +20,15 @@
 (define-module (gnu tests desktop)
   #:use-module (gnu tests)
   #: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 +107,188 @@
                #:imported-modules '((gnu services herd)
                                     (guix combinators)))))
       (run-elogind-test (virtual-machine os))))))
+
+
+;;;
+;;; Seatd/greetd based minimal desktop
+;;;
+
+(define %minimal-services
+  (append
+   (list
+    (service seatd-service-type)
+    (service greetd-service-type
+             (greetd-configuration
+              (terminals
+               (list
+                (greetd-terminal-configuration (terminal-vt "1") (terminal-switch #t))
+                (greetd-terminal-configuration (terminal-vt "2"))
+                (greetd-terminal-configuration (terminal-vt "3"))
+                (greetd-terminal-configuration (terminal-vt "4"))
+                (greetd-terminal-configuration (terminal-vt "5"))
+                (greetd-terminal-configuration (terminal-vt "6")))))))
+   (modify-services %base-services
+     (delete login-service-type)
+     (delete mingetty-service-type))))
+
+(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"
+                "\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<?)))
+
+          (test-assert "validate SEATD_SOCK and GREETD_SOCK"
+            (begin
+              (marionette-type "env > 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/<uid> 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))))))
-- 
2.32.0
M
M
muradm wrote on 19 Aug 2021 16:39
[PATCH v4 10/10] doc: Add desktop seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210819143906.6705-10-mail@muradm.net
* doc/guix.texi (Desktop Services): Provide documentation for
seatd-service-type and greetd-service-type including configuration
and sample usage.
---
doc/guix.texi | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 187 insertions(+)

Toggle diff (207 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 17ecc3ad0f..01a895fe62 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -94,6 +94,7 @@ Copyright @copyright{} 2021 Xinglu Chen@*
 Copyright @copyright{} 2021 Raghav Gururajan@*
 Copyright @copyright{} 2021 Domagoj Stolfa@*
 Copyright @copyright{} 2021 Hui Lu@*
+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
@@ -19702,6 +19703,192 @@ and ``passwd'' is with the value @code{passwd}.
 @end table
 @end deftp
 
+@defvr {Scheme Variable} seatd-service-type
+A minimal seat management daemon, and a universal seat management library.
+
+Seat management takes care of mediating access to shared devices (graphics,
+input), without requiring the applications needing access to be root.
+
+In general should be used as replacement to @code{elogind-service-type}.
+
+@lisp
+(append
+  (list
+   ;; make sure seatd is running
+   (service seatd-service-type)
+
+   (service greetd-service-type
+            (greetd-configuration
+             (terminals
+              (list
+               ;; lets have terminals 1, 2 and 3 run default XDG terminal session
+               ;; also ask terminal 1 to become active
+               (greetd-terminal-configuration (terminal-vt "1") (terminal-switch #t))
+               (greetd-terminal-configuration (terminal-vt "2"))
+               (greetd-terminal-configuration (terminal-vt "3"))
+               ;; and terminals 4, 5 and 6 plain bash terminal session
+               ;; although not so plain, just to illustrate flexibility
+               (greetd-terminal-configuration
+                (terminal-vt "4")
+                (default-session-command greetd-agreety-tty-session))
+               (greetd-terminal-configuration
+                (terminal-vt "5")
+                (default-session-command greetd-agreety-tty-session))
+               (greetd-terminal-configuration
+                (terminal-vt "6")
+                (default-session-command greetd-agreety-tty-session))))))
+
+  ;; normaly one would want %base-services
+  (modify-services %base-services
+    ;; seatd/greetd combination can replace these
+    ;; greetd provides its own PAM service
+    (delete login-service-type)
+    (delete mingetty-service-type)))
+
+@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
+
+@defvr {Scheme Variable} greetd-service-type
+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.
+
+@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
+
+@end defvr
+
+@deftp {Data Type} greetd-configuration
+Configuration record for the greetd service.
+
+@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-tty-xdg-session})
+The command-line to run to start the default session.
+
+Possible values are:
+
+@itemize @bullet
+@item
+@code{greetd-agreety-tty-session} - bash terminal session
+
+@item
+@code{greetd-agreety-tty-xdg-session} - bash terminal session with XDG environment
+
+@item
+@code{greetd-agreety-session} - custom instance of terminal session
+@end itemize
+
+@end table
+@end deftp
+
+@deftp {Data Type} greetd-agreety-session
+Configuration record for the agreety greetd greeter.
+
+@table @asis
+@item @code{package} (default: @code{bash})
+The package of command.
+
+@item @code{command-bin} (default: @samp{"/bin/bash"})
+Path to binary relative to @code{package}.
+
+@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{command-generator}
+Function that receives instance of this configuration as an argument and
+returns @code{program-file} that can be used with @code{agreety} greeter.
+
+Both @code{greetd-agreety-tty-session} and @code{greetd-agreety-tty-xdg-session}
+uses @code{greetd-agreety-session} under the hood.
+
+@end table
+@end deftp
+
+@defvr {Scheme Variable} greetd-agreety-tty-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login.
+@end defvr
+
+@defvr {Scheme Variable} greetd-agreety-tty-xdg-session
+Provides instance of @code{greetd-agreety-session} which starts @samp{"bash -l"}
+on login. Additionally, will set @code{XDG_SESSION_TYPE} and
+@code{XDG_RUNTIME_DIR} environment variables for session.
+@end defvr
+
 
 @node Sound Services
 @subsection Sound Services
-- 
2.32.0
M
M
muradm wrote on 22 Aug 2021 23:50
[PATCH v5 01/10] gnu: crates-io: Add rust-enquote 1.0.3
(address . 49969@debbugs.gnu.org)
20210822215048.20480-2-mail@muradm.net
* gnu/packages/crates-io.scm (rust-enquote-1): Add rust-enquote 1.0.3
---
gnu/packages/crates-io.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 24cc772ba7..6484d4c4fc 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Antero Mejr <antero@kodmin.com>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -56972,3 +56973,24 @@ 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)))
-- 
2.32.0
M
M
muradm wrote on 22 Aug 2021 23:50
[PATCH v5 02/10] gnu: crates-io: Add rust-pam-sys 0.5.6
(address . 49969@debbugs.gnu.org)
20210822215048.20480-3-mail@muradm.net
* gnu/packages/crates-io.scm (rust-pam-sys): Add rust-pam-sys 0.5.6
---
gnu/packages/crates-io.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 6484d4c4fc..d91417d76f 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -55,6 +55,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)
@@ -56994,3 +56995,29 @@ variant of this library is available separately as @code{im}.")
     (description
      "A Rust library quotes, unquotes, and unescapes strings")
     (license license:unlicense)))
+
+(define-public rust-pam-sys-0.5.6
+  (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))))
-- 
2.32.0
M
M
muradm wrote on 22 Aug 2021 23:50
[PATCH v5 00/10] gnu: desktop: Add seatd-service-type and greetd-service-type
(address . 49969@debbugs.gnu.org)
20210822215048.20480-1-mail@muradm.net
This patch series introduces two new services;

- seatd-service-type: simple seat management daemon
- greetd-service-type: simple login daemon

Both services are very minimalistic in nature. Simple seatd daemon
could be said as replacement for elogind-service-type. greetd daemon
is simple replacement for mingetty.

In addition to the base services, special build of pam-mount module is
included as greetd-pam-mount. It is used to provide
auto-(mounting/unmounting) of XDG_RUNTIME_DIR. Special build is
required to avoid interference with default pam-mount, if used in
the system.

greetd provides agreety terminal greeter out of the box. Current
greetd-service-type includes configuration for greetd-agreety-session
variations, i.e. only terminal are supported at the moment.

Next step would be adding gtkgreet and/or wlgreet alternatives for
graphical greeter.

muradm (10):
gnu: crates-io: Add rust-enquote 1.0.3
gnu: crates-io: Add rust-pam-sys 0.5.6
gnu: freedesktop: Add greetd 0.7.0
gnu: admin: Add greetd-pam-mount
gnu: desktop: Add seatd-service-type
gnu: desktop: Add greetd-service-type
gnu: base: Add greetd to applied PAM services
gnu: pam-mount: Add greetd to applied PAM services
gnu: tests: Add seatd/greetd based minimal desktop system tests
doc: Add desktop seatd-service-type and greetd-service-type

doc/guix.texi | 187 +++++++++++++++++++++++
gnu/packages/admin.scm | 33 ++++
gnu/packages/crates-io.scm | 49 ++++++
gnu/packages/freedesktop.scm | 120 +++++++++++++++
gnu/services/base.scm | 3 +-
gnu/services/desktop.scm | 289 ++++++++++++++++++++++++++++++++++-
gnu/services/pam-mount.scm | 3 +-
gnu/tests/desktop.scm | 190 ++++++++++++++++++++++-
8 files changed, 870 insertions(+), 4 deletions(-)

--
2.32.0
M
M
muradm wrote on 22 Aug 2021 23:50
[PATCH v5 03/10] gnu: freedesktop: Add greetd 0.7.0
(address . 49969@debbugs.gnu.org)
20210822215048.20480-4-mail@muradm.net
Also adds greetd-next which is built from master that includes
configurable terminal switch flag, required for smooth operation.
for more details.

* gnu/packages/freedesktop.scm (greetd): Add greetd 0.7.0
---
gnu/packages/freedesktop.scm | 120 +++++++++++++++++++++++++++++++++++
1 file changed, 120 insertions(+)

Toggle diff (154 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 693a79c738..aa83eb0a37 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 pineapples <guixuser6392@protonmail.com>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +47,7 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix build-system cargo)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system meson)
@@ -62,6 +64,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages crates-io)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages disk)
@@ -862,6 +865,123 @@ 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 greetd
+  (package
+    (name "greetd")
+    (version "0.7.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 "0lmwr5ld9x2wlq00i7mjgm9by8zndiq9girj8g93k0kww9zbgr3g"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-nix" ,rust-nix-0.17)
+        ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+        ("rust-rpassword" ,rust-rpassword-4)
+        ("rust-users" ,rust-users-0.9)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-tokio" ,rust-tokio-0.2)
+        ("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
+         ;; issue with terminal activation solved by this feature:
+         ;; https://lists.sr.ht/~kennylevinsen/greetd-devel/patches/24441
+         ;; greetd-next builds from head of #24441
+         ;; below substitute is provided as workaround for tagged version
+         (add-after 'unpack 'patch-terminal-switch
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "greetd/src/server.rs"
+               (("switch: true,")
+                "switch: false,"))))
+         (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+)))
+
+(define-public greetd-next
+  (package
+    (inherit greetd)
+    (name "greetd-next")
+    (version "0.7.0-87e9277")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url (package-home-page greetd))
+                    (commit "87e92776543c224676d64316f4519b509c21a0d5")))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "13dblvhx5vbsx0yqyz2sq1ayffqwadbkn90p52wd5b66ij1z6v1a"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments greetd)
+       ((#:cargo-inputs inputs)
+        `(("rust-nix" ,rust-nix-0.19)
+           ("rust-pam-sys" ,rust-pam-sys-0.5.6)
+           ("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 phases)
+        `(modify-phases ,phases
+           (delete 'patch-terminal-switch)))))))
+
 (define-public packagekit
   (package
     (name "packagekit")
-- 
2.32.0
M
M
muradm wrote on 22 Aug 2021 23:50
[PATCH v5 04/10] gnu: admin: Add greetd-pam-mount
(address . 49969@debbugs.gnu.org)
20210822215048.20480-5-mail@muradm.net
* gnu/packages/admin.scm (greetd-pam-mount): Add greetd-pam-mount
---
gnu/packages/admin.scm | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)

Toggle diff (53 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 007f15f9f5..c9bfe0b667 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -42,6 +42,7 @@
 ;;; Copyright © 2021 David Larsson <david.larsson@selfhosted.xyz>
 ;;; Copyright © 2021 WinterHound <winterhound@yandex.com>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4247,6 +4248,38 @@ supports.  It can also mount encrypted LUKS volumes using the password
 supplied by the user when logging in.")
     (license (list license:gpl2+ license:lgpl2.1+))))
 
+(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.")))
+
 (define-public jc
   (package
     (name "jc")
-- 
2.32.0
M
M
muradm wrote on 22 Aug 2021 23:50
[PATCH v5 05/10] gnu: desktop: Add seatd-service-type
(address . 49969@debbugs.gnu.org)
20210822215048.20480-6-mail@muradm.net
* gnu/services/desktop.scm: Add seatd-service-type
---
gnu/services/desktop.scm | 60 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)

Toggle diff (94 lines)
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 <me@tobias.gr>
 ;;; Copyright © 2020 Reza Alizadeh Majd <r.majd@pantherx.org>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 muradm <mail@muradm.net>
 ;;;
 ;;; 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> 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
+    (($ <seatd-configuration> _ _ _ 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.
-- 
2.32.0
M
M
muradm wrote on 22 Aug 2021 23:50
[PATCH v5 06/10] gnu: desktop: Add greetd-service-type
(address . 49969@debbugs.gnu.org)
20210822215048.20480-7-mail@muradm.net
Currently, only agreety configuration is provided.

* gnu/services/desktop.scm: Add greetd-service-type
---
gnu/services/desktop.scm | 229 +++++++++++++++++++++++++++++++++++++++
1 file changed, 229 insertions(+)

Toggle diff (256 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index c42db5987e..1f4838d4d8 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -49,6 +49,7 @@
   #:use-module (gnu system pam)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages admin)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gnome)
@@ -160,6 +161,12 @@
             seatd-configuration
             seatd-service-type
 
+            greetd-configuration
+            greetd-terminal-configuration
+            greetd-service-type
+            greetd-agreety-tty-session
+            greetd-agreety-tty-xdg-session
+
             %desktop-services))
 
 ;;; Commentary:
@@ -1240,6 +1247,228 @@ applications needing access to be root.")
      (service-extension shepherd-root-service-type seatd-shepherd-service)))
    (default-value (seatd-configuration))))
 
+
+;;;
+;;; greetd-service-type -- minimal and flexible login manager daemon
+;;;
+
+(define-record-type* <greetd-agreety-session>
+  greetd-agreety-session make-greetd-agreety-session
+  greetd-agreety-session?
+  (package greetd-agreety-command-package (default bash))
+  (command-bin greetd-agreety-command-bin (default "/bin/bash"))
+  (command-args greetd-agreety-command-args (default '("-l")))
+  (extra-env greetd-agreety-extra-env (default '()))
+  (command-generator greetd-agreety-command-generator))
+
+(define greetd-agreety-tty-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> pkg command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-session-command"
+      #~(begin
+          (use-modules (ice-9 match))
+          (let* ((abs-cmd-bin #$(file-append pkg command-bin)))
+            (for-each
+             (match-lambda ((var . val) (setenv var val)))
+             (quote (#$@extra-env)))
+            (apply execl abs-cmd-bin abs-cmd-bin
+                   (list #$@command-args))))))))
+
+(define greetd-agreety-tty-xdg-session-command
+  (match-lambda
+    (($ <greetd-agreety-session> package command-bin command-args extra-env)
+     (program-file
+      "agreety-tty-xdg-session-command"