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:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id OBxTK38yLGMEpQAAbAwnHQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 22 Sep 2022 12:01:35 +0200
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id mP9pK38yLGMeZAAA9RJhRA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 22 Sep 2022 12:01:35 +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 4599B2DDF1
	for <larch@yhetil.org>; Thu, 22 Sep 2022 12:01:35 +0200 (CEST)
Received: from localhost ([::1]:60798 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 1obJ1R-0003Tv-SE
	for larch@yhetil.org; Thu, 22 Sep 2022 06:01:33 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:44794)
 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 1obIrG-000551-LD
 for guix-patches@gnu.org; Thu, 22 Sep 2022 05:51:03 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:37366)
 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 1obIrG-0005Af-Co
 for guix-patches@gnu.org; Thu, 22 Sep 2022 05:51:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1obIrG-0002Zv-3Q
 for guix-patches@gnu.org; Thu, 22 Sep 2022 05:51:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: [bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig.
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 09:51:02 +0000
Resent-Message-ID: <handler.57963.B57963.16638402509893@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: Andrew Tropin <andrew@trop.in>,
 Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
Cc: 57963@debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@gmail.com>
Received: via spool by 57963-submit@debbugs.gnu.org id=B57963.16638402509893
 (code B ref 57963); Thu, 22 Sep 2022 09:51:02 +0000
Received: (at 57963) by debbugs.gnu.org; 22 Sep 2022 09:50:50 +0000
Received: from localhost ([127.0.0.1]:36444 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1obIr3-0002ZV-PY
 for submit@debbugs.gnu.org; Thu, 22 Sep 2022 05:50:50 -0400
Received: from mail-pg1-f181.google.com ([209.85.215.181]:39816)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <higashi@taiju.info>) id 1obIr1-0002ZI-Ug
 for 57963@debbugs.gnu.org; Thu, 22 Sep 2022 05:50:48 -0400
Received: by mail-pg1-f181.google.com with SMTP id b5so456293pgb.6
 for <57963@debbugs.gnu.org>; Thu, 22 Sep 2022 02:50:47 -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; bh=D4dvu1qaCqOjxj8BT9V6pcem4rjBEAy8fTV5CM4Ttgk=;
 b=pN+FlG0Q3Ov1/1BQFUodRYkWYC+8pcSa9roETY8CaXc43IrUvNgQ8C54sxSB0Xd4Ll
 QA1Wt2dfGyTiZMRhhLshunjsdJ8AswIlv/wHsf41uyHp1oCsAxilaTSIYc8qRPPMiZqK
 NXRi5DtqHtLj0Yi8c2k2BguYEgFcYPyTCV6LC3Ce+WhnRJ+zahPzVscakjHEMQE59UZn
 NypZFf5s1hZw7k5KvwDP+s7mgAwhBNG74U3ci6PFeF7f7Rn7TxaHfWvjpsQJyVwLMxM/
 hGKioSHna3nr6dMGOk4PO2tR4dnZOf+HsuUBzqvPyFyBJLugFN2E/SvvH8klx7nWiWLs
 KW0Q==
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;
 bh=D4dvu1qaCqOjxj8BT9V6pcem4rjBEAy8fTV5CM4Ttgk=;
 b=O7mDF42o8HbgQlW/rQSboPnVTNF7+Jb2Z+zWzfnlEH4n4XJmEspEFhiAHfvrEtJaJ0
 o5JLqRX9hmd7U+Ii52STJTPaId3ldbDNX0hzwm4n1ZBzioUHC+1UZstSvHH5+rPVGXSh
 DvxHF9XPNhuvU/d5Jsbul6d7kcsLgbkzqoFux7CxmYMYm4cuYucdOo/zF78SO61cltY9
 OdDDbhlitRCLJcOQnk1xDRrPitZx1hmsh/kPPHjiKWpdt3bSpLikcwmfcpEHVHU1P986
 Eoses1gc2JzpQqioEL99j927Nj9neAcdILgSarcKTDDGLU5YlLsvwRlwFoYqk7CTIHsQ
 XSmA==
X-Gm-Message-State: ACrzQf0qoAKkrtnG2KkLPAEm643kXSYqAIQXEoAD/1ZllJVRkGhhloyt
 cXpcBYW3ThRbLzxi/aqQ8mo5yg==
X-Google-Smtp-Source: AMsMyM56d4Ew7WgBqM20m0MtfLSFX5NDtHAFJyhLKT/srOMPS2Mtg/mEaL0YtCj2idFF7odDs+h7sw==
X-Received: by 2002:a63:ff5a:0:b0:42c:61f:b81 with SMTP id
 s26-20020a63ff5a000000b0042c061f0b81mr2308403pgk.254.1663840242001; 
 Thu, 22 Sep 2022 02:50:42 -0700 (PDT)
Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925])
 by smtp.gmail.com with ESMTPSA id
 17-20020a170902e9d100b001755e4278a6sm3549521plk.261.2022.09.22.02.50.40
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 22 Sep 2022 02:50:41 -0700 (PDT)
From: Taiju HIGASHI <higashi@taiju.info>
References: <20220921002721.23511-1-higashi@taiju.info>
 <20220922012033.30835-1-higashi@taiju.info> <87pmfoq6kt.fsf@trop.in>
 <87sfkjiyck.fsf@gnu.org>
Date: Thu, 22 Sep 2022 18:50:38 +0900
In-Reply-To: <87sfkjiyck.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s
 message of "Thu, 22 Sep 2022 10:53:47 +0200")
Message-ID: <875yhfwxe9.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-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=1663840895;
	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=D4dvu1qaCqOjxj8BT9V6pcem4rjBEAy8fTV5CM4Ttgk=;
	b=V4Z082JCCGUBYAVrg923vHs3dBiBAMDSZjNu7im6yMU1CcyDXGWHFzXaLGv0tijzwvFaVx
	FrfDXKitrofB70iVE9isOYptspYzPBiXh7/TzGMHputn3JfhTpNiFuv6INCqK66pZmuFzs
	6dOI+cUUeJpGAXSSNR/dM/IMqLr1EW4hgwPqpj7BfMkQJvunN2ts2xHLEoqH6vPUxxr3Kd
	uhqzRWPtLbVW4Ggq77+VAKJNe4CLkNZbu62FARjn17P+UulL3IEe1cOsskne82pzCQnAhA
	O6CQ5i45KAd2HINVJZeZlIS3fEXEqrHCgxbLQxcUO+Poj2vAlG6kwhCakTtEGg==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663840895; a=rsa-sha256; cv=none;
	b=WSkBaKT99VTQ+f8fK6yH9oX3L9Fx8NaBjISPOX0mFVNbJ4WiSZteKyXNnj1miRvpbAXJ5l
	6HO4afiD6s+QDCfqVIDvr7DnFEeUEzE14XRUeQaMfsKVHYxR4fQiLbr5mWfODrvu0HPEM4
	+w2c43GBC/p1ztiU5SG20K7oRa3TtMQsuvGaJZxGCT3XQ6E2ibE/Opw/PMd1BF6+H+Wk02
	CqI86HAOGF5nBtCK85DYlS6CsaKCpZmTqQmJs4VWYQHv+robfyzsJk73o2HP7emPVBblSy
	VmivhH+UoNPXjXYDU0w66Gv2szae3i486Sq2bIJGtnc6D0dQjeLK3MSqjDugew==
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=pN+FlG0Q;
	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=pN+FlG0Q;
	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: 4599B2DDF1
X-Spam-Score: 3.66
X-Migadu-Scanner: scn1.migadu.com
X-TUID: dPBFAhxUO/7m

Hi Andrew and Ludovic,

Thanks for your input and background on the code style.

I'm not very knowledgeable about G-Expressions, so I don't understand
much of what you replied. (I will study it!).

Ludovic Court=C3=A8s <ludo@gnu.org> writes:

> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> skribis:
>
>> 2. We had a discussion with Ludovic about rde home services vs guix home
>> services styles.  And this one looks like rde style, not guix.
>>
>> rde takes arbitrary s-exps and g-exps with optional structure checks and
>> serializes them to target format.
>>
>> guix uses nested records with rigid nesting structure.
>
> That=E2=80=99s generally true, but it=E2=80=99s not black and white and t=
here=E2=80=99s room for
> discussion.  :-)
>
> In this case, Taiju=E2=80=99s proposal is to let users write snippets lik=
e this:
>
>     (define font-family-map
>       '((sans-serif . "Noto Sans CJK JP")
>         (serif . "Noto Serif CJK JP")))
>
>     (home-environment
>      (packages (list font-google-noto))
>      (services
>       (list
>        (simple-service 'my-fontconfig-service
>                        home-fontconfig-service-type
>                        (list
>                         (call-with-output-string
>                           (lambda (port)
>                             (sxml->xml
>                              (map (lambda (pair)
>                                     `(alias
>                                       (family ,(car pair))
>                                       (prefer
>                                        (family ,(cdr pair)))))
>                                   font-family-map)
>                              port))))))))
>
> (With v2 they=E2=80=99d provide SXML instead of XML-in-a-string, so it=E2=
=80=99s
> slightly less verbose but quite similar.)
>
> In this particular case, I would find it easier to use if one could
> provide a set of <font-alias> records, let=E2=80=99s say along these line=
s:
>
>   (simple-service 'my-fontconfig-service
>                   home-fontconfig-service-type
>                   (list (font-alias 'sans-serif "Noto Sans CJK JP") =E2=
=80=A6))
>
> That way, users wouldn=E2=80=99t need to know the details of the XML synt=
ax for
> fontconfig.
>
> The downside is that it restricts what can be done: it lets you add font
> aliases, but nothing more.
>
> Do you have other use cases in mind, Taiju?

My motivation for writing this patch is that I wanted to continue to use
the settings in the following file after switching to Guix Home.

https://git.sr.ht/~taiju/taix/tree/31a37c231ebba60e38f7fa9cfe1c7a5d7362d021=
/item/dotfiles/fontconfig/.config/fontconfig/fonts.conf

Honestly, I don't know why it is so complicated, but I refered it from
the following ArchWiki content.

https://wiki.archlinux.org/title/Font_configuration/Examples#Japanese

Therefore, just being able to set font aliasing is unfortunately not
enough to satisfy my use case.

Thanks,
--
Taiju