Add cbatticon service

This commit is contained in:
Tom Willemse 2024-11-18 21:41:36 -08:00
parent 864f3941d5
commit 869528b295
2 changed files with 59 additions and 1 deletions

View file

@ -15,6 +15,8 @@
#:use-module (gnu services) #:use-module (gnu services)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (oni home config common) #:use-module (oni home config common)
#:use-module ((oni home services admin)
#:select (home-cbatticon-service-type))
#:use-module (oni home services cmst) #:use-module (oni home services cmst)
#:use-module (oni home services dunst) #:use-module (oni home services dunst)
#:use-module ((oni home services emacs) #:use-module ((oni home services emacs)
@ -298,4 +300,5 @@
(service home-emacs-golden-ratio-service-type) (service home-emacs-golden-ratio-service-type)
(service home-emacs-pinentry-service-type) (service home-emacs-pinentry-service-type)
(service home-xss-lock-service-type)))) (service home-xss-lock-service-type)
(service home-cbatticon-service-type))))

View file

@ -0,0 +1,55 @@
(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.")))