Add a kitty home service with configuration

This commit is contained in:
Tom Willemse 2022-04-03 01:32:27 -07:00
parent d28afb72db
commit e0f1dd5d07
2 changed files with 102 additions and 2 deletions

View file

@ -8,7 +8,8 @@
#:use-module (gnu packages admin)
#:use-module (guix gexp)
#:use-module (oni home services xdisorg)
#:use-module (oni home services xmodmap))
#:use-module (oni home services xmodmap)
#:use-module (oni home services kitty))
(home-environment
(packages (list (specification->package+output "glibc-locales")))
@ -125,4 +126,55 @@
(pointer '(3 2 1))
(extra '("remove Mod5 = ISO_Level3_Shift"
"keycode 108 = Alt_L"
"add Mod1 = Alt_L")))))))
"add Mod1 = Alt_L"))))
(service home-kitty-service-type
(home-kitty-configuration
(configuration
'((font-family . "Fantasque Sans Mono")
(bold-font . "Fantasque Sans Mono Bold")
(italic-font . "Fantasque Sans Mono Italic")
(bold-italic-font . "Fantasque Sans Mono Bold Italic")
(font-size . 14)
(symbol-map . "U+f002 Font Awesome 5 Free Solid")
(cursor-shape . beam)
(cursor-blink-interval . 0)
(url-style . single)
(open-url-with . firefox)
(copy-on-select . #f)
(enable-audio-bell . #f)
(visual-bell-duration . 0)
(window-padding-width . 11.25)
(active-tab-font-style . normal)
(editor . emacsclient)
(allow-remote-control . #t)
(enabled-layouts vertical stack tall fat grid horizontal)
(cursor . "#969696")
(url-color . "#a88654")
(active-border-color . "#1f2c3f")
(inactive-border-color . "#3d3d3d")
(bell-border-color . "#3f1a1a")
(active-tab-foreground . "#65a854")
(active-tab-background . "#1f2c3f")
(inactive-tab-foreground . "#65a854")
(inactive-tab-background . "#3d3d3d")
(foreground . "#bfbfbf")
(background . "#222424")
(selection-foreground . "#bfbfbf")
(selection-background . "#1f2c3f")
(color0 . "#222222")
(color8 . "#3d3d3d")
(color1 . "#3f1a1a")
(color9 . "#da9d9d")
(color2 . "#65a854")
(color10 . "#a9d39e")
(color3 . "#8d995c")
(color11 . "#c2ca9e")
(color4 . "#5476a8")
(color12 . "#a2b8b8")
(color5 . "#9754a8")
(color13 . "#d0a8da")
(color6 . "#54a8a8")
(color14 . "#abdddd")
(color7 . "#969696")
(color15 . "#ededed"))))))))

View file

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