aboutsummaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorB. Wilson <elaexuotee@wilsonb.com>2021-04-20 11:49:27 +0900
committerLeo Famulari <leo@famulari.name>2021-04-24 12:30:01 -0400
commit2c93df3d11bf8ceeb5c203416a2533cf32275e1a (patch)
tree6b79a3eef9b8acd66064a36dc0e305526674f972 /gnu/services
parent794e26fda7c61d61fffe2ae778fdd3953bea3c60 (diff)
downloadguix-2c93df3d11bf8ceeb5c203416a2533cf32275e1a.tar
guix-2c93df3d11bf8ceeb5c203416a2533cf32275e1a.tar.gz
services: Add a service for rasdaemon.
* gnu/services/linux.scm (rasdaemon-configuration, rasdaemon-configuration?, rasdaemon-configuration-record?, rasdaemon-service-type): New variables. * doc/guix.texi (Linux Services): Document it. Signed-off-by: Leo Famulari <leo@famulari.name>
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/linux.scm49
1 files changed, 49 insertions, 0 deletions
diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm
index 340b330030..2eb02ac5a3 100644
--- a/gnu/services/linux.scm
+++ b/gnu/services/linux.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com>
+;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -47,6 +48,11 @@
kernel-module-loader-service-type
+ rasdaemon-configuration
+ rasdaemon-configuration?
+ rasdaemon-configuration-record?
+ rasdaemon-service-type
+
zram-device-configuration
zram-device-configuration?
zram-device-configuration-size
@@ -190,6 +196,49 @@ representation."
;;;
+;;; Reliability, Availability, and Serviceability (RAS) daemon
+;;;
+
+(define-record-type* <rasdaemon-configuration>
+ rasdaemon-configuration make-rasdaemon-configuration
+ rasdaemon-configuration?
+ (record? rasdaemon-configuration-record? (default #f)))
+
+(define (rasdaemon-configuration->command-line-args config)
+ "Translate <rasdaemon-configuration> to its command line arguments
+ representation"
+ (let ((record? (rasdaemon-configuration-record? config)))
+ `(,(file-append rasdaemon "/sbin/rasdaemon")
+ "--foreground" ,@(if record? '("--record") '()))))
+
+(define (rasdaemon-activation config)
+ (let ((record? (rasdaemon-configuration-record? config))
+ (rasdaemon-dir "/var/lib/rasdaemon"))
+ (with-imported-modules '((guix build utils))
+ #~(if #$record? (mkdir-p #$rasdaemon-dir)))))
+
+(define (rasdaemon-shepherd-service config)
+ (shepherd-service
+ (documentation "Run rasdaemon")
+ (provision '(rasdaemon))
+ (requirement '(syslogd))
+ (start #~(make-forkexec-constructor
+ '#$(rasdaemon-configuration->command-line-args config)))
+ (stop #~(make-kill-destructor))))
+
+(define rasdaemon-service-type
+ (service-type
+ (name 'rasdaemon)
+ (default-value (rasdaemon-configuration))
+ (extensions
+ (list (service-extension shepherd-root-service-type
+ (compose list rasdaemon-shepherd-service))
+ (service-extension activation-service-type rasdaemon-activation)))
+ (compose concatenate)
+ (description "Run @command{rasdaemon}, the RAS monitor")))
+
+
+;;;
;;; Kernel module loader.
;;;