services: mcron: Use match-record.

* gnu/services/mcron.scm (mcron-shepherd-services): Use match-record.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Bruno Victal 2023-03-13 19:30:49 +00:00 committed by Maxim Cournoyer
parent 6f4fd8f5b8
commit edb398449f
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -143,11 +143,10 @@ (define (shepherd-schedule-action mcron files)
(display line) (display line)
(loop))))))))) (loop)))))))))
(define mcron-shepherd-services (define (mcron-shepherd-services config)
(match-lambda (match-record config <mcron-configuration> (mcron jobs log? log-format)
(($ <mcron-configuration> mcron ()) ;nothing to do! (if (eq? jobs '())
'()) '() ; nothing to do
(($ <mcron-configuration> mcron jobs log? log-format)
(let ((files (job-files mcron jobs))) (let ((files (job-files mcron jobs)))
(list (shepherd-service (list (shepherd-service
(provision '(mcron)) (provision '(mcron))
@ -165,8 +164,8 @@ (define mcron-shepherd-services
#~()) #~())
#$@files) #$@files)
;; Disable auto-compilation of the job files and set a ;; Disable auto-compilation of the job files and
;; sane value for 'PATH'. ;; set a sane value for 'PATH'.
#:environment-variables #:environment-variables
(cons* "GUILE_AUTO_COMPILE=0" (cons* "GUILE_AUTO_COMPILE=0"
"PATH=/run/current-system/profile/bin" "PATH=/run/current-system/profile/bin"
@ -175,7 +174,6 @@ (define mcron-shepherd-services
#:log-file "/var/log/mcron.log")) #:log-file "/var/log/mcron.log"))
(stop #~(make-kill-destructor)) (stop #~(make-kill-destructor))
(actions (actions
(list (shepherd-schedule-action mcron files))))))))) (list (shepherd-schedule-action mcron files)))))))))