dotfiles/oni/home/services/kitty.scm

55 lines
1.7 KiB
Scheme
Raw Permalink 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)
`(("kitty/kitty.conf"
,(mixed-text-file
"kitty.conf"
(serialize-kitty-config config)))))
(define (add-kitty-packages config)
(list (home-kitty-configuration-package config)))
(define home-kitty-service-type
(service-type
(name 'home-kitty)
(extensions
(list (service-extension
home-xdg-configuration-files-service-type
kitty-home-files)
(service-extension
home-profile-service-type
add-kitty-packages)))
(compose identity)
(default-value (home-kitty-configuration))
(description "Install and configure kitty.")))