dotfiles/oni/home/services/kitty.scm

49 lines
1.5 KiB
Scheme
Raw Normal View History

(define-module (oni home services kitty)
#:use-module (gnu services configuration)
#:use-module (gnu packages terminals)
#:use-module (gnu home services)
#:use-module (gnu home services utils)
#:use-module (guix packages)
#:use-module (guix gexp)
#:use-module (string transform)
#:export (home-kitty-service-type
home-kitty-configuration))
(define-configuration/no-serialization home-kitty-configuration
(package
(package kitty)
"Package to use for setting kitty")
(configuration
(alist '())
"List of configuration settings."))
(define (serialize-kitty-setting setting)
(format #f "~a ~a"
(transform-string (symbol->string (car setting)) #\- #\_)
(let ((value (cdr setting)))
(cond
((boolean? value) (if value "yes" "no"))
((list? value) (string-join (map symbol->string value) ", "))
(else value)))))
(define (serialize-kitty-config config)
(string-join (map serialize-kitty-setting (home-kitty-configuration-configuration config)) "\n" 'suffix))
(define (kitty-home-files config)
`(("config/kitty/kitty.conf"
,(mixed-text-file
"kitty.conf"
(serialize-kitty-config config)))))
(define home-kitty-service-type
(service-type
(name 'home-kitty)
(extensions
(list (service-extension
home-files-service-type
kitty-home-files)))
(compose identity)
(default-value (home-kitty-configuration))
(description "Install and configure kitty.")))