From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.migadu.com ([2001:41d0:2:bcc0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id uGdlOcK4K2MYEgAAbAwnHQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 22 Sep 2022 03:22:11 +0200
Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id 8Bt+OcK4K2NA0AAA9RJhRA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 22 Sep 2022 03:22:10 +0200
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id AFE4A34483
	for <larch@yhetil.org>; Thu, 22 Sep 2022 03:22:10 +0200 (CEST)
Received: from localhost ([::1]:42150 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	id 1obAum-0000NB-V5
	for larch@yhetil.org; Wed, 21 Sep 2022 21:22:08 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:37746)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1obAuh-0000N3-46
 for guix-patches@gnu.org; Wed, 21 Sep 2022 21:22:03 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:36430)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1obAug-0003Kb-S9
 for guix-patches@gnu.org; Wed, 21 Sep 2022 21:22:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1obAug-0005Fm-CB
 for guix-patches@gnu.org; Wed, 21 Sep 2022 21:22:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: [bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig.
References: <20220921002721.23511-1-higashi@taiju.info>
In-Reply-To: <20220921002721.23511-1-higashi@taiju.info>
Resent-From: Taiju HIGASHI <higashi@taiju.info>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: guix-patches@gnu.org
Resent-Date: Thu, 22 Sep 2022 01:22:02 +0000
Resent-Message-ID: <handler.57963.B57963.166380966820134@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 57963
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 57963@debbugs.gnu.org
Cc: Taiju HIGASHI <higashi@taiju.info>
Received: via spool by 57963-submit@debbugs.gnu.org id=B57963.166380966820134
 (code B ref 57963); Thu, 22 Sep 2022 01:22:02 +0000
Received: (at 57963) by debbugs.gnu.org; 22 Sep 2022 01:21:08 +0000
Received: from localhost ([127.0.0.1]:35508 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1obAto-0005Eg-4Q
 for submit@debbugs.gnu.org; Wed, 21 Sep 2022 21:21:08 -0400
Received: from mail-pj1-f52.google.com ([209.85.216.52]:46064)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <higashi@taiju.info>) id 1obAti-0005Dn-Nf
 for 57963@debbugs.gnu.org; Wed, 21 Sep 2022 21:21:06 -0400
Received: by mail-pj1-f52.google.com with SMTP id
 p1-20020a17090a2d8100b0020040a3f75eso570471pjd.4
 for <57963@debbugs.gnu.org>; Wed, 21 Sep 2022 18:21:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=taiju-info.20210112.gappssmtp.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date;
 bh=rIL9alDk/h4IHhW6O2PK1plbXPTTrfvcaPUJzEtmTxE=;
 b=sPqkBmdQooAoaz44YMlb0kShyyS2EwkZzcqoxu7ERsW4wcTJOl41SA65WUc6mwcdKz
 Wdz7olrgs0Yn8P0bgWPTkExH5K4T/oztR7C5i2y/J2pTCXY7DF98Z/YQ2cNoVu5cKJq4
 R2WVZkcQWPBeGdfigjgU9Ym3ypz5WJgBpeU/2FMv3Kh5w5RZiqogXL4H4qqjZCnc+IAB
 vcTIwmcyihNnjrGmJ/KH5tk0rb5HWpbMUF8Vf+UDgStuuDpOHWh8sga/zOcalHKujZx2
 iquntOs/qtBAlG6rZpkBXWNDkwIf8ZVlbpAfCHbeC7vVhfdVdODw3j1tlnGG/AAnzj1H
 Wwtw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date;
 bh=rIL9alDk/h4IHhW6O2PK1plbXPTTrfvcaPUJzEtmTxE=;
 b=D3/3MjmdfWL/5g98WVg5qZTjuy9BbrBs9mWVBWBCw4NgFFWXD/yaglsmogei2GDme9
 KJf8Z5345Qai6K5eESyOmUXz9bWc9dULgsb1TyJXFQQuepM4JjthsY41zemdwtmI+jvY
 Ttk4lqlzT0vPSaUrUIH9U9E7XK1tzKesqQmx0fsMo+MAuHc9JM3z95F6sun4vuawJruA
 088jdexnoUEPe3Gd2EXfFb8VaO/5gW3MWwqMUq/3gckUUIhqZJgT1Pqz/zd/yoUoBPpB
 hOwVf5hW/JepQntKJk4m9tS2KsyAOfivcNRW3RWI5K6eZzalZbHuHDQfXQYqtjJzy8dB
 V6XQ==
X-Gm-Message-State: ACrzQf0MUy7pdyhFQDtyMs1/JVVzGIJQEchWjj76Dj/50twz0kApCZES
 R4Xmw4fGGMUljAi5JaxbDxxTx0t+L9ktWBgf
X-Google-Smtp-Source: AMsMyM5m1XlloRtra3Ivs3sUkakaUq4wqcUhUSHHWDdjOB81uKARIDau5tAPjaI3G9TkH09gD+j2Jg==
X-Received: by 2002:a17:902:b415:b0:178:2835:29e7 with SMTP id
 x21-20020a170902b41500b00178283529e7mr936781plr.86.1663809656469; 
 Wed, 21 Sep 2022 18:20:56 -0700 (PDT)
Received: from Taix.flets-west.jp ([240b:253:ec40:2400:b7d1:436e:2d61:e925])
 by smtp.gmail.com with ESMTPSA id
 d18-20020a170902ced200b001783f964fe3sm2660325plg.113.2022.09.21.18.20.54
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 21 Sep 2022 18:20:55 -0700 (PDT)
From: Taiju HIGASHI <higashi@taiju.info>
Date: Thu, 22 Sep 2022 10:20:33 +0900
Message-Id: <20220922012033.30835-1-higashi@taiju.info>
X-Mailer: git-send-email 2.37.3
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: guix-patches@gnu.org
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-patches>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org
Sender: "Guix-patches" <guix-patches-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
X-Migadu-To: larch@yhetil.org
X-Migadu-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1663809730;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:resent-cc:
	 resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=rIL9alDk/h4IHhW6O2PK1plbXPTTrfvcaPUJzEtmTxE=;
	b=U7GLtbRZQT+cK4/0s+inZX/Nx9FODpqGhLf/x8UA06vUaXm1K6E7NY3THsVq5E+rtTc69s
	qRLIhC6pG+ARvYqfe/c3144Qq74eOwpFl7modEhdb+8bI4QXHByB8DckXlbwmyt0xOT4Z0
	220tSpD0+btbOmapWE9H3EAhwT2jHnNEjWlu+bT5R9Vm3K3A0w9lEAfQ6DYmqxEw9M7Fh6
	6EIXAGbr6SQaaEN8Pk4AgNLP6fvnmDCX1fLF0HF592Mml7jOlQaIrugvrU3sFGGVQKf4LG
	Da/Rhdrec01vaPdkFMj5xM3qXYXNB6wNlu5chABKTcOCFnfPqRqxSiMrE1tg6g==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663809730; a=rsa-sha256; cv=none;
	b=AxNyf9BV/UAsyC/ttNCsbq7/cXauAmhDb8MeLmcsLSn2rBaCYTiaqm1a0kcMSAKLkuo0sw
	m6ECThSwYvStmaH08rWcfLd4PL72MsINxxUq+dHRlvuyTDI5qe5iZqvik6QGr+fd8vOavm
	czy6xEEaWQ7iXQFv9ERvjJtJDx3n6s0gbNdTotD/Qk0KmdzbdZusGcac19OirZB8sBwI3u
	kCkWG/ltuQTnThsk9nO9Yy2f69QN6iJx1FSqGgXhRVa+K4YGIMP933B+u/TPRaY7LG0wMz
	BCI/0B7UoJ2VlWJ+JZ5SC+6aBYnWOOMvMUNHzbMnazSFI8FF4F4K0OhT5oIalw==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b=sPqkBmdQ;
	dmarc=none;
	spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Spam-Score: 3.66
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b=sPqkBmdQ;
	dmarc=none;
	spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Queue-Id: AFE4A34483
X-Spam-Score: 3.66
X-Migadu-Scanner: scn1.migadu.com
X-TUID: Tg6aF4r4McWZ

* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Support user's
fontconfig.
---
 gnu/home/services/fontutils.scm | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm
index 6062eaed6a..b57cccbaae 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 © 2022 Taiju HIGASHI <higashi@taiju.info>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,9 @@ (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 (sxml simple)
+  #:use-module (ice-9 match)
 
   #:export (home-fontconfig-service-type))
 
@@ -33,15 +37,28 @@ (define-module (gnu home services fontutils)
 ;;;
 ;;; Code:
 
-(define (add-fontconfig-config-file he-symlink-path)
+(define (parse-extra-user-config extra-user-config)
+  (map (match-lambda
+         ((? pair? sxml) sxml)
+         ((? string? xml) (xml->sxml xml))
+         (_ (error "extra-user-config must be xml string or sxml.")))
+       extra-user-config))
+
+(define (add-fontconfig-config-file extra-user-config)
   `(("fontconfig/fonts.conf"
      ,(mixed-text-file
        "fonts.conf"
        "<?xml version='1.0'?>
 <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
-<fontconfig>
-  <dir>~/.guix-home/profile/share/fonts</dir>
-</fontconfig>"))))
+"
+       (call-with-output-string
+         (lambda (port)
+           (sxml->xml
+            `(fontconfig
+              (dir "~/.guix-home/profile/share/fonts")
+              ,@(parse-extra-user-config extra-user-config))
+            port)
+           (newline port)))))))
 
 (define (regenerate-font-cache-gexp _)
   `(("profile/share/fonts"
@@ -49,6 +66,8 @@ (define (regenerate-font-cache-gexp _)
 
 (define home-fontconfig-service-type
   (service-type (name 'home-fontconfig)
+                (compose concatenate)
+                (extend append)
                 (extensions
                  (list (service-extension
                         home-xdg-configuration-files-service-type
@@ -59,7 +78,7 @@ (define home-fontconfig-service-type
                        (service-extension
                         home-profile-service-type
                         (const (list fontconfig)))))
-                (default-value #f)
+                (default-value '())
                 (description
                  "Provides configuration file for fontconfig and make
 fc-* utilities aware of font packages installed in Guix Home's profile.")))
-- 
2.37.3