summary refs log tree commit diff
path: root/gnu/home
diff options
context:
space:
mode:
authorGiacomo Leidi <goodoldpaul@autistici.org>2023-01-02 18:44:51 +0100
committerLudovic Courtès <ludo@gnu.org>2023-01-31 23:08:38 +0100
commitf85865a05aa3914a478a46e6f10a5ac442d793a2 (patch)
treed370ed6a2e32d796d78bfb30c4de3e0ffb5f26f2 /gnu/home
parentaed385e18ec7b68a0bc1bb4b173aeadc9cd97245 (diff)
downloadguix-f85865a05aa3914a478a46e6f10a5ac442d793a2.tar.gz
home: services: fontutils: Add service value.
* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Add
support for multiple paths;
(home-fontconfig-service-type): Honor it;
* doc/guix.texi (Fonts Services): Document it.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/home')
-rw-r--r--gnu/home/services/fontutils.scm18
1 files changed, 12 insertions, 6 deletions
diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm
index 6062eaed6a..3399cb7ec8 100644
--- a/gnu/home/services/fontutils.scm
+++ b/gnu/home/services/fontutils.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
+;;; Copyright © 2023 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@
   #:use-module (gnu home services)
   #:use-module (gnu packages fontutils)
   #:use-module (guix gexp)
+  #:use-module (srfi srfi-1)
 
   #:export (home-fontconfig-service-type))
 
@@ -33,15 +35,17 @@
 ;;;
 ;;; Code:
 
-(define (add-fontconfig-config-file he-symlink-path)
+(define (add-fontconfig-config-file directories)
   `(("fontconfig/fonts.conf"
      ,(mixed-text-file
        "fonts.conf"
-       "<?xml version='1.0'?>
+       (apply string-append
+              `("<?xml version='1.0'?>
 <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
-<fontconfig>
-  <dir>~/.guix-home/profile/share/fonts</dir>
-</fontconfig>"))))
+<fontconfig>\n" ,@(map (lambda (directory)
+                         (string-append "  <dir>" directory "</dir>\n"))
+                       directories)
+                "</fontconfig>\n"))))))
 
 (define (regenerate-font-cache-gexp _)
   `(("profile/share/fonts"
@@ -59,7 +63,9 @@
                        (service-extension
                         home-profile-service-type
                         (const (list fontconfig)))))
-                (default-value #f)
+                (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.")))