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

35 lines
1.0 KiB
Scheme
Raw Normal View History

(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 ()
(use-modules (ice-9 threads))
(parallel
(system "foot -He rem")
(system "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))))