From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp10.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 kKFVBW8qLGO+wAAAbAwnHQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 22 Sep 2022 11:27: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 mp10.migadu.com with LMTPS
	id CMNnBG8qLGMEOgAAG6o9tA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 22 Sep 2022 11:27: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 B7332224BE
	for <larch@yhetil.org>; Thu, 22 Sep 2022 11:27:10 +0200 (CEST)
Received: from localhost ([::1]:50932 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 1obIU5-0000z1-U9
	for larch@yhetil.org; Thu, 22 Sep 2022 05:27:07 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49848)
 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 1obHy6-0007Fh-T2
 for guix-patches@gnu.org; Thu, 22 Sep 2022 04:54:06 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:37242)
 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 1obHy6-00043e-KG
 for guix-patches@gnu.org; Thu, 22 Sep 2022 04:54:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1obHy6-0007I7-FH
 for guix-patches@gnu.org; Thu, 22 Sep 2022 04:54:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: [bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: guix-patches@gnu.org
Resent-Date: Thu, 22 Sep 2022 08:54:02 +0000
Resent-Message-ID: <handler.57963.B57963.166383683928019@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>, Taiju HIGASHI <higashi@taiju.info>
Cc: 57963@debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@gmail.com>
Received: via spool by 57963-submit@debbugs.gnu.org id=B57963.166383683928019
 (code B ref 57963); Thu, 22 Sep 2022 08:54:02 +0000
Received: (at 57963) by debbugs.gnu.org; 22 Sep 2022 08:53:59 +0000
Received: from localhost ([127.0.0.1]:36320 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1obHy3-0007Hq-H0
 for submit@debbugs.gnu.org; Thu, 22 Sep 2022 04:53:59 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37694)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@gnu.org>) id 1obHy1-0007Hd-Pm
 for 57963@debbugs.gnu.org; Thu, 22 Sep 2022 04:53:59 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:50598)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@gnu.org>)
 id 1obHxu-00041I-WC; Thu, 22 Sep 2022 04:53:51 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=/zlhUtB6Uw9consf16MKCK1Ab7s2tWue51KxkCiGBqY=; b=Ngnsor+Zr67OSdmqRpHN
 Qc4icXZXKE4yJWISCc1ueZpAde3H6abqpTRWDTZlaKspW+eGSgNSOq1RU1Fcx0glxGOItDbs7xFe5
 9cpdk0Is44Lv39USI975F+Ccbus44Z5hNiCh0WKXONt1n7y80ZjG6vBtDuFHfd4UOyp+fQWW9HYW6
 Jjk4sNGJ8SlPQxiOItTMBTLIdbpiHEfl1NVkhoH1ErWt1Xd+X7a0uD8siPumkVDE/6KssgD2emkdf
 AbsnGvf0bJGFWKI8F+TzlrdAsdcCU0DYGSJ0d2OZ5qBimD27lNZMaG0+ydCsdB1Yr02HLlymqJG3c
 9hUwMTOrzQV5fQ==;
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=57702 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@gnu.org>)
 id 1obHxu-0007Hu-Hz; Thu, 22 Sep 2022 04:53:50 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
References: <20220921002721.23511-1-higashi@taiju.info>
 <20220922012033.30835-1-higashi@taiju.info> <87pmfoq6kt.fsf@trop.in>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: Primidi 1 =?UTF-8?Q?Vend=C3=A9miaire?= an 231 de la
 =?UTF-8?Q?R=C3=A9volution,?= jour du Raisin
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 22 Sep 2022 10:53:47 +0200
In-Reply-To: <87pmfoq6kt.fsf@trop.in> (Andrew Tropin's message of "Thu, 22 Sep
 2022 09:14:10 +0300")
Message-ID: <87sfkjiyck.fsf@gnu.org>
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=1663838830;
	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=/zlhUtB6Uw9consf16MKCK1Ab7s2tWue51KxkCiGBqY=;
	b=YZYHMRLsryE2wLqG4HorJsbU7WZGb5bLRhw1VjhNlN3DlrXAbNdq7wUQJC6LkxMn/j/BjT
	z4uAv4zVlsCV5ASGhWpmmnaGQA2mlaI5896Y3UFzZJUIkZWymL3hzi4CJh87pQVR1dhu0v
	Dl6rRD2Jkife1i+dlai5zm929u1PgwUxxDEqu/9EcWpjqCv10woyeVHjrZwtEC57KZcVDJ
	NYBwxKGc2WoENjsA0fIAAh2IvaS/xon4XYDmp13Ht4JxUioyKeUElyDLzerIfcOxHoUO1C
	EdEQ5UHdiwyyazKr2TdAcwoiQpTqAT7jki0BI0w6aI4b1XNRMr6lfQ95u95HpA==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663838830; a=rsa-sha256; cv=none;
	b=TilUMX5p01lVKK0GrKkgNfK//JHFwnu3wKU0BHRGj5sbOH9KEABUU3+i6DtH976Y9YPqt5
	IiTlX/orNMa+MTR/otH4yDVGrHdxxPUiM8HtozfziqUwpXjvzzYV+hGQ3JPYpLTZCjydpn
	w2O7WDz8EywS4hs63Xh+FxSWk+O+5LFgExZWJsuSiOTQ/NVNm02Mv8kZ57LVJRQb3rAs+8
	zTX5hIVtaAJD09oCPI6BimgZuR/pD1N8B7rM/lsWHfG4kLt0iauTpSi4IvXYVenIOHxc9J
	vAiLQLtM6OHFzfoYo6r5tzBFkwV0kbaGUF4YLbF1SlwoAAmWW7GDWzyPWWtRgg==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Ngnsor+Z;
	dmarc=pass (policy=none) header.from=gnu.org;
	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: -2.24
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Ngnsor+Z;
	dmarc=pass (policy=none) header.from=gnu.org;
	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: B7332224BE
X-Spam-Score: -2.24
X-Migadu-Scanner: scn1.migadu.com
X-TUID: 9FjWveicSnCz

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 the=
re=E2=80=99s room for
discussion.  :-)

In this case, Taiju=E2=80=99s proposal is to let users write snippets like =
this:

--8<---------------cut here---------------start------------->8---
    (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))))))))
--8<---------------cut here---------------end--------------->8---

(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 lines:

  (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 syntax=
 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?

Thanks,
Ludo=E2=80=99.