12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- (define-module (gnu home services fontutils)
- #:use-module (gnu home services)
- #:use-module (gnu packages fontutils)
- #:use-module (guix gexp)
- #:use-module (srfi srfi-1)
- #:use-module (ice-9 match)
- #:use-module (sxml simple)
- #:export (home-fontconfig-service-type))
- (define (write-fontconfig-doctype)
- "Prints fontconfig's DOCTYPE to current-output-port."
-
-
-
-
- (format #t "<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>"))
- (define (config->sxml config)
- "Converts a <home-fontconfig-configuration> record into the SXML representation
- of fontconfig's fonts.conf file."
- (define (snippets->sxml snippet)
- (match snippet
- ((or (? string? dir)
- (? gexp? dir))
- `(dir ,dir))
- ((? list?)
- snippet)))
- `(*TOP* (*PI* xml "version='1.0'")
- ,write-fontconfig-doctype
- (fontconfig
- ,@(map snippets->sxml config))))
- (define (add-fontconfig-config-file config)
- `(("fontconfig/fonts.conf"
- ,(mixed-text-file
- "fonts.conf"
- (call-with-output-string
- (lambda (port)
- (sxml->xml (config->sxml config) port)))))))
- (define (regenerate-font-cache-gexp _)
- `(("profile/share/fonts"
- ,#~(system* #$(file-append fontconfig "/bin/fc-cache") "-fv"))))
- (define home-fontconfig-service-type
- (service-type (name 'home-fontconfig)
- (extensions
- (list (service-extension
- home-xdg-configuration-files-service-type
- add-fontconfig-config-file)
- (service-extension
- home-run-on-change-service-type
- regenerate-font-cache-gexp)
- (service-extension
- home-profile-service-type
- (const (list fontconfig)))))
- (compose concatenate)
- (extend append)
- (default-value '("~/.guix-home/profile/share/fonts"))
- (description
- "Provides configuration file for fontconfig and make
- fc-* utilities aware of font packages installed in Guix Home's profile.")))
|