dotfiles/oni/home/services/utilities.scm
Tom Willemse 16fae84dc0 Call inkplate-display directly instead of through herd
It doesn't seem to be running correctly at night, so maybe calling it directly
will work better than calling it through ‘herd’.
2024-04-07 00:19:04 -07:00

73 lines
2.6 KiB
Scheme

(define-module (oni home services utilities)
#:use-module ((gnu services configuration)
#:select (serialize-package
define-configuration))
#:use-module ((gnu home services)
#:select (service-type
service-extension
home-profile-service-type))
#:use-module ((gnu home services mcron)
#:select (home-mcron-service-type
home-mcron-configuration))
#:use-module ((gnu home services shepherd)
#:select (home-shepherd-service-type
shepherd-service))
#:use-module ((guix gexp)
#:select (gexp
file-append))
#:use-module ((guix packages)
#:select (package?))
#:use-module ((oni packages utilities)
#:select (inkplate-display))
#:export (home-inkplate-display-service-type
home-inkplate-display-configuration))
(define (serialize-boolean field value)
"")
(define-configuration home-inkplate-display-configuration
(package
(package inkplate-display)
"Package to use for updating the inkplate display.")
(auto-start?
(boolean #t)
"Should the Inkplate display be updated automatically?"))
(define (add-inkplate-display-packages config)
(list (home-inkplate-display-configuration-package config)))
(define (home-inkplate-display-shepherd-service config)
(list
(shepherd-service
(documentation "Update the Inkplate display")
(provision '(inkplate-display))
(auto-start? (home-inkplate-display-configuration-auto-start? config))
(one-shot? #t)
(start
#~(make-forkexec-constructor
'(#$(file-append inkplate-display "/bin/inkplate-display")))))))
(define (home-inkplate-display-mcron-service config)
(list #~(job '(next-day)
(lambda ()
(system* #$(file-append inkplate-display "/bin/inkplate-display")))
;; "herd start inkplate-display"
"Update my Inkplate display.")))
(define home-inkplate-display-service-type
(service-type
(name 'home-inkplate-display)
(extensions
(list (service-extension
home-profile-service-type
add-inkplate-display-packages)
(service-extension
home-shepherd-service-type
home-inkplate-display-shepherd-service)
(service-extension
home-mcron-service-type
home-inkplate-display-mcron-service)))
(compose identity)
(default-value (home-inkplate-display-configuration))
(description "Install and configure Inkplate display.")))