Add guile configuration
This commit is contained in:
parent
892a409184
commit
7957b236de
2 changed files with 73 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
|||
#:use-module (oni home services syncthing)
|
||||
#:use-module (oni home services unclutter)
|
||||
#:use-module (oni home services dunst)
|
||||
#:use-module (oni home services guile)
|
||||
#:use-module (oni packages hlwm-run-or-raise)
|
||||
#:use-module (oni packages pick-random-wallpaper))
|
||||
|
||||
|
@ -444,4 +445,9 @@ LocalForward 2812 localhost:2812"))
|
|||
("gPodder"
|
||||
(appname "gPodder")
|
||||
(background "#7f5785")
|
||||
(foreground "#ffffff")))))))))
|
||||
(foreground "#ffffff"))))))
|
||||
|
||||
(service home-guile-service-type
|
||||
(home-guile-configuration
|
||||
(use-readline #t)
|
||||
(use-colorized #t))))))
|
||||
|
|
66
oni/home/services/guile.scm
Normal file
66
oni/home/services/guile.scm
Normal file
|
@ -0,0 +1,66 @@
|
|||
(define-module (oni home services guile)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (gnu home services)
|
||||
#:use-module (gnu packages guile)
|
||||
#:use-module (gnu packages guile-xyz)
|
||||
#:use-module (gnu services configuration)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix gexp)
|
||||
|
||||
#:export (home-guile-service-type
|
||||
home-guile-configuration))
|
||||
|
||||
(define (serialize-boolean field value)
|
||||
(match field
|
||||
('use-readline
|
||||
(if value
|
||||
"(use-modules (ice-9 readline))
|
||||
(activate-readline)\n"
|
||||
""))
|
||||
('use-colorized
|
||||
(if value
|
||||
"(use-modules (ice-9 colorized))
|
||||
(activate-colorized)\n"
|
||||
""))))
|
||||
|
||||
(define-configuration home-guile-configuration
|
||||
(package
|
||||
(package guile-3.0-latest)
|
||||
"Package to use for setting Guile")
|
||||
(use-readline
|
||||
(boolean #f)
|
||||
"Should readline be initialized in Guile?")
|
||||
(use-colorized
|
||||
(boolean #f)
|
||||
"Should the colorized module be initialized in Guile?"))
|
||||
|
||||
(define (add-guile-packages config)
|
||||
(let ((package-list (append (list (home-guile-configuration-package config))
|
||||
(if (home-guile-configuration-use-readline config) (list guile-readline) '())
|
||||
(if (home-guile-configuration-use-colorized config) (list guile-colorized) '()))))
|
||||
(display package-list)
|
||||
package-list))
|
||||
|
||||
(define (serialize-guile-configuration config)
|
||||
(serialize-configuration config home-guile-configuration-fields))
|
||||
|
||||
(define (home-guile-config-file config)
|
||||
(computed-file "guile"
|
||||
#~(call-with-output-file #$output
|
||||
(lambda (port)
|
||||
(display #$(serialize-guile-configuration config) port)))))
|
||||
|
||||
(define (home-guile-config-files config)
|
||||
`((".guile" ,(home-guile-config-file config))))
|
||||
|
||||
(define home-guile-service-type
|
||||
(service-type (name 'home-guile)
|
||||
(extensions
|
||||
(list (service-extension
|
||||
home-files-service-type
|
||||
home-guile-config-files)
|
||||
(service-extension
|
||||
home-profile-service-type
|
||||
add-guile-packages)))
|
||||
(default-value (home-guile-configuration))
|
||||
(description "Configure guile")))
|
Loading…
Reference in a new issue