2024-11-26 17:53:35 +00:00
|
|
|
(define-module (home-environments radio shepherd-services)
|
2024-11-25 02:17:43 +00:00
|
|
|
#:use-module (guix gexp)
|
|
|
|
#:use-module (gnu services shepherd)
|
|
|
|
#:use-module (shepherd service timer)
|
|
|
|
|
2024-11-25 17:27:27 +00:00
|
|
|
#:export (repl timer wake-up))
|
|
|
|
|
|
|
|
#|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))))
|
2024-11-25 02:17:43 +00:00
|
|
|
|
|
|
|
(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 ()
|
2024-11-25 06:23:58 +00:00
|
|
|
(spawn-shell-command "mpv --shuffle ~/media/music/by-artist"))))
|
2024-11-25 02:17:43 +00:00
|
|
|
(stop #~(make-timer-destructor))
|
|
|
|
(actions (list timer-trigger-action))))
|
|
|
|
|