dotfiles/oni/home/services/utilities.scm

60 lines
2.1 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 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-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)))
(compose identity)
(default-value (home-inkplate-display-configuration))
(description "Install and configure Inkplate display.")))