mirror of https://codeberg.org/anemofilia/zero
41 lines
1.1 KiB
Scheme
41 lines
1.1 KiB
Scheme
(define-module (radio shepherd-services)
|
|
#:use-module (guix gexp)
|
|
#:use-module (gnu services shepherd)
|
|
#:use-module (shepherd service timer)
|
|
|
|
#: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))))
|
|
|
|
(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))))
|
|
|