services: Add dumb-runtime-dir-service-type.

* rosenthal/services/file-systems.scm (dumb-runtime-dir-activation)
(dumb-runtime-dir-pam-service,dumb-runtime-dir-service-type): New variables.
* README.org (Services): Add it.
This commit is contained in:
Hilton Chain 2025-02-13 20:10:06 +08:00
parent 2d776b7195
commit a4bc613b0c
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292
2 changed files with 47 additions and 1 deletions

View File

@ -116,6 +116,7 @@ Nonfree Software / 非自由軟件:
+ btrbk-service-type
+ clash-service-type
+ docker-mailserver-service-type
+ dumb-runtime-dir-service-type
+ iwd-service-type
+ forgejo-service-type
+ jellyfin-service-type

View File

@ -5,11 +5,15 @@
(define-module (rosenthal services file-systems)
#:use-module (guix gexp)
#:use-module (gnu packages backup)
#:use-module (rosenthal packages admin)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (gnu services mcron)
#:use-module (gnu system pam)
#:export (btrbk-service-type
btrbk-configuration))
btrbk-configuration
dumb-runtime-dir-service-type))
;;
@ -44,3 +48,44 @@
btrbk-mcron-jobs)))
(default-value (btrbk-configuration))
(description "Configure and run btrbk hourly.")))
;;;
;;; pam-dumb-runtime-dir
;;;
(define dumb-runtime-dir-activation
#~(begin
(use-modules (guix build utils))
(mkdir-p "/run/user")
(chmod "/run/user" #o0755)))
(define dumb-runtime-dir-pam-service
(let ((optional-pam-entry
(pam-entry
(control "optional")
(module
(file-append
pam-dumb-runtime-dir "/lib/security/pam_dumb_runtime_dir.so")))))
(list (pam-extension
(transformer
(lambda (pam)
(if (string=? (pam-service-name pam) "login")
(pam-service
(inherit pam)
(session
(cons optional-pam-entry
(pam-service-session pam))))
pam)))))))
(define dumb-runtime-dir-service-type
(service-type
(name 'dumb-runtime-dir)
(extensions
(list (service-extension activation-service-type
(const dumb-runtime-dir-activation))
(service-extension pam-root-service-type
(const dumb-runtime-dir-pam-service))))
(default-value #f) ;No default value required.
(description "Create @code{XDG_RUNTIME_DIR} on login and never remove it.")))