dotfiles/oni/home/services/admin.scm

55 lines
1.9 KiB
Scheme

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