Tom Willemse
051034ba2a
These configurations were set up wrong, putting the configuration files in ‘config/*’ instead of ‘.config/*’. The ‘home-xdg-configuration-files-service-type’ takes care of putting them in the right directory. I didn't know about this service before, it doesn't show up when I ‘guix home search home’
54 lines
1.7 KiB
Scheme
54 lines
1.7 KiB
Scheme
(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.")))
|