From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 EHmGGG+6K2OyKwAAbAwnHQ (envelope-from ) for ; Thu, 22 Sep 2022 03:29:19 +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 EFqgGG+6K2MaiQAA9RJhRA (envelope-from ) for ; Thu, 22 Sep 2022 03:29:19 +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 0D7821071B for ; Thu, 22 Sep 2022 03:29:19 +0200 (CEST) Received: from localhost ([::1]:41222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obB1i-0002eH-6F for larch@yhetil.org; Wed, 21 Sep 2022 21:29:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obB1U-0002e9-9w for guix-patches@gnu.org; Wed, 21 Sep 2022 21:29:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obB1S-0005SO-6H for guix-patches@gnu.org; Wed, 21 Sep 2022 21:29:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obB1R-0005R8-Rz for guix-patches@gnu.org; Wed, 21 Sep 2022 21:29:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57963] [PATCH 1/1] home: fontutils: Support user's fontconfig. Resent-From: Taiju HIGASHI Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 22 Sep 2022 01:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57963 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 57963@debbugs.gnu.org Received: via spool by 57963-submit@debbugs.gnu.org id=B57963.166381009020840 (code B ref 57963); Thu, 22 Sep 2022 01:29:01 +0000 Received: (at 57963) by debbugs.gnu.org; 22 Sep 2022 01:28:10 +0000 Received: from localhost ([127.0.0.1]:35523 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obB0c-0005Q4-46 for submit@debbugs.gnu.org; Wed, 21 Sep 2022 21:28:10 -0400 Received: from mail-pg1-f179.google.com ([209.85.215.179]:47048) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obB0Y-0005PX-P9 for 57963@debbugs.gnu.org; Wed, 21 Sep 2022 21:28:07 -0400 Received: by mail-pg1-f179.google.com with SMTP id 78so7652300pgb.13 for <57963@debbugs.gnu.org>; Wed, 21 Sep 2022 18:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date; bh=z1f3JQHwL3jgd/0xICnyBF+2/k9bcuH1wojBbH9YdLs=; b=0YqYpt1x3GtLaSEKV4eZTmzwtte5J3on1gZqiLB5IRDk4U7LO6KJk7hTkyUaUfOOuN 2ldSFMqoajGc9NfVKQtEXD5vzZZrrinMApEbgXD18WbbJAI1Vje+xTywsBA1T+OKv1sj qmwcZsQ2PwzIzLl3INd86yi/nMJ8Pqt7OLQ97QhVW6hItJFPDkv2j7jSDTl5CVtV96YH Iav/eOhPS5lYq1p9JhcKpZ8Hh8nMODg+zaXSC0G56tjIlxxYamgXsVqwhyIw1DTNUHZm 1DGKnzNv9gGrE8Dr294p8XrUspgfPlRieDYpbmSULSmy8sclJR3Ti4ERi6N6JMrBHMee iaHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=z1f3JQHwL3jgd/0xICnyBF+2/k9bcuH1wojBbH9YdLs=; b=AynDcsDby1CqpGJ/wGxgRa5x697DnF6OPwGa5Cj21Nm42PBEf5GOpy1lyiCVjr2/DA v1a0xgngv4CwvqnofmjAT+zzt5cFR7IAghjhFEATavUJg3lH+cDyqSQKCsRO4NOMmxsR ebtyackDf+FuckiPjY2T8s1kLd8K4/5df13N0EO2vt9idyhfd7T1eW3J5zjaQCkT9Rm9 6EkxD8qHigYpvDOytkp316/n7GHWkVkl8GRUW0WaixOZrawUc1AQNnZYNkDwvnMi6Yu7 yIDax5V4p5ZoWVUjOX8cBF5rDIjVDoIP4ja3XSMLFNqfWEC7PvffQ+xfbDcO6kg96Tyh H+Yw== X-Gm-Message-State: ACrzQf28E9TIo7zpYa7zE69J1VIPgAAhSwmx4Gd16arnuwidFaGrh41Y Zaek6MjJKevNmEIzpjDw7tqx+mTxT5UTrTLc X-Google-Smtp-Source: AMsMyM7IVZqZDqnl8zNxK9/6udqK5QhWe5GMQ7KBundRDHM1AMVKdF2CZksFS1OvchaldycL6VdPoQ== X-Received: by 2002:a63:f806:0:b0:439:d86e:1f6e with SMTP id n6-20020a63f806000000b00439d86e1f6emr934541pgh.46.1663810080630; Wed, 21 Sep 2022 18:28:00 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id b15-20020a63d30f000000b004393cb720afsm2583462pgg.38.2022.09.21.18.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 18:28:00 -0700 (PDT) From: Taiju HIGASHI References: <20220921002921.23631-2-higashi@taiju.info> <871qs5xd30.fsf@taiju.info> <65da0cdb245fe2bcd99589d4fb1a9eb785a1b527.camel@ist.tugraz.at> Date: Thu, 22 Sep 2022 10:27:56 +0900 In-Reply-To: <65da0cdb245fe2bcd99589d4fb1a9eb785a1b527.camel@ist.tugraz.at> (Liliana Marie Prikler's message of "Wed, 21 Sep 2022 13:40:14 +0200") Message-ID: <87leqcw63n.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" 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=1663810159; 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: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=z1f3JQHwL3jgd/0xICnyBF+2/k9bcuH1wojBbH9YdLs=; b=PegkEHM6Eojnb7REP2d28wjmvsSkXGIC8Adolb/z9hdi7OjDv3s1ZAncbRPJ9eIsV0UnCI K1fK0zTo+XNOWG4hFJYlPSNdskml+ShLtAn4fnPFRiZie+4OY3SlRJpNxt7fHPvAZ8BqnI y0/62vHItLDn3eEjlgCvy1vU0l4ZLv55dEy1PvBbV7tHrOsff5WsWaPaUFw5XLE+boy0h+ OawTJyzXmAvmXzVEFqOYf+n5oFyLKVD9MERf2U987FLBRy4tq4SptERlwWgBnS3su+okr+ sBoWtCk6Htum7A9BqGy5R/GRYxlCIqPhUOUSXuZh+S+ErPBy4ZPQoTmABs2gBA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663810159; a=rsa-sha256; cv=none; b=WxiplIb/7E9RRYfBhMk79dWvYny5Uraz0Ce2HPWST8JHEsijngKFx0F7wHt0v0b2NP1mvl 9zjFgVgYvjzjUIiLvBW4fqubLc4O32ikGktAd/3frSS6TnUDmmoZYv2q2Qw+aqrGecwTxP NLNFMnkwfw9u124bJGnA3J9yhJ8mTpjNgMH2FJd4tm/w483RmRbUpFX4GErg/EYCmSucXV xaUPCQHnGkuSkJNkQq2W2WewD5H9rx7H+e/Gb1k9zvqY/5fS8X4Tfj0pOHI3lhKJhsctXp FqtTzEC3yYkttEavR5BFKN8JDRPoEFlCRG8Cmq6tImXb+W+3nSiz8jPkf/Mc1A== 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=0YqYpt1x; 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: 2.66 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b=0YqYpt1x; 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: 0D7821071B X-Spam-Score: 2.66 X-Migadu-Scanner: scn1.migadu.com X-TUID: HAARFQ74wahd --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Liliana Marie Prikler writes: > Am Mittwoch, dem 21.09.2022 um 18:59 +0900 schrieb Taiju HIGASHI: >> Hi Liliana, >> >> Thank you for your review. >> >> > > -(define (add-fontconfig-config-file he-symlink-path) >> > > +(define (add-fontconfig-config-file font-config) >> > > =A0=A0 `(("fontconfig/fonts.conf" >> > > =A0=A0=A0=A0=A0 ,(mixed-text-file >> > > =A0=A0=A0=A0=A0=A0=A0 "fonts.conf" >> > > =A0=A0=A0=A0=A0=A0=A0 " >> > > =A0 >> > > =A0 >> > > -=A0 ~/.guix-home/profile/share/fonts >> > > -")))) >> > > +=A0 ~/.guix-home/profile/share/fonts\n" >> > > +=A0=A0=A0=A0=A0=A0 (if (null? font-config) >> > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "" >> > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (string-join font-config "\n" 'suffi= x)) >> > > +=A0=A0=A0=A0=A0=A0 "\n")))) >> > I think it'd be wiser to pretty-print SXML here. >> > The structure could look something like >> > `(fontconfig >> > =A0=A0 (dir "~/.guix-home/profile/share/fonts") >> > =A0=A0 ,@(extra-user-config ...)) >> >> That's definitely better! >> Does this assume that SXML will also accept additional user settings? > It assumes that whatever (extra-user-config ...) does, it returns a > list of SXML nodes, e.g. ((dir "~/.fonts")). Writing correct SXML > should be comparatively simpler to writing correct XML. I just sent you the v2 patch. It uses SXML to handle the user's extra configs. I also made it so that the user can pass SXML directly. I also wrote a test but did not include it in the patch because I thought it would be a technical debt. I'm attaching that as a reference. --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=fontutils.scm Content-Transfer-Encoding: quoted-printable Content-Description: tests/home-services/fontutils.scm ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =A9 2022 Taiju HIGASHI ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (test-home-services-fontutils) #:use-module (gnu services) #:use-module (gnu home services) #:use-module (gnu home services fontutils) #:use-module (guix tests) #:use-module (sxml simple) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64)) ;; or (@@ (gnu home services fontutils) add-fontconfig-config-file) (define add-fontconfig-config-file (let* ((extensions (service-type-extensions home-fontconfig-service-type)) (extension (find (lambda (ext) (eq? (service-extension-target ext) home-xdg-configuration-files-service-type)) extensions)) (compute (service-extension-compute extension))) compute)) (define (assert-fontconfig-value value expected) (mock ((guix gexp) mixed-text-file (lambda* (name #:key guile #:rest text) (let ((text (string-join text ""))) (unless (string=3D text expected) (error "assert failed. actual: %s" text))))) (add-fontconfig-config-file value) #t)) (test-begin "home-services-fontutils") (test-assert "fontconfig (default value)" (assert-fontconfig-value '() "\ ~/.guix-home/profile/share/fonts ")) (test-assert "fontconfig (a text)" (assert-fontconfig-value '("foo") "\ ~/.guix-home/profile/share/fontsfoo ")) (test-assert "fontconfig (multiple texts)" (assert-fontconfig-value '("foo" "baz") = "\ ~/.guix-home/profile/share/fontsfoo<= baz>baz ")) (test-assert "fontconfig (a sxml)" (assert-fontconfig-value '((foo foo)) "\ ~/.guix-home/profile/share/fontsfoo ")) (test-assert "fontconfig (multiple sxml)" (assert-fontconfig-value '((foo foo) (bar (baz baz))) "\ ~/.guix-home/profile/share/fontsfoo<= baz>baz ")) (test-error "fontconfig (invalid value)" (add-fontconfig-config-file '(123))) (test-end "home-services-fontutils") --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable >> > Also, for the particular use case of handling multiple profiles >> > gracefully (rather than the current status quo) I think fontconfig- >> > service-type should be able to construct (dir >> > "#$profile/share/fonts") style entries on its own.=A0 However, given >> > that multiple profiles aren't supported yet, this is future work. >> >> Noted. I believe that even with the current patch, it is possible to >> add arbitrary directories, so it will be better than what we have >> now. > That's fine, just know that this use case might at some point become > obsolete thanks to a better implementation :) No problem. I would like to solve the current problem first. A better implementation is always welcome :) Cheers --=20 taiju --=-=-=--