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:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id +D1wE6tvUGMnxwAAbAwnHQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 19 Oct 2022 23:44:11 +0200
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id +JuKE6tvUGPFCQEA9RJhRA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 19 Oct 2022 23:44:11 +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 1963FB571
	for <larch@yhetil.org>; Wed, 19 Oct 2022 23:44:11 +0200 (CEST)
Received: from localhost ([::1]:41480 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 1olGrB-0007zH-7j
	for larch@yhetil.org; Wed, 19 Oct 2022 17:44:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56512)
 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 1olGr4-0007z8-Sy
 for guix-patches@gnu.org; Wed, 19 Oct 2022 17:44:02 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:33031)
 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 1olGr4-00088x-Gh
 for guix-patches@gnu.org; Wed, 19 Oct 2022 17:44:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1olGr4-000671-43
 for guix-patches@gnu.org; Wed, 19 Oct 2022 17:44:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig
 configuration.
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: Wed, 19 Oct 2022 21:44:02 +0000
Resent-Message-ID: <handler.57963.B57963.166621578723426@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: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
Cc: 57963@debbugs.gnu.org, liliana.prikler@gmail.com,
 Andrew Tropin <andrew@trop.in>
Received: via spool by 57963-submit@debbugs.gnu.org id=B57963.166621578723426
 (code B ref 57963); Wed, 19 Oct 2022 21:44:02 +0000
Received: (at 57963) by debbugs.gnu.org; 19 Oct 2022 21:43:07 +0000
Received: from localhost ([127.0.0.1]:60342 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1olGqB-00065m-Aw
 for submit@debbugs.gnu.org; Wed, 19 Oct 2022 17:43:07 -0400
Received: from mail-pj1-f51.google.com ([209.85.216.51]:38467)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <higashi@taiju.info>) id 1olGq8-00065F-0B
 for 57963@debbugs.gnu.org; Wed, 19 Oct 2022 17:43:05 -0400
Received: by mail-pj1-f51.google.com with SMTP id
 x1-20020a17090ab00100b001fda21bbc90so1415414pjq.3
 for <57963@debbugs.gnu.org>; Wed, 19 Oct 2022 14:43:03 -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:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=PBt6NNu370LE2hoa4egU1qFcz9IOeYi0kVik7iOLTsc=;
 b=MCafOlLHZN7eXailGomE7F4LkyWyhMPUkgXt05vVPbsdHzhu2EnOEaSH+/Q51mdJUu
 ANVfUo0XK2v3w1cVxN/ssyvsNNzHSWHfP3aZ+pgUp65SUQF1eaPT0fTqfHfX12QGrO5P
 Uk2BV2L3qACUKD6XPqVh+D6xHj3wy1BQuMuoaeygsBKMZReCa7Siz0SRUHI1pcrSymWc
 4RdyjrQ6b62x2XQW/xrvr4klDmU1fbCM0UhEJBrPN2ru2d1xrIhb3vR+MOWyP1oCa9Rp
 1vCQ7yPnBoRSBU5U6juKzumwYDBg2sJdK5usvCZ3JVZMfaxw11LbG1qzqdzNL7+LgXtZ
 65fg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:user-agent:message-id
 :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=PBt6NNu370LE2hoa4egU1qFcz9IOeYi0kVik7iOLTsc=;
 b=JKAnTyZwW7L6thUcBN5L+O7OFnUIy+O0nAKvwv++VXs6XlvKkV8fnTHg8qWKSS4fBb
 lR8Hkr5EFnhNh4Hx7Keh6KJ1yYSNU9V48aVLJ157qSPvGh37ULLCzVSZQu+0FImZpi6+
 0ezzo/CEBcyAse1oGj1Go2D6W26sM+t+49BPILNaLS4pxef1Z7pCFH7eFDhC0UQ7mCQ8
 5TgoXqjh0qxQ8dz9sZULT/aoPKllXxcxJ7Pj7ZNLM1qEI11Kcfh03HmxvstW+Nm6MnHS
 MuGwNDCvLOLHSspkYNNqdQQA07tYqBdUCf3YcPnZEwjw7gNalalAyCOMwHIiEaEFNt6s
 b9Eg==
X-Gm-Message-State: ACrzQf0OarqSvTnXKLmzBalDtMlTWBWOdDAUlMxjY9vOFfYJk8IuX8ZM
 r4mTsnDA0/JgqsEQJcN+ylaOCg==
X-Google-Smtp-Source: AMsMyM6faeiMTozER6W2CkxDQ9lOyjfDwk901x8anWoEWHWi54+8mr30gTYU7Mn8e1dh+xJyflo/vg==
X-Received: by 2002:a17:90b:4b8b:b0:20d:ac2f:8bb2 with SMTP id
 lr11-20020a17090b4b8b00b0020dac2f8bb2mr38439524pjb.194.1666215777898; 
 Wed, 19 Oct 2022 14:42:57 -0700 (PDT)
Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925])
 by smtp.gmail.com with ESMTPSA id
 b5-20020a170902650500b00179f442519csm11240152plk.40.2022.10.19.14.42.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 19 Oct 2022 14:42:57 -0700 (PDT)
From: Taiju HIGASHI <higashi@taiju.info>
References: <87k053sxur.fsf@gnu.org> <87zgdzat99.fsf@trop.in>
 <87zgdxgx0l.fsf@taiju.info> <875ygiqur9.fsf@gnu.org>
 <87r0z5e23k.fsf@taiju.info>
Date: Thu, 20 Oct 2022 06:42:54 +0900
In-Reply-To: <87r0z5e23k.fsf@taiju.info> (Taiju HIGASHI's message of "Tue, 18
 Oct 2022 21:41:03 +0900")
Message-ID: <87czanebhd.fsf@taiju.info>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
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-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1666215851;
	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=PBt6NNu370LE2hoa4egU1qFcz9IOeYi0kVik7iOLTsc=;
	b=uQMhy/1XsUkMRafQ/YeTi55eBPa2vyrNMTPLksbHxlfe2505i1t2nU/9R2Z/yg+cNH2CHr
	GtmLqrsFLoKNhMk7WhNX71EV/dd8A9vGijZgPuR6lXeCOyjXzP6HiFmUK4f0ilagFtUOkw
	q8l3GTjIuJbMxb4APxBerCnEMvWj71x341R1THvbnJfAQPntp/jMbAYsHZNmFF/k4IptEz
	63IYnaK+ZNu8SQNW3M4sWdvZU9nRczzr0sk2Wte2VwKBg/p0rUqx56Swkh4fTZ0TOtZmWi
	7ryo84XWg171svt8xZWW329iB3m3EnFc3ynIGoAUHB2I8Y35TL3+KcAxBTMPiQ==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666215851; a=rsa-sha256; cv=none;
	b=W6vqVDdLVs7ILKF6jvb03gE7CtTwg2VSSqGnoG8lrY22MxdNbsXqScGcTMBGItb+FKUfkB
	EM7UllG/kUUDu8DQJg4QC5SN92ODVq/ITIN+eQ7Qr9i1F+Ml+d0VRpE+z6vQKCSl3htN9e
	vR7UkLJxGAFystuhVTWKDZio4wBaHSCjcOuUP1Y8HGyyBAgMN+20g36s1YlT/BM3w4Feej
	eEXPfmUgAwLYGavXGlZLSMikXxU1FkTC8ckBnljn6J/fselRNJMI+xu3tpQrHqKEaBg36c
	pF5u1urD+cwER/hAS6cXZ8V4+5Cf+p4GUR8B4NUFZwN265sUc5RHg8N3o7tn+w==
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=MCafOlLH;
	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: 4.08
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b=MCafOlLH;
	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: 1963FB571
X-Spam-Score: 4.08
X-Migadu-Scanner: scn1.migadu.com
X-TUID: TFEP1DPMXoRN

Taiju HIGASHI <higashi@taiju.info> writes:

> Hi,
>
> Ludovic Court=C3=A8s <ludo@gnu.org> writes:
>
>> Hi,
>>
>> Taiju HIGASHI <higashi@taiju.info> skribis:
>>
>>> Andrew Tropin <andrew@trop.in> writes:
>>
>> [...]
>>
>>>>> Andrew Tropin <andrew@trop.in> skribis:
>>>>>
>>>>>> If serialization would support G-exps, we could write
>>>>>>
>>>>>> (list #~"RAW_XML_HERE")
>>>>>
>>>>> There=E2=80=99s a one-to-one lossless mapping between XML and SXML, s=
o I don=E2=80=99t
>>>>> think it makes sense to support XML-in-strings when we have SXML.
>>>>>
>>>>> The only thing it would give us, as I see it, is the ability to gener=
ate
>>>>> syntactically-invalid XML.  Maybe we can live without it?  :-)
>>>>
>>>> Of course we can :), but we won't be able:
>>>>
>>>> 1. To take already existing xml config and use it without rewriting.
>>>
>>> I find it surprisingly important to be able to simply copy and paste
>>> settings without having to rewrite existing settings or those listed on
>>> a web page somewhere.  I know we can easily convert from XML to SXML,
>>> but those unfamiliar with SXML may find it a bothering task.
>>
>> OK, that makes sense.
>>
>> But then, let=E2=80=99s not allow users to intersperse XML-in-strings in=
 the
>> middle of XML.  It should be either a user-provided file/string or the
>> generated config, but not a mixture of both; that=E2=80=99d be a recipe =
for
>> confusion.
>>
>> How about this: the service takes either a <fontconfig-configuration>
>> record or a file-like object?
>>
>> (We can even have a =E2=80=9Cgexp compiler=E2=80=9D for <fontconfig-conf=
iguration> to
>> make that transparent.)
>
> Thank you for your consideration.
>
> That idea sounds good.  I don't know if I can successfully implement
> this, but I will consider it and give it a try.
>
> Thanks,

I'm trying to implement the following, is it consistent with the intent
of what you suggested?

--8<---------------cut here---------------start------------->8---
(define (add-fontconfig-config-file user-config)
  `(("fontconfig/fonts.conf"
     ,(if (home-fontconfig-configuration? user-config)
          (mixed-text-file
           "fonts.conf"
           "<?xml version=3D'1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>"
           (serialize-configuration user-config home-fontconfig-configurati=
on-fields)
           "</fontconfig>\n")
          user-config))))
--8<---------------cut here---------------end--------------->8---

It is assumed that configurations can be specified in one of the
following ways.

* fontconfig-configuration:

--8<---------------cut here---------------start------------->8---
(home-environment
 (packages (list font-google-noto))
 (services
  (append
      (list
       (service home-bash-service-type))
      (modify-services %home-base-services
        (home-fontconfig-service-type
         config =3D> (home-fontconfig-configuration
                    (font-directories
                     (cons* "~/fonts" %home-fontconfig-base-font-directorie=
s))
                    (default-font-serif-family "Noto Serif CJK JP")
                    (default-font-sans-serif-family "Noto Sans Serif CJK JP=
")
                    (default-font-monospace-family "PlemolJP Console")
                    (extra-config
                     '(foo "bar"))))))))
--8<---------------cut here---------------end--------------->8---

Note:
%home-fontconfig-base-font-directories is the new variable I plan to
export as the default value, based on Andrew's and Liliana's point.

* file-like objects:

--8<---------------cut here---------------start------------->8---
(home-environment
 (packages (list font-google-noto))
 (services
  (append
      (list
       (service home-bash-service-type))
      (modify-services %home-base-services
        (home-fontconfig-service-type
         config =3D> (local-file "/path/to/your/fonts.conf"))))))
--8<---------------cut here---------------end--------------->8---

Thanks,
--=20
Taiju