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

43 lines
1.2 KiB
Scheme

(define-module (home-environments radio shepherd-services)
#:use-module (guix gexp)
#:use-module (gnu services shepherd)
#:use-module (shepherd service timer)
#:export (alarm repl timer))
#|Repl|#
(define repl
(shepherd-service
(provision '(repl))
(modules '((shepherd service repl)))
(free-form #~(repl-service))))
#|Timers|#
(define timer
(shepherd-service
(provision '(timer))
(modules '((shepherd service timer)))
(free-form #~(timer-service))))
(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 alarm
(shepherd-service
(provision '(alarm))
(modules '((shepherd service timer)))
(start #~(make-timer-constructor
(calendar-event #:hours '(6) #:minutes '(0))
(lambda ()
(spawn-shell-command
"notify-send \"$(rem)\" --expire-time 0; \
mpv --shuffle ~/media/music/by-artist"))))
(stop #~(make-timer-destructor))
(actions (list timer-trigger-action))))