From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp12.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 2p8iMAW8NGMnRgAAbAwnHQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 28 Sep 2022 23:26:29 +0200
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp12.migadu.com with LMTPS
	id EMHwLgW8NGMyJAEAauVa8A
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Wed, 28 Sep 2022 23:26:29 +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 7539813AEE
	for <larch@yhetil.org>; Wed, 28 Sep 2022 23:26:29 +0200 (CEST)
Received: from localhost ([::1]:33440 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 1odeZY-00077t-MM
	for larch@yhetil.org; Wed, 28 Sep 2022 17:26:28 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:48852)
 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 1odePS-0004LF-Ey
 for guix-patches@gnu.org; Wed, 28 Sep 2022 17:16:03 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:35921)
 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 1odePS-00060N-77
 for guix-patches@gnu.org; Wed, 28 Sep 2022 17:16:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1odePS-0004hC-2F
 for guix-patches@gnu.org; Wed, 28 Sep 2022 17:16:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: [bug#57963] [PATCH 0/1] 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: Wed, 28 Sep 2022 21:16:02 +0000
Resent-Message-ID: <handler.57963.B57963.166439971617998@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: Taiju HIGASHI <higashi@taiju.info>
Cc: 57963@debbugs.gnu.org, liliana.prikler@gmail.com, andrew@trop.in
Received: via spool by 57963-submit@debbugs.gnu.org id=B57963.166439971617998
 (code B ref 57963); Wed, 28 Sep 2022 21:16:02 +0000
Received: (at 57963) by debbugs.gnu.org; 28 Sep 2022 21:15:16 +0000
Received: from localhost ([127.0.0.1]:34999 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1odeOh-0004gD-HG
 for submit@debbugs.gnu.org; Wed, 28 Sep 2022 17:15:15 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47984)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@gnu.org>) id 1odeOf-0004fu-BD
 for 57963@debbugs.gnu.org; Wed, 28 Sep 2022 17:15:13 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:37920)
 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 1odeOY-0005oy-BN; Wed, 28 Sep 2022 17:15:06 -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=7IO8r7l+Y09hT+kTG8Dzv9EyqbapE5t1blg7vSPXYxg=; b=cAvUja8/mShVZPERTzD1
 OXeN+sWVd+yQwOOB880WgcVvrBzNf5U4f8SOqnAC+7yeq5XWB6vvafnVgPsw1FMnNzyHcgnzIwUlF
 wkfwzdfhoxdiBfiyPBc1TipgYtGFSD/hH+ZFfVK3ugdpo634JzCNHA1Mu4xGT0l+HdyV9aH8EmgtW
 DwxpRk6e/37PsRn2MsXtHWQ9b226RJzXQC+2bWbORZZe9RG77iX5jlQhsimWvnF2oBWudpnuG6Wpr
 zfGVvWAoBGV00nCG3JkXDFeEGsDOheaHHVaeVxAYOTSFg3Wm+8BkZUAKn8f/witYrshNBSkvdgpzv
 02nXPQHRiv+RKw==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:60091
 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 1odeOX-00064j-Uh; Wed, 28 Sep 2022 17:15:06 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
References: <20220927095525.26431-1-higashi@taiju.info>
 <87bkr1qg9x.fsf@taiju.info>
Date: Wed, 28 Sep 2022 23:15:03 +0200
In-Reply-To: <87bkr1qg9x.fsf@taiju.info> (Taiju HIGASHI's message of "Tue, 27
 Sep 2022 19:10:34 +0900")
Message-ID: <87v8p7dwvc.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-Country: US
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1664400389;
	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=7IO8r7l+Y09hT+kTG8Dzv9EyqbapE5t1blg7vSPXYxg=;
	b=LZvV4mCOco4Ay0xoOCiF3x6gaR5EiJQ4+OQG9GezLOpvix6RG/kNcQtzs4lUksMcAqwG9g
	t8R+B8i+InwdF3rUOfzP2uIXYD4eVW/q8N25wgVKhW30PnMFsA232V9oUFrF1o722+TCyD
	qYNBj74LrQj0fT19smg6DyDbO4mwZ1/XWVjH5edHh1TEsnn22PVIpb8lvTAORAllx9+aY0
	RIwgeRbM5qe8+gB9Pl4mU2zaBuvwx0Pzw4xAHbtgDgawdXsQFMi0t5UGBRK0rBbNGIveu4
	U3YxNh2e8ujxUQSEgpsu3eIp4IGcGh5+DOaj1afTnGeHGrwCDw4TnM0bqNvcPQ==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664400389; a=rsa-sha256; cv=none;
	b=KmE2pKLg4owobJasrdOuYpJ0IzGrQR3zqZcowPMLUOF0pp9qEPdCrg4MqxD//RBWZ7Rld6
	9kwgiKAsiojQBdT/QuGoGOJGCAgCAuRdXcJTV1uhvdsnxCLTAs+LStudp8I3Rz2vd1qhp3
	PRyf/mqKrQrT2TinN7l2fTaAikJqkMWBWy5JDckQEr3NsQqTNq/ZdfvFSekNNH2vWxnKfn
	JW0zr8M5tlaBGIBMyaCi412OVXeQujszA+5RSSvXPdJwiFRkibRLfjE4Ak9eP7b3/n/gOg
	pr5/HcpVhXuYkbkn/1ppKWW6/R7mttF8kNv6cwlFfz4pdblGUW3ZyYxFBEqpsQ==
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="cAvUja8/";
	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: -3.05
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b="cAvUja8/";
	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: 7539813AEE
X-Spam-Score: -3.05
X-Migadu-Scanner: scn0.migadu.com
X-TUID: KxnnacltubWM

Hi,

Taiju HIGASHI <higashi@taiju.info> skribis:

> I just sent you the v3 patch.
>
> I have changed only the interface of `preferred-defalut-font` slightly
> from what I suggested the other day.
>
> We configure the service as follows.
>
>   (simple-service
>     'my-fontconfig-service
>     home-fontconfig-service-type
>     (home-fontconfig-configuration
>      (font-directories
>       (list "~/fonts"))
>      (preferred-default-font
>       (default-font
>         (serif "Noto Serif CJK JP")
>         (sans-serif "Noto Sans CJK JP")
>         (monospace "PlemolJP Console")))
>      (extra-config
>       `((match (@ (target font))
>           (edit (@ (mode assign)
>                    (name antialias))
>                 (bool true)))))))

Looks nicer IMO!

>> +(define (home-fontconfig-extend original-config extend-configs)
>> +  (home-fontconfig-configuration
>> +   (inherit original-config)
>> +   (font-directories
>> +    (append
>> +        (home-fontconfig-configuration-font-directories original-config)
>> +        (append-map home-fontconfig-configuration-font-directories exte=
nd-configs)))
>> +   (preferred-default-font
>> +    (home-fontconfig-configuration-preferred-default-font
>> +     (if (null? extend-configs)
>> +         original-config
>> +         (last extend-configs))))
>
> This is the part I am most concerned about, not sure if replacing the
> preferred-default-font setting with the last setting is the proper way
> to go about it.

It=E2=80=99s unusual for a service to receive extensions that are the full
configuration object of that service.  Because then, indeed, you have to
determine how to =E2=80=9Cmerge=E2=80=9D those configuration objects.

The common patterns that we have are:

  1. The service accepts as extensions things that represent part of its
     configuration and where merging makes sense.

     For example, nginx can be extended with
     <nginx-location-configuration> objects, but not with a full-blown
     <nginx-configuration>.

  2. Similar, but the service has specific records for extensions.

     The example that comes to mind is =E2=80=98home-bash-service-type=E2=
=80=99, which
     accepts <home-bash-extension> records as its extensions.

So=E2=80=A6

I wonder, should we, as a first commit, move
=E2=80=98home-fontconfig-service-type=E2=80=99 out of the essential service=
s to a
=E2=80=98%base-home-services=E2=80=99 variable yet to be defined?

I don=E2=80=99t see any good reason to have it here (=E2=80=9Cessential=E2=
=80=9D services should
be limited to those that may not be replaced or removed; in (gnu
system), this includes services that depend on information available in
<operating-system>).

Once we=E2=80=99ve done that, perhaps we can forget about extensions, at le=
ast
for now, and let users who need to configure things write:

  (modify-services %base-home-services
    (home-fontconfig-service-type
     config =3D> =E2=80=A6))

WDYT?

> I wanted to write a test as well, but since it was to be handled by
> gexp, I could not figure out how to write a test that would validate the
> gexp result using only exported methods. (I would like to write tests
> for serialized functions that are private functions.)

Hmm.

Once we=E2=80=99ve settled on an interface, the commit that makes this chan=
ge
should include an update of doc/guix.texi.

Thanks!

Ludo=E2=80=99.