dotfiles/oni/home/services/copyq.scm

57 lines
1.9 KiB
Scheme

(define-module (oni home services copyq)
#:use-module ((gnu services configuration)
#:select (define-configuration/no-serialization))
#:use-module ((gnu packages xdisorg)
#:select (copyq))
#: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 packages)
#:select (package?))
#:use-module ((guix gexp)
#:select (gexp
file-append))
#:export (home-copyq-service-type
home-copyq-configuration))
(define-configuration/no-serialization home-copyq-configuration
(package
(package copyq)
"Package to use for settings copyq.")
(auto-start?
(boolean #t)
"Automatically start copyq on startup?"))
(define (add-copyq-packages config)
(list (home-copyq-configuration-package config)))
(define (home-copyq-shepherd-service config)
(list
(shepherd-service
(documentation "Start copyq")
(provision '(copyq))
(auto-start? (home-copyq-configuration-auto-start? config))
(start
#~(make-forkexec-constructor
(list #$(file-append (home-copyq-configuration-package config) "/bin/copyq"))
#:log-file (format #f "~a/.local/var/log/copyq.log" (getenv "HOME"))))
(stop #~(make-kill-destructor)))))
(define home-copyq-service-type
(service-type
(name 'home-copyq)
(extensions
(list (service-extension
home-profile-service-type
add-copyq-packages)
(service-extension
home-shepherd-service-type
home-copyq-shepherd-service)))
(compose identity)
(default-value (home-copyq-configuration))
(description "Install and configure copyq.")))