diff options
| author | B. Wilson <elaexuotee@wilsonb.com> | 2021-04-20 11:49:27 +0900 |
|---|---|---|
| committer | Leo Famulari <leo@famulari.name> | 2021-04-24 12:30:01 -0400 |
| commit | 2c93df3d11bf8ceeb5c203416a2533cf32275e1a (patch) | |
| tree | 6b79a3eef9b8acd66064a36dc0e305526674f972 /gnu/services/linux.scm | |
| parent | 794e26fda7c61d61fffe2ae778fdd3953bea3c60 (diff) | |
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/linux.scm')
| -rw-r--r-- | gnu/services/linux.scm | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm index 340b330030f..2eb02ac5a3b 100644 --- a/gnu/services/linux.scm +++ b/gnu/services/linux.scm | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> | 3 | ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re> |
| 4 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> | 4 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> |
| 5 | ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com> | 5 | ;;; Copyright © 2021 raid5atemyhomework <raid5atemyhomework@protonmail.com> |
| 6 | ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com> | ||
| 6 | ;;; | 7 | ;;; |
| 7 | ;;; This file is part of GNU Guix. | 8 | ;;; This file is part of GNU Guix. |
| 8 | ;;; | 9 | ;;; |
| @@ -47,6 +48,11 @@ | |||
| 47 | 48 | ||
| 48 | kernel-module-loader-service-type | 49 | kernel-module-loader-service-type |
| 49 | 50 | ||
| 51 | rasdaemon-configuration | ||
| 52 | rasdaemon-configuration? | ||
| 53 | rasdaemon-configuration-record? | ||
| 54 | rasdaemon-service-type | ||
| 55 | |||
| 50 | zram-device-configuration | 56 | zram-device-configuration |
| 51 | zram-device-configuration? | 57 | zram-device-configuration? |
| 52 | zram-device-configuration-size | 58 | zram-device-configuration-size |
| @@ -190,6 +196,49 @@ representation." | |||
| 190 | 196 | ||
| 191 | 197 | ||
| 192 | ;;; | 198 | ;;; |
| 199 | ;;; Reliability, Availability, and Serviceability (RAS) daemon | ||
| 200 | ;;; | ||
| 201 | |||
| 202 | (define-record-type* <rasdaemon-configuration> | ||
| 203 | rasdaemon-configuration make-rasdaemon-configuration | ||
| 204 | rasdaemon-configuration? | ||
| 205 | (record? rasdaemon-configuration-record? (default #f))) | ||
| 206 | |||
| 207 | (define (rasdaemon-configuration->command-line-args config) | ||
| 208 | "Translate <rasdaemon-configuration> to its command line arguments | ||
| 209 | representation" | ||
| 210 | (let ((record? (rasdaemon-configuration-record? config))) | ||
| 211 | `(,(file-append rasdaemon "/sbin/rasdaemon") | ||
| 212 | "--foreground" ,@(if record? '("--record") '())))) | ||
| 213 | |||
| 214 | (define (rasdaemon-activation config) | ||
| 215 | (let ((record? (rasdaemon-configuration-record? config)) | ||
| 216 | (rasdaemon-dir "/var/lib/rasdaemon")) | ||
| 217 | (with-imported-modules '((guix build utils)) | ||
| 218 | #~(if #$record? (mkdir-p #$rasdaemon-dir))))) | ||
| 219 | |||
| 220 | (define (rasdaemon-shepherd-service config) | ||
| 221 | (shepherd-service | ||
| 222 | (documentation "Run rasdaemon") | ||
| 223 | (provision '(rasdaemon)) | ||
| 224 | (requirement '(syslogd)) | ||
| 225 | (start #~(make-forkexec-constructor | ||
| 226 | '#$(rasdaemon-configuration->command-line-args config))) | ||
| 227 | (stop #~(make-kill-destructor)))) | ||
| 228 | |||
| 229 | (define rasdaemon-service-type | ||
| 230 | (service-type | ||
| 231 | (name 'rasdaemon) | ||
| 232 | (default-value (rasdaemon-configuration)) | ||
| 233 | (extensions | ||
| 234 | (list (service-extension shepherd-root-service-type | ||
| 235 | (compose list rasdaemon-shepherd-service)) | ||
| 236 | (service-extension activation-service-type rasdaemon-activation))) | ||
| 237 | (compose concatenate) | ||
| 238 | (description "Run @command{rasdaemon}, the RAS monitor"))) | ||
| 239 | |||
| 240 | |||
| 241 | ;;; | ||
| 193 | ;;; Kernel module loader. | 242 | ;;; Kernel module loader. |
| 194 | ;;; | 243 | ;;; |
| 195 | 244 | ||
