mirror of https://codeberg.org/anemofilia/zero
home-environments: radio: Setup timer-related shepherd-services
parent
99675cf4fd
commit
635bf92b33
|
@ -28,6 +28,7 @@
|
||||||
#|Radio|#
|
#|Radio|#
|
||||||
#|C|# #:use-module ((radio channels) #:prefix channel:)
|
#|C|# #:use-module ((radio channels) #:prefix channel:)
|
||||||
#|P|# #:use-module ((radio packages) #:prefix packages:)
|
#|P|# #:use-module ((radio packages) #:prefix packages:)
|
||||||
|
#|S|# #:use-module ((radio shepherd-services) #:prefix shepherd-service:)
|
||||||
|
|
||||||
#|Radix|#
|
#|Radix|#
|
||||||
#|C|# #:use-module (radix combinators)
|
#|C|# #:use-module (radix combinators)
|
||||||
|
@ -145,7 +146,9 @@
|
||||||
#|Shepherd services|#
|
#|Shepherd services|#
|
||||||
(service home-shepherd-service-type
|
(service home-shepherd-service-type
|
||||||
(home-shepherd-configuration
|
(home-shepherd-configuration
|
||||||
(shepherd (@ (shepherd-package) shepherd))))
|
(shepherd (@ (shepherd-package) shepherd))
|
||||||
|
(services (list shepherd-service:timer
|
||||||
|
shepherd-service:wake-up))))
|
||||||
|
|
||||||
#|Shell services|#
|
#|Shell services|#
|
||||||
(service home-tty-colorscheme-service-type
|
(service home-tty-colorscheme-service-type
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
(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))))
|
Loading…
Reference in New Issue