From patchwork Mon Jan 2 17:44:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Giacomo Leidi X-Patchwork-Id: 45807 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1A33227BBED; Mon, 2 Jan 2023 17:46:30 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B70FE27BBE9 for ; Mon, 2 Jan 2023 17:46:27 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCOsu-0007H7-VC; Mon, 02 Jan 2023 12:46:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCOst-0007Gr-AG for guix-patches@gnu.org; Mon, 02 Jan 2023 12:46:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pCOss-0004yM-NC for guix-patches@gnu.org; Mon, 02 Jan 2023 12:46:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pCOss-0004HR-Ht for guix-patches@gnu.org; Mon, 02 Jan 2023 12:46:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60498] [PATCH] home: services: fontutils: Add service value. References: <3c0e43334aab599678ddeee842c073ee@autistici.org> In-Reply-To: <3c0e43334aab599678ddeee842c073ee@autistici.org> Resent-From: Giacomo Leidi Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 Jan 2023 17:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60498 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60498@debbugs.gnu.org Cc: Giacomo Leidi Received: via spool by 60498-submit@debbugs.gnu.org id=B60498.167268152216399 (code B ref 60498); Mon, 02 Jan 2023 17:46:02 +0000 Received: (at 60498) by debbugs.gnu.org; 2 Jan 2023 17:45:22 +0000 Received: from localhost ([127.0.0.1]:43986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOry-0004G6-UV for submit@debbugs.gnu.org; Mon, 02 Jan 2023 12:45:22 -0500 Received: from confino.investici.org ([93.190.126.19]:36061) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pCOrw-0004Fu-6b for 60498@debbugs.gnu.org; Mon, 02 Jan 2023 12:45:05 -0500 Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4Nm3Cx4db1z10ww; Mon, 2 Jan 2023 17:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1672681501; bh=i3ET5w9nIvh9zCbeTi7ECFmtyIbq3VVddT0dgccqug4=; h=From:To:Cc:Subject:Date:From; b=U1IJqMRPGC0boe3NE1Fy1lOLi9nsvOJ60JMoU5V5IJ7SWPfDEA5EfSaonIu/CbYsg KGBoMFtnCUh1nnQsoKzuQ21jbyE7d609RTtaVkA4e38waPa4UxP2M01kV68+Q7DYld 9+ziu7zAgcNMBdXy846dfOHy2TMAQFR+2LFWd2cw= Received: from [93.190.126.19] (mx1.investici.org [93.190.126.19]) (Authenticated sender: goodoldpaul@autistici.org) by localhost (Postfix) with ESMTPSA id 4Nm3Cx46rSz10sk; Mon, 2 Jan 2023 17:45:01 +0000 (UTC) Date: Mon, 2 Jan 2023 18:44:51 +0100 Message-Id: <20230102174451.6827-1-goodoldpaul@autistici.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Giacomo Leidi X-ACL-Warn: , Giacomo Leidi via Guix-patches X-Patchwork-Original-From: Giacomo Leidi via Guix-patches via From: Giacomo Leidi Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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(-) base-commit: 7efcf36e3b753a1dba6f8208f3c22d151007eaf0 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 ;;; Copyright © 2021 Xinglu Chen +;;; Copyright © 2023 Giacomo Leidi ;;; ;;; 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" - " + (apply string-append + `(" - - ~/.guix-home/profile/share/fonts -")))) +\n" ,@(map (lambda (path) + (string-append " " path "\n")) + paths) + "\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.")))