zero/home-environments/radio/shepherd-services.scm

32 lines
930 B
Scheme

(define-module (radio shepherd-services)
#:use-module (guix gexp)
#:use-module (gnu services shepherd)
#:use-module (shepherd service timer)
#:export (wake-up timer))
(define timer-trigger-action
(shepherd-action
(name 'trigger)
(procedure #~trigger-timer)
(documentation
"Trigger the action associated with @var{timer} as if it had reached its
next calendar event.")))
(define wake-up
(shepherd-service
(provision '(wake-up))
(modules '((shepherd service timer)))
(start #~(make-timer-constructor
(calendar-event #:hours '(6) #:minutes '(0))
(lambda ()
(spawn-shell-command "mpv --shuffle ~/media/music/by-artist"))))
(stop #~(make-timer-destructor))
(actions (list timer-trigger-action))))
(define timer
(shepherd-service
(provision '(timer))
(modules '((shepherd service timer)))
(free-form #~(timer-service))))