2022-04-03 10:32:27 +02:00
|
|
|
(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)))))
|
|
|
|
|
2022-04-05 09:54:09 +02:00
|
|
|
(define (add-kitty-packages config)
|
|
|
|
(list (home-kitty-configuration-package config)))
|
|
|
|
|
2022-04-03 10:32:27 +02:00
|
|
|
(define home-kitty-service-type
|
|
|
|
(service-type
|
|
|
|
(name 'home-kitty)
|
|
|
|
(extensions
|
|
|
|
(list (service-extension
|
|
|
|
home-files-service-type
|
2022-04-05 09:54:09 +02:00
|
|
|
kitty-home-files)
|
|
|
|
(service-extension
|
|
|
|
home-profile-service-type
|
|
|
|
add-kitty-packages)))
|
2022-04-03 10:32:27 +02:00
|
|
|
(compose identity)
|
|
|
|
(default-value (home-kitty-configuration))
|
|
|
|
(description "Install and configure kitty.")))
|