unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Giacomo Leidi via Guix-patches via <guix-patches@gnu.org>
To: 60498@debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul@autistici.org>
Subject: [bug#60498] [PATCH] home: services: fontutils: Add service value.
Date: Mon,  2 Jan 2023 18:44:51 +0100	[thread overview]
Message-ID: <20230102174451.6827-1-goodoldpaul@autistici.org> (raw)
In-Reply-To: <3c0e43334aab599678ddeee842c073ee@autistici.org>

* 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.
---
 doc/guix.texi                   | 25 +++++++++++++++++++++++++
 gnu/home/services/fontutils.scm | 18 ++++++++++++------
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 5c85680831..1e70dd05c0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -40980,6 +40980,7 @@ services)}.
 * SSH: Secure Shell.                                   Setting up the secure shell client.
 * Desktop: Desktop Home Services.                      Services for graphical environments.
 * Guix: Guix Home Services.                            Services for Guix.
+* Fonts: Fonts Home Services.                          Services for managing User's fonts.
 @end menu
 @c In addition to that Home Services can provide
 
@@ -41856,6 +41857,30 @@ A typical extension for adding a channel might look like this:
 @end lisp
 @end defvr
 
+@node Fonts Services
+@subsection Fonts Home Services
+
+The @code{(gnu home services fontutils)} module provides services for
+user-specific @code{fontconfig} setup.
+
+@defvr {Scheme Variable} home-fontconfig-service-type
+This is the service type for generating configurations for @code{fontconfig} and @code{fc-*} utilities.
+Its associated value is a list of strings (or gexps) pointing to fonts locations.
+
+Generally, it is better to extend this service than to directly
+configure it, as its default value is the default Guix Home's profile
+font installation path (@code{~/.guix-home/profile/share/fonts}).  If you configure this
+service directly, be sure to include the above path.
+
+A typical extension for adding an additional path might look like this:
+
+@lisp
+(simple-service 'additional-fonts-service
+                home-fontconfig-service-type
+                (list "~/.nix-profile/share/fonts"))
+@end lisp
+@end defvr
+
 @node Invoking guix home
 @section Invoking @command{guix home}
 
diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm
index 6062eaed6a..f959ee4fd6 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 @@ (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)
 
   #:export (home-fontconfig-service-type))
 
@@ -33,15 +35,17 @@ (define-module (gnu home services fontutils)
 ;;;
 ;;; Code:
 
-(define (add-fontconfig-config-file he-symlink-path)
+(define (add-fontconfig-config-file paths)
   `(("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 (path)
+                         (string-append "  <dir>" path "</dir>\n"))
+                       paths)
+                "</fontconfig>\n"))))))
 
 (define (regenerate-font-cache-gexp _)
   `(("profile/share/fonts"
@@ -59,7 +63,9 @@ (define home-fontconfig-service-type
                        (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.")))

base-commit: 7efcf36e3b753a1dba6f8208f3c22d151007eaf0
-- 
2.38.1





  reply	other threads:[~2023-01-02 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-02 17:43 [bug#60498] [PATCH] home: services: fontutils: Add service value goodoldpaul--- via Guix-patches via
2023-01-02 17:44 ` Giacomo Leidi via Guix-patches via [this message]
2023-01-31 22:06   ` bug#60498: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230102174451.6827-1-goodoldpaul@autistici.org \
    --to=guix-patches@gnu.org \
    --cc=60498@debbugs.gnu.org \
    --cc=goodoldpaul@autistici.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).