Package: guix-patches;
Reported by: Taiju HIGASHI <higashi <at> taiju.info>
Date: Wed, 21 Sep 2022 00:28:02 UTC
Severity: normal
Tags: patch
To reply to this bug, email your comments to 57963 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 21 Sep 2022 00:28:02 GMT) Full text and rfc822 format available.Taiju HIGASHI <higashi <at> taiju.info>
:guix-patches <at> gnu.org
.
(Wed, 21 Sep 2022 00:28:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: guix-patches <at> gnu.org Cc: Taiju HIGASHI <higashi <at> taiju.info> Subject: [PATCH 0/1] Support user's fontconfig. Date: Wed, 21 Sep 2022 09:27:20 +0900
Hi, I want to add custom fontconfig, so I've implemented the ability of custom font configuration to fontutils. It allows us to set up our fontconfig as follows. (home-environment (packages (list font-google-noto)) (services (list (simple-service 'my-fontconfig-service home-fontconfig-service-type (list "<alias> <family>sans-serif</family> <prefer> <family>Noto Sans CJK JP</family> </prefer> </alias>" "<alias> <family>sans-serif</family> <prefer> <family>Noto Serif CJK JP</family> </prefer> </alias>"))))) Of course, we can also use SXML! (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)))))))) Taiju HIGASHI (1): home: fontutils: Support user's fontconfig. gnu/home/services/fontutils.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 21 Sep 2022 00:30:02 GMT) Full text and rfc822 format available.Message #8 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: Taiju HIGASHI <higashi <at> taiju.info> Subject: [PATCH 1/1] home: fontutils: Support user's fontconfig. Date: Wed, 21 Sep 2022 09:29:21 +0900
* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Support user's fontconfig. --- gnu/home/services/fontutils.scm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm index 6062eaed6a..3ea8b1db74 100644 --- a/gnu/home/services/fontutils.scm +++ b/gnu/home/services/fontutils.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +22,7 @@ (define-module (gnu home services fontutils) #:use-module (gnu home services) #:use-module (gnu packages fontutils) #:use-module (guix gexp) + #:use-module (srfi srfi-1) #:export (home-fontconfig-service-type)) @@ -33,15 +35,18 @@ (define-module (gnu home services fontutils) ;;; ;;; Code: -(define (add-fontconfig-config-file he-symlink-path) +(define (add-fontconfig-config-file font-config) `(("fontconfig/fonts.conf" ,(mixed-text-file "fonts.conf" "<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig> - <dir>~/.guix-home/profile/share/fonts</dir> -</fontconfig>")))) + <dir>~/.guix-home/profile/share/fonts</dir>\n" + (if (null? font-config) + "" + (string-join font-config "\n" 'suffix)) + "</fontconfig>\n")))) (define (regenerate-font-cache-gexp _) `(("profile/share/fonts" @@ -49,6 +54,8 @@ (define (regenerate-font-cache-gexp _) (define home-fontconfig-service-type (service-type (name 'home-fontconfig) + (compose concatenate) + (extend append) (extensions (list (service-extension home-xdg-configuration-files-service-type @@ -59,7 +66,7 @@ (define home-fontconfig-service-type (service-extension home-profile-service-type (const (list fontconfig))))) - (default-value #f) + (default-value '()) (description "Provides configuration file for fontconfig and make fc-* utilities aware of font packages installed in Guix Home's profile."))) -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 21 Sep 2022 08:55:02 GMT) Full text and rfc822 format available.Message #11 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at> To: Taiju HIGASHI <higashi <at> taiju.info>, 57963 <at> debbugs.gnu.org Subject: Re: [PATCH 1/1] home: fontutils: Support user's fontconfig. Date: Wed, 21 Sep 2022 10:54:34 +0200
Am Mittwoch, dem 21.09.2022 um 09:29 +0900 schrieb Taiju HIGASHI: > * gnu/home/services/fontutils.scm (add-fontconfig-config-file): > Support user's fontconfig. > --- > gnu/home/services/fontutils.scm | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/gnu/home/services/fontutils.scm > b/gnu/home/services/fontutils.scm > index 6062eaed6a..3ea8b1db74 100644 > --- a/gnu/home/services/fontutils.scm > +++ b/gnu/home/services/fontutils.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> > ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -21,6 +22,7 @@ (define-module (gnu home services fontutils) > #:use-module (gnu home services) > #:use-module (gnu packages fontutils) > #:use-module (guix gexp) > + #:use-module (srfi srfi-1) > > #:export (home-fontconfig-service-type)) > > @@ -33,15 +35,18 @@ (define-module (gnu home services fontutils) > ;;; > ;;; Code: > > -(define (add-fontconfig-config-file he-symlink-path) > +(define (add-fontconfig-config-file font-config) > `(("fontconfig/fonts.conf" > ,(mixed-text-file > "fonts.conf" > "<?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > <fontconfig> > - <dir>~/.guix-home/profile/share/fonts</dir> > -</fontconfig>")))) > + <dir>~/.guix-home/profile/share/fonts</dir>\n" > + (if (null? font-config) > + "" > + (string-join font-config "\n" 'suffix)) > + "</fontconfig>\n")))) I think it'd be wiser to pretty-print SXML here. The structure could look something like `(fontconfig (dir "~/.guix-home/profile/share/fonts") ,@(extra-user-config ...)) 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. However, given that multiple profiles aren't supported yet, this is future work. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 21 Sep 2022 10:00:01 GMT) Full text and rfc822 format available.Message #14 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [PATCH 1/1] home: fontutils: Support user's fontconfig. Date: Wed, 21 Sep 2022 18:59:31 +0900
Hi Liliana, Thank you for your review. >> -(define (add-fontconfig-config-file he-symlink-path) >> +(define (add-fontconfig-config-file font-config) >> `(("fontconfig/fonts.conf" >> ,(mixed-text-file >> "fonts.conf" >> "<?xml version='1.0'?> >> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >> <fontconfig> >> - <dir>~/.guix-home/profile/share/fonts</dir> >> -</fontconfig>")))) >> + <dir>~/.guix-home/profile/share/fonts</dir>\n" >> + (if (null? font-config) >> + "" >> + (string-join font-config "\n" 'suffix)) >> + "</fontconfig>\n")))) > I think it'd be wiser to pretty-print SXML here. > The structure could look something like > `(fontconfig > (dir "~/.guix-home/profile/share/fonts") > ,@(extra-user-config ...)) That's definitely better! Does this assume that SXML will also accept additional user settings? > 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. 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. Cheers -- taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 21 Sep 2022 11:41:01 GMT) Full text and rfc822 format available.Message #17 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [PATCH 1/1] home: fontutils: Support user's fontconfig. Date: Wed, 21 Sep 2022 13:40:14 +0200
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) > > > `(("fontconfig/fonts.conf" > > > ,(mixed-text-file > > > "fonts.conf" > > > "<?xml version='1.0'?> > > > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > > > <fontconfig> > > > - <dir>~/.guix-home/profile/share/fonts</dir> > > > -</fontconfig>")))) > > > + <dir>~/.guix-home/profile/share/fonts</dir>\n" > > > + (if (null? font-config) > > > + "" > > > + (string-join font-config "\n" 'suffix)) > > > + "</fontconfig>\n")))) > > I think it'd be wiser to pretty-print SXML here. > > The structure could look something like > > `(fontconfig > > (dir "~/.guix-home/profile/share/fonts") > > ,@(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. > > 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. 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 :)
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 22 Sep 2022 01:22:02 GMT) Full text and rfc822 format available.Message #20 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: Taiju HIGASHI <higashi <at> taiju.info> Subject: [PATCH v2] home: fontutils: Support user's fontconfig. Date: Thu, 22 Sep 2022 10:20:33 +0900
* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Support user's fontconfig. --- gnu/home/services/fontutils.scm | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm index 6062eaed6a..b57cccbaae 100644 --- a/gnu/home/services/fontutils.scm +++ b/gnu/home/services/fontutils.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +22,9 @@ (define-module (gnu home services fontutils) #:use-module (gnu home services) #:use-module (gnu packages fontutils) #:use-module (guix gexp) + #:use-module (srfi srfi-1) + #:use-module (sxml simple) + #:use-module (ice-9 match) #:export (home-fontconfig-service-type)) @@ -33,15 +37,28 @@ (define-module (gnu home services fontutils) ;;; ;;; Code: -(define (add-fontconfig-config-file he-symlink-path) +(define (parse-extra-user-config extra-user-config) + (map (match-lambda + ((? pair? sxml) sxml) + ((? string? xml) (xml->sxml xml)) + (_ (error "extra-user-config must be xml string or sxml."))) + extra-user-config)) + +(define (add-fontconfig-config-file extra-user-config) `(("fontconfig/fonts.conf" ,(mixed-text-file "fonts.conf" "<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> -<fontconfig> - <dir>~/.guix-home/profile/share/fonts</dir> -</fontconfig>")))) +" + (call-with-output-string + (lambda (port) + (sxml->xml + `(fontconfig + (dir "~/.guix-home/profile/share/fonts") + ,@(parse-extra-user-config extra-user-config)) + port) + (newline port))))))) (define (regenerate-font-cache-gexp _) `(("profile/share/fonts" @@ -49,6 +66,8 @@ (define (regenerate-font-cache-gexp _) (define home-fontconfig-service-type (service-type (name 'home-fontconfig) + (compose concatenate) + (extend append) (extensions (list (service-extension home-xdg-configuration-files-service-type @@ -59,7 +78,7 @@ (define home-fontconfig-service-type (service-extension home-profile-service-type (const (list fontconfig))))) - (default-value #f) + (default-value '()) (description "Provides configuration file for fontconfig and make fc-* utilities aware of font packages installed in Guix Home's profile."))) -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 22 Sep 2022 01:29:01 GMT) Full text and rfc822 format available.Message #23 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [PATCH 1/1] home: fontutils: Support user's fontconfig. Date: Thu, 22 Sep 2022 10:27:56 +0900
[Message part 1 (text/plain, inline)]
Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at> 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) >> > > `(("fontconfig/fonts.conf" >> > > ,(mixed-text-file >> > > "fonts.conf" >> > > "<?xml version='1.0'?> >> > > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >> > > <fontconfig> >> > > - <dir>~/.guix-home/profile/share/fonts</dir> >> > > -</fontconfig>")))) >> > > + <dir>~/.guix-home/profile/share/fonts</dir>\n" >> > > + (if (null? font-config) >> > > + "" >> > > + (string-join font-config "\n" 'suffix)) >> > > + "</fontconfig>\n")))) >> > I think it'd be wiser to pretty-print SXML here. >> > The structure could look something like >> > `(fontconfig >> > (dir "~/.guix-home/profile/share/fonts") >> > ,@(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.
[fontutils.scm (text/plain, attachment)]
[Message part 3 (text/plain, inline)]
>> > 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. 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 -- taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 22 Sep 2022 06:15:02 GMT) Full text and rfc822 format available.Message #26 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Taiju HIGASHI <higashi <at> taiju.info>, 57963 <at> debbugs.gnu.org Cc: Ludovic Courtès <ludo <at> gnu.org>, Liliana Marie Prikler <liliana.prikler <at> gmail.com> Subject: Re: [bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig. Date: Thu, 22 Sep 2022 09:14:10 +0300
[Message part 1 (text/plain, inline)]
On 2022-09-22 10:20, Taiju HIGASHI wrote: > * gnu/home/services/fontutils.scm (add-fontconfig-config-file): Support user's > fontconfig. > --- > gnu/home/services/fontutils.scm | 29 ++++++++++++++++++++++++----- > 1 file changed, 24 insertions(+), 5 deletions(-) > > diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm > index 6062eaed6a..b57cccbaae 100644 > --- a/gnu/home/services/fontutils.scm > +++ b/gnu/home/services/fontutils.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> > ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -21,6 +22,9 @@ (define-module (gnu home services fontutils) > #:use-module (gnu home services) > #:use-module (gnu packages fontutils) > #:use-module (guix gexp) > + #:use-module (srfi srfi-1) > + #:use-module (sxml simple) > + #:use-module (ice-9 match) > > #:export (home-fontconfig-service-type)) > > @@ -33,15 +37,28 @@ (define-module (gnu home services fontutils) > ;;; > ;;; Code: > > -(define (add-fontconfig-config-file he-symlink-path) > +(define (parse-extra-user-config extra-user-config) > + (map (match-lambda > + ((? pair? sxml) sxml) > + ((? string? xml) (xml->sxml xml)) > + (_ (error "extra-user-config must be xml string or sxml."))) > + extra-user-config)) > + > +(define (add-fontconfig-config-file extra-user-config) > `(("fontconfig/fonts.conf" > ,(mixed-text-file > "fonts.conf" > "<?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > -<fontconfig> > - <dir>~/.guix-home/profile/share/fonts</dir> > -</fontconfig>")))) > +" > + (call-with-output-string > + (lambda (port) > + (sxml->xml > + `(fontconfig > + (dir "~/.guix-home/profile/share/fonts") > + ,@(parse-extra-user-config extra-user-config)) > + port) > + (newline port))))))) > > (define (regenerate-font-cache-gexp _) > `(("profile/share/fonts" > @@ -49,6 +66,8 @@ (define (regenerate-font-cache-gexp _) > > (define home-fontconfig-service-type > (service-type (name 'home-fontconfig) > + (compose concatenate) > + (extend append) > (extensions > (list (service-extension > home-xdg-configuration-files-service-type > @@ -59,7 +78,7 @@ (define home-fontconfig-service-type > (service-extension > home-profile-service-type > (const (list fontconfig))))) > - (default-value #f) > + (default-value '()) > (description > "Provides configuration file for fontconfig and make > fc-* utilities aware of font packages installed in Guix Home's profile."))) I like the current approach, but I have two concerns: 1. Serialization happens on client side, not daemon side (during the build), thus it doesn't support gexp and file-likes, so it would be hard to append part of already existing file to the config or do similiar thing. 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. rde services style examples: https://git.sr.ht/~abcdw/rde/tree/8ec99884fad18a80a08a7c1d6a7cf46a006327c4/rde/home/services/wm.scm#L145 https://git.sr.ht/~abcdw/rde/tree/8ec99884fad18a80a08a7c1d6a7cf46a006327c4/rde/home/services/xdisorg.scm#L55 guix services style examples: https://guix.gnu.org/manual/devel/en/guix.html#Web-Services Related discussions: https://issues.guix.gnu.org/53466 https://issues.guix.gnu.org/52698 https://yhetil.org/guix-devel/87h79qx5db.fsf <at> trop.in/ To sum up, personally I like and prefer the configuration style from this patch, but to keep it consistent with guix system services we need to use guix style. -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 22 Sep 2022 08:54:02 GMT) Full text and rfc822 format available.Message #29 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Andrew Tropin <andrew <at> trop.in>, Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com> Subject: Re: [bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig. Date: Thu, 22 Sep 2022 10:53:47 +0200
Hi Andrew, Andrew Tropin <andrew <at> 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’s generally true, but it’s not black and white and there’s room for discussion. :-) In this case, Taiju’s 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’d provide SXML instead of XML-in-a-string, so it’s 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’s say along these lines: (simple-service 'my-fontconfig-service home-fontconfig-service-type (list (font-alias 'sans-serif "Noto Sans CJK JP") …)) That way, users wouldn’t 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’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 22 Sep 2022 09:51:02 GMT) Full text and rfc822 format available.Message #32 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Andrew Tropin <andrew <at> trop.in>, Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com> Subject: Re: [bug#57963] [PATCH v2] home: fontutils: Support user's fontconfig. Date: Thu, 22 Sep 2022 18:50:38 +0900
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ès <ludo <at> gnu.org> writes: > Hi Andrew, > > Andrew Tropin <andrew <at> 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’s generally true, but it’s not black and white and there’s room for > discussion. :-) > > In this case, Taiju’s proposal is to let users write snippets like 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’d provide SXML instead of XML-in-a-string, so it’s > 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’s say along these lines: > > (simple-service 'my-fontconfig-service > home-fontconfig-service-type > (list (font-alias 'sans-serif "Noto Sans CJK JP") …)) > > That way, users wouldn’t 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? 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
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 23 Sep 2022 07:21:01 GMT) Full text and rfc822 format available.Message #35 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> ist.tugraz.at> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [PATCH 1/1] home: fontutils: Support user's fontconfig. Date: Fri, 23 Sep 2022 09:20:05 +0200
Am Donnerstag, dem 22.09.2022 um 10:27 +0900 schrieb Taiju HIGASHI: > 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. Added tests are always welcome.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 24 Sep 2022 15:53:02 GMT) Full text and rfc822 format available.Message #38 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Sat, 24 Sep 2022 17:52:01 +0200
Hi, Taiju HIGASHI <higashi <at> taiju.info> skribis: > I'm not very knowledgeable about G-Expressions, so I don't understand > much of what you replied. (I will study it!). I didn’t mention gexps. :-) > Ludovic Courtès <ludo <at> gnu.org> writes: > 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. Oh I see. Do you need every single bit from the ‘fonts.conf’ file above? Anyway, it does look like your v2 is the way to go, with the obvious caveat that using it is tricky: one needs to know about fontconfig’s config file format and about sxml. Maybe we can go with v2 for now (it provides a useful “escape hatch”) but prepare for more conventional configuration bindings? Thanks, Ludo’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 24 Sep 2022 22:59:02 GMT) Full text and rfc822 format available.Message #41 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Sun, 25 Sep 2022 07:58:11 +0900
Ludovic Courtès <ludo <at> gnu.org> writes: > Hi, > > Taiju HIGASHI <higashi <at> taiju.info> skribis: > >> I'm not very knowledgeable about G-Expressions, so I don't understand >> much of what you replied. (I will study it!). > > I didn’t mention gexps. :-) Sorry, that comment of mine was in response to Andrew's comment. >> Ludovic Courtès <ludo <at> gnu.org> writes: >> 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. > > Oh I see. Do you need every single bit from the ‘fonts.conf’ file > above? There may be some settings that are not needed. > Anyway, it does look like your v2 is the way to go, with the obvious > caveat that using it is tricky: one needs to know about fontconfig’s > config file format and about sxml. > > Maybe we can go with v2 for now (it provides a useful “escape hatch”) > but prepare for more conventional configuration bindings? By conventional configuration binding, do you mean adding something like home-fontconfig-configuration to provide a dedicated fontconfig configuration? I have been reading the DTD and think it might be a bit of a challenge. https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd However, I did notice one thing, and that is that there is an include element. I thought that if we had a configuration where the include element could be added, we could handle most of the use cases. What do you think of this idea? Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 25 Sep 2022 06:26:02 GMT) Full text and rfc822 format available.Message #44 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info>, Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Sun, 25 Sep 2022 08:25:25 +0200
Am Sonntag, dem 25.09.2022 um 07:58 +0900 schrieb Taiju HIGASHI: > Ludovic Courtès <ludo <at> gnu.org> writes: > > > Anyway, it does look like your v2 is the way to go, with the > > obvious caveat that using it is tricky: one needs to know about > > fontconfig’s config file format and about sxml. > > > > Maybe we can go with v2 for now (it provides a useful “escape > > hatch”) but prepare for more conventional configuration bindings? > > By conventional configuration binding, do you mean adding something > like home-fontconfig-configuration to provide a dedicated fontconfig > configuration? I think Ludo means that we should provide the most useful options (like the fontconfig dirs) as dedicated record fields, while leaving an "extra-config" escape hatch, that can be used with SXML or a raw string for stuff that's too complicated (my personal preference would still be SXML over the raw string, but YMMV). > I have been reading the DTD and think it might be a bit of a > challenge. > https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd > > However, I did notice one thing, and that is that there is an include > element. I thought that if we had a configuration where the include > element could be added, we could handle most of the use cases. > What do you think of this idea? I'd prefer extra-config over include – extra-config doesn't need to go through file-like objects and an additional layer of G-Expression quoting. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 25 Sep 2022 07:31:01 GMT) Full text and rfc822 format available.Message #47 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Sun, 25 Sep 2022 16:29:51 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Sonntag, dem 25.09.2022 um 07:58 +0900 schrieb Taiju HIGASHI: >> Ludovic Courtès <ludo <at> gnu.org> writes: >> >> > Anyway, it does look like your v2 is the way to go, with the >> > obvious caveat that using it is tricky: one needs to know about >> > fontconfig’s config file format and about sxml. >> > >> > Maybe we can go with v2 for now (it provides a useful “escape >> > hatch”) but prepare for more conventional configuration bindings? >> >> By conventional configuration binding, do you mean adding something >> like home-fontconfig-configuration to provide a dedicated fontconfig >> configuration? > I think Ludo means that we should provide the most useful options (like > the fontconfig dirs) as dedicated record fields, while leaving an > "extra-config" escape hatch, that can be used with SXML or a raw string > for stuff that's too complicated (my personal preference would still be > SXML over the raw string, but YMMV). I see. For example, For example, would it be as follows? --8<---------------cut here---------------start------------->8--- (service home-fontconfig-service-type (home-fontconfig-configuration (dir "~/.config/fontconfig/my-fonts1.conf")) (extra-config (list "<dir>~/.config/fontconfig/my-fonts2.conf"))) --8<---------------cut here---------------end--------------->8--- >> I have been reading the DTD and think it might be a bit of a >> challenge. >> https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd >> >> However, I did notice one thing, and that is that there is an include >> element. I thought that if we had a configuration where the include >> element could be added, we could handle most of the use cases. >> What do you think of this idea? > I'd prefer extra-config over include – extra-config doesn't need to go > through file-like objects and an additional layer of G-Expression > quoting. > > Cheers It is difficult to determine which rules to define as records, but I thought that if I only had includes, I could handle most use cases. For example, we assume that you will be able to write settings as follows: --8<---------------cut here---------------start------------->8--- (service home-fontconfig-service-type (home-fontconfig-configuration (includes (list (include (path "~/.config/fontconfig/my-fonts1.conf") (ignore-missing #t)))))) --8<---------------cut here---------------end--------------->8--- ref: https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd#L59-L74 Would it also fit with your assumption if we could also specify extra-config here? It is difficult to judge whether the ability to specify includes is useful or not, though, since extra-config alone will do the job. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 25 Sep 2022 07:35:01 GMT) Full text and rfc822 format available.Message #50 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Sun, 25 Sep 2022 16:34:20 +0900
Taiju HIGASHI <higashi <at> taiju.info> writes: > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > >> Am Sonntag, dem 25.09.2022 um 07:58 +0900 schrieb Taiju HIGASHI: >>> Ludovic Courtès <ludo <at> gnu.org> writes: >>> >>> > Anyway, it does look like your v2 is the way to go, with the >>> > obvious caveat that using it is tricky: one needs to know about >>> > fontconfig’s config file format and about sxml. >>> > >>> > Maybe we can go with v2 for now (it provides a useful “escape >>> > hatch”) but prepare for more conventional configuration bindings? >>> >>> By conventional configuration binding, do you mean adding something >>> like home-fontconfig-configuration to provide a dedicated fontconfig >>> configuration? >> I think Ludo means that we should provide the most useful options (like >> the fontconfig dirs) as dedicated record fields, while leaving an >> "extra-config" escape hatch, that can be used with SXML or a raw string >> for stuff that's too complicated (my personal preference would still be >> SXML over the raw string, but YMMV). > > I see. For example, > > For example, would it be as follows? > > (service home-fontconfig-service-type > (home-fontconfig-configuration > (dir "~/.config/fontconfig/my-fonts1.conf")) > (extra-config > (list > "<dir>~/.config/fontconfig/my-fonts2.conf"))) It was wrong. The following is more correct. --8<---------------cut here---------------start------------->8--- (service home-fontconfig-service-type (home-fontconfig-configuration (dirs (list "~/.config/fontconfig/my-fonts1.conf")) (extra-config (list "<match>...</match>")))) --8<---------------cut here---------------end--------------->8--- Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 25 Sep 2022 15:51:02 GMT) Full text and rfc822 format available.Message #53 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Sun, 25 Sep 2022 17:50:00 +0200
Am Sonntag, dem 25.09.2022 um 16:29 +0900 schrieb Taiju HIGASHI: > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > Am Sonntag, dem 25.09.2022 um 07:58 +0900 schrieb Taiju HIGASHI: > > > Ludovic Courtès <ludo <at> gnu.org> writes: > > > > > > > Anyway, it does look like your v2 is the way to go, with the > > > > obvious caveat that using it is tricky: one needs to know about > > > > fontconfig’s config file format and about sxml. > > > > > > > > Maybe we can go with v2 for now (it provides a useful “escape > > > > hatch”) but prepare for more conventional configuration > > > > bindings? > > > > > > By conventional configuration binding, do you mean adding > > > something > > > like home-fontconfig-configuration to provide a dedicated > > > fontconfig > > > configuration? > > I think Ludo means that we should provide the most useful options > > (like the fontconfig dirs) as dedicated record fields, while > > leaving an "extra-config" escape hatch, that can be used with SXML > > or a raw string for stuff that's too complicated (my personal > > preference would still be SXML over the raw string, but YMMV). > > I see. For example, > > For example, would it be as follows? > > --8<---------------cut here---------------start------------->8--- > (service home-fontconfig-service-type > (home-fontconfig-configuration > (dir "~/.config/fontconfig/my-fonts1.conf")) > (extra-config > (list > "<dir>~/.config/fontconfig/my-fonts2.conf"))) > --8<---------------cut here---------------end--------------->8--- Since you can specify more than one dir, that'd be "dirs" or even something more helpful like "font-directories". Note that those are directories and not config files. You corrected the extra-config thing in your reply, but also be aware of the extra-config as SXML option. > > > > I have been reading the DTD and think it might be a bit of a > > > challenge. > > > https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd > > > > > > However, I did notice one thing, and that is that there is an > > > include element. I thought that if we had a configuration where > > > the include element could be added, we could handle most of the > > > use cases. What do you think of this idea? > > I'd prefer extra-config over include – extra-config doesn't need to > > go through file-like objects and an additional layer of G- > > Expression quoting. > > > > Cheers > > It is difficult to determine which rules to define as records, but I > thought that if I only had includes, I could handle most use cases. Go for the obvious low-hanging fruits and typical use cases first. Don't just add a field that requires a depth of 3 or more to be useful. > For example, we assume that you will be able to write settings as > follows: > > --8<---------------cut here---------------start------------->8--- > (service home-fontconfig-service-type > (home-fontconfig-configuration > (includes > (list > (include > (path "~/.config/fontconfig/my-fonts1.conf") > (ignore-missing #t)))))) > --8<---------------cut here---------------end--------------->8--- > > ref: > https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd#L59-L74 > > Would it also fit with your assumption if we could also specify > extra-config here? > > It is difficult to judge whether the ability to specify includes is > useful or not, though, since extra-config alone will do the job. Except for possibly some fringe use cases, include will be pointless if you have extra-config, which is a better include :) Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Mon, 26 Sep 2022 01:44:02 GMT) Full text and rfc822 format available.Message #56 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Mon, 26 Sep 2022 10:43:40 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Sonntag, dem 25.09.2022 um 16:29 +0900 schrieb Taiju HIGASHI: >> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: >> >> > Am Sonntag, dem 25.09.2022 um 07:58 +0900 schrieb Taiju HIGASHI: >> > > Ludovic Courtès <ludo <at> gnu.org> writes: >> > > >> > > > Anyway, it does look like your v2 is the way to go, with the >> > > > obvious caveat that using it is tricky: one needs to know about >> > > > fontconfig’s config file format and about sxml. >> > > > >> > > > Maybe we can go with v2 for now (it provides a useful “escape >> > > > hatch”) but prepare for more conventional configuration >> > > > bindings? >> > > >> > > By conventional configuration binding, do you mean adding >> > > something >> > > like home-fontconfig-configuration to provide a dedicated >> > > fontconfig >> > > configuration? >> > I think Ludo means that we should provide the most useful options >> > (like the fontconfig dirs) as dedicated record fields, while >> > leaving an "extra-config" escape hatch, that can be used with SXML >> > or a raw string for stuff that's too complicated (my personal >> > preference would still be SXML over the raw string, but YMMV). >> >> I see. For example, >> >> For example, would it be as follows? >> >> --8<---------------cut here---------------start------------->8--- >> (service home-fontconfig-service-type >> (home-fontconfig-configuration >> (dir "~/.config/fontconfig/my-fonts1.conf")) >> (extra-config >> (list >> "<dir>~/.config/fontconfig/my-fonts2.conf"))) >> --8<---------------cut here---------------end--------------->8--- > Since you can specify more than one dir, that'd be "dirs" or even > something more helpful like "font-directories". Note that those are > directories and not config files. > > You corrected the extra-config thing in your reply, but also be aware > of the extra-config as SXML option. > >> >> > > I have been reading the DTD and think it might be a bit of a >> > > challenge. >> > > https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd >> > > >> > > However, I did notice one thing, and that is that there is an >> > > include element. I thought that if we had a configuration where >> > > the include element could be added, we could handle most of the >> > > use cases. What do you think of this idea? >> > I'd prefer extra-config over include – extra-config doesn't need to >> > go through file-like objects and an additional layer of G- >> > Expression quoting. >> > >> > Cheers >> >> It is difficult to determine which rules to define as records, but I >> thought that if I only had includes, I could handle most use cases. > Go for the obvious low-hanging fruits and typical use cases first. > Don't just add a field that requires a depth of 3 or more to be useful. > >> For example, we assume that you will be able to write settings as >> follows: >> >> --8<---------------cut here---------------start------------->8--- >> (service home-fontconfig-service-type >> (home-fontconfig-configuration >> (includes >> (list >> (include >> (path "~/.config/fontconfig/my-fonts1.conf") >> (ignore-missing #t)))))) >> --8<---------------cut here---------------end--------------->8--- >> >> ref: >> https://github.com/freedesktop/fontconfig/blob/e291fda7d42e5d64379555097a066d9c2c4efce3/fonts.dtd#L59-L74 >> >> Would it also fit with your assumption if we could also specify >> extra-config here? >> >> It is difficult to judge whether the ability to specify includes is >> useful or not, though, since extra-config alone will do the job. > Except for possibly some fringe use cases, include will be pointless if > you have extra-config, which is a better include :) > > Cheers I have designed a configuration interface with a typical font configuration pattern. (it implemented yet.) --8<---------------cut here---------------start------------->8--- (service home-fontconfig-service-type (home-fontconfig-configuration (font-directories (list "~/fonts")) (prefered-default-font (sans-serif "Noto Sans CJK JP") (serif "Noto Serif CJK JP") (monospace "PlemolJP Console")) (extra-config ; Also accepts lists of XML strings. `((match (@ (target font)) (edit (@ (mode assign) (name antialias)) (bool true))))))) --8<---------------cut here---------------end--------------->8--- This is assumed to be serialized below. (actually, it not pretty-printed.) --8<---------------cut here---------------start------------->8--- <?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig> <dir>~/.guix-home/profile/share/fonts</dir> <dir>~/fonts</dir> <alias> <family>sans-serif</family> <prefer> <family>Noto Sans CJK JP</family> </prefer> </alias> <alias> <family>serif</family> <prefer> <family>Noto Serif CJK JP</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>PlemolJP Console</family> </prefer> </alias> <match target="font"> <edit mode="assign" name="antialias"> <bool>true</bool> </edit> </match> </fontconfig> --8<---------------cut here---------------end--------------->8--- How about this? -- Cheers Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Mon, 26 Sep 2022 18:20:02 GMT) Full text and rfc822 format available.Message #59 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Mon, 26 Sep 2022 20:19:29 +0200
Am Montag, dem 26.09.2022 um 10:43 +0900 schrieb Taiju HIGASHI: > I have designed a configuration interface with a typical font > configuration pattern. (it implemented yet.) > > --8<---------------cut here---------------start------------->8--- > (service home-fontconfig-service-type > (home-fontconfig-configuration > (font-directories > (list "~/fonts")) > (prefered-default-font > (sans-serif "Noto Sans CJK JP") > (serif "Noto Serif CJK JP") > (monospace "PlemolJP Console")) > (extra-config ; Also accepts lists of XML strings. > `((match (@ (target font)) > (edit (@ (mode assign) > (name antialias)) > (bool true))))))) > --8<---------------cut here---------------end--------------->8--- > > This is assumed to be serialized below. (actually, it not pretty- > printed.) > > --8<---------------cut here---------------start------------->8--- > <?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > <fontconfig> > <dir>~/.guix-home/profile/share/fonts</dir> > <dir>~/fonts</dir> > <alias> > <family>sans-serif</family> > <prefer> > <family>Noto Sans CJK JP</family> > </prefer> > </alias> > <alias> > <family>serif</family> > <prefer> > <family>Noto Serif CJK JP</family> > </prefer> > </alias> > <alias> > <family>monospace</family> > <prefer> > <family>PlemolJP Console</family> > </prefer> > </alias> > <match target="font"> > <edit mode="assign" name="antialias"> > <bool>true</bool> > </edit> > </match> > </fontconfig> > --8<---------------cut here---------------end--------------->8--- LGTM
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 27 Sep 2022 09:56:02 GMT) Full text and rfc822 format available.Message #62 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: ludo <at> gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Cc: 57963 <at> debbugs.gnu.org, Taiju HIGASHI <higashi <at> taiju.info> Subject: [PATCH v3] home: fontutils: Support user's fontconfig. Date: Tue, 27 Sep 2022 18:55:25 +0900
* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Support user's fontconfig. --- gnu/home/services/fontutils.scm | 103 ++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 6 deletions(-) diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm index 6062eaed6a..b02f43a4fc 100644 --- a/gnu/home/services/fontutils.scm +++ b/gnu/home/services/fontutils.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,9 +21,16 @@ (define-module (gnu home services fontutils) #:use-module (gnu home services) #:use-module (gnu packages fontutils) + #:use-module (gnu services configuration) #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (srfi srfi-1) + #:use-module (sxml simple) + #:use-module (ice-9 match) - #:export (home-fontconfig-service-type)) + #:export (home-fontconfig-service-type + home-fontconfig-configuration + default-font)) ;;; Commentary: ;;; @@ -33,15 +41,96 @@ (define-module (gnu home services fontutils) ;;; ;;; Code: -(define (add-fontconfig-config-file he-symlink-path) +(define-record-type* <default-font> default-font + make-default-font + default-font? + (serif default-font-serif (default "")) + (sans-serif defalut-font-sans-serif (default "")) + (monospace default-font-monospace (default ""))) + +(define (sxml->xmlstring sxml) + (if (null? sxml) + "" + (call-with-output-string + (lambda (port) + (sxml->xml sxml port) + (newline port))))) + +(define font-directories? list?) + +(define (serialize-font-directories field-name value) + (sxml->xmlstring + (append + '((dir "~/.guix-home/profile/share/fonts")) + (map + (lambda (path) + `(dir ,path)) + value)))) + +(define extra-config-list? list?) + +(define (serialize-extra-config-list field-name value) + (sxml->xmlstring + (map (match-lambda + ((? pair? sxml) sxml) + ((? string? xml) (xml->sxml xml)) + (_ (error "extra-config value must be xml string or sxml list."))) + value))) + +(define (serialize-default-font field-name value) + (match value + (($ <default-font> serif sans-serif monospace) + (sxml->xmlstring + (fold (lambda (pair sxml) + (if (string-null? (cdr pair)) + sxml + (append sxml + `((alias + (family ,(car pair)) + (prefer + (family ,(cdr pair)))))))) + '() + `((serif . ,serif) + (sans-serif . ,sans-serif) + (monospace . ,monospace))))))) + +(define-configuration home-fontconfig-configuration + (font-directories + (font-directories '()) + "The directory list that provides fonts.") + (preferred-default-font + (default-font (default-font)) + "The preffered default fonts for serif, sans-serif, and monospace.") + (extra-config + (extra-config-list '()) + "Extra configuration values to append to the fonts.conf.")) + +(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 extend-configs))) + (preferred-default-font + (home-fontconfig-configuration-preferred-default-font + (if (null? extend-configs) + original-config + (last extend-configs)))) + (extra-config + (append + (home-fontconfig-configuration-extra-config original-config) + (append-map home-fontconfig-configuration-extra-config extend-configs))))) + +(define (add-fontconfig-config-file user-config) `(("fontconfig/fonts.conf" ,(mixed-text-file "fonts.conf" "<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> -<fontconfig> - <dir>~/.guix-home/profile/share/fonts</dir> -</fontconfig>")))) +<fontconfig>\n" + (serialize-configuration user-config home-fontconfig-configuration-fields) + "</fontconfig>\n")))) (define (regenerate-font-cache-gexp _) `(("profile/share/fonts" @@ -49,6 +138,8 @@ (define (regenerate-font-cache-gexp _) (define home-fontconfig-service-type (service-type (name 'home-fontconfig) + (compose identity) + (extend home-fontconfig-extend) (extensions (list (service-extension home-xdg-configuration-files-service-type @@ -59,7 +150,7 @@ (define home-fontconfig-service-type (service-extension home-profile-service-type (const (list fontconfig))))) - (default-value #f) + (default-value (home-fontconfig-configuration)) (description "Provides configuration file for fontconfig and make fc-* utilities aware of font packages installed in Guix Home's profile."))) -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 27 Sep 2022 10:11:01 GMT) Full text and rfc822 format available.Message #65 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [PATCH v3] home: fontutils: Support user's fontconfig. Date: Tue, 27 Sep 2022 19:10:34 +0900
Hi, 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. --8<---------------cut here---------------start------------->8--- (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))))))) --8<---------------cut here---------------end--------------->8--- I didn't understand it properly, but `home-fontconfig-service-type` is pre-registered as `essential-services` and needs to be extended using `simple-service`. > +(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 extend-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. 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.) Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 28 Sep 2022 19:12:01 GMT) Full text and rfc822 format available.Message #68 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info>, ludo <at> gnu.org, andrew <at> trop.in Cc: 57963 <at> debbugs.gnu.org Subject: Re: [PATCH v3] home: fontutils: Support user's fontconfig. Date: Wed, 28 Sep 2022 21:11:30 +0200
Am Dienstag, dem 27.09.2022 um 18:55 +0900 schrieb Taiju HIGASHI: > * gnu/home/services/fontutils.scm (add-fontconfig-config-file): > Support user's > fontconfig. > --- > gnu/home/services/fontutils.scm | 103 > ++++++++++++++++++++++++++++++-- > 1 file changed, 97 insertions(+), 6 deletions(-) > > diff --git a/gnu/home/services/fontutils.scm > b/gnu/home/services/fontutils.scm > index 6062eaed6a..b02f43a4fc 100644 > --- a/gnu/home/services/fontutils.scm > +++ b/gnu/home/services/fontutils.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> > ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -20,9 +21,16 @@ > (define-module (gnu home services fontutils) > #:use-module (gnu home services) > #:use-module (gnu packages fontutils) > + #:use-module (gnu services configuration) > #:use-module (guix gexp) > + #:use-module (guix records) > + #:use-module (srfi srfi-1) > + #:use-module (sxml simple) > + #:use-module (ice-9 match) > > - #:export (home-fontconfig-service-type)) > + #:export (home-fontconfig-service-type > + home-fontconfig-configuration > + default-font)) > > ;;; Commentary: > ;;; > @@ -33,15 +41,96 @@ (define-module (gnu home services fontutils) > ;;; > ;;; Code: > > -(define (add-fontconfig-config-file he-symlink-path) > +(define-record-type* <default-font> default-font > + make-default-font > + default-font? > + (serif default-font-serif (default "")) > + (sans-serif defalut-font-sans-serif (default "")) > + (monospace default-font-monospace (default ""))) Is the empty string a meaningful value in these places? > +(define (sxml->xmlstring sxml) > + (if (null? sxml) > + "" > + (call-with-output-string > + (lambda (port) > + (sxml->xml sxml port) > + (newline port))))) > + > +(define font-directories? list?) > + > +(define (serialize-font-directories field-name value) > + (sxml->xmlstring > + (append > + '((dir "~/.guix-home/profile/share/fonts")) > + (map > + (lambda (path) > + `(dir ,path)) > + value)))) > + > +(define extra-config-list? list?) > + > +(define (serialize-extra-config-list field-name value) > + (sxml->xmlstring > + (map (match-lambda > + ((? pair? sxml) sxml) > + ((? string? xml) (xml->sxml xml)) > + (_ (error "extra-config value must be xml string or sxml > list."))) > + value))) > + > +(define (serialize-default-font field-name value) > + (match value > + (($ <default-font> serif sans-serif monospace) > + (sxml->xmlstring > + (fold (lambda (pair sxml) > + (if (string-null? (cdr pair)) > + sxml > + (append sxml > + `((alias > + (family ,(car pair)) > + (prefer > + (family ,(cdr pair)))))))) > + '() > + `((serif . ,serif) > + (sans-serif . ,sans-serif) > + (monospace . ,monospace))))))) You can greatly simplify these by serializing the fields to SXML and only taking the final SXML and serializing it to a string. > +(define-configuration home-fontconfig-configuration > + (font-directories > + (font-directories '()) > + "The directory list that provides fonts.") > + (preferred-default-font > + (default-font (default-font)) > + "The preffered default fonts for serif, sans-serif, and > monospace.") > + (extra-config > + (extra-config-list '()) > + "Extra configuration values to append to the fonts.conf.")) > + > +(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 > extend-configs))) > + (preferred-default-font > + (home-fontconfig-configuration-preferred-default-font > + (if (null? extend-configs) > + original-config > + (last extend-configs)))) > + (extra-config > + (append > + (home-fontconfig-configuration-extra-config original-config) > + (append-map home-fontconfig-configuration-extra-config > extend-configs))))) > + > +(define (add-fontconfig-config-file user-config) > `(("fontconfig/fonts.conf" > ,(mixed-text-file > "fonts.conf" > "<?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > -<fontconfig> > - <dir>~/.guix-home/profile/share/fonts</dir> > -</fontconfig>")))) > +<fontconfig>\n" > + (serialize-configuration user-config home-fontconfig- > configuration-fields) > + "</fontconfig>\n")))) Is it expected that our configuration will be pretty? If so, you might want to use a tree fold (there sadly doesn't seem to be a built-in XML pretty printer, which is a shame imho.) If not, those extra newlines do little. > (define (regenerate-font-cache-gexp _) > `(("profile/share/fonts" > @@ -49,6 +138,8 @@ (define (regenerate-font-cache-gexp _) > > (define home-fontconfig-service-type > (service-type (name 'home-fontconfig) > + (compose identity) > + (extend home-fontconfig-extend) > (extensions > (list (service-extension > home-xdg-configuration-files-service-type > @@ -59,7 +150,7 @@ (define home-fontconfig-service-type > (service-extension > home-profile-service-type > (const (list fontconfig))))) > - (default-value #f) > + (default-value (home-fontconfig-configuration)) > (description > "Provides configuration file for fontconfig and > make > fc-* utilities aware of font packages installed in Guix Home's > profile."))) Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 28 Sep 2022 21:16:02 GMT) Full text and rfc822 format available.Message #71 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Wed, 28 Sep 2022 23:15:03 +0200
Hi, Taiju HIGASHI <higashi <at> 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 extend-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’s 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 “merge” 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 ‘home-bash-service-type’, which accepts <home-bash-extension> records as its extensions. So… I wonder, should we, as a first commit, move ‘home-fontconfig-service-type’ out of the essential services to a ‘%base-home-services’ variable yet to be defined? I don’t see any good reason to have it here (“essential” 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’ve done that, perhaps we can forget about extensions, at least for now, and let users who need to configure things write: (modify-services %base-home-services (home-fontconfig-service-type config => …)) 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’ve settled on an interface, the commit that makes this change should include an update of doc/guix.texi. Thanks! Ludo’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 00:32:01 GMT) Full text and rfc822 format available.Message #74 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v3] home: fontutils: Support user's fontconfig. Date: Thu, 29 Sep 2022 09:31:09 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Dienstag, dem 27.09.2022 um 18:55 +0900 schrieb Taiju HIGASHI: >> * gnu/home/services/fontutils.scm (add-fontconfig-config-file): >> Support user's >> fontconfig. >> --- >> gnu/home/services/fontutils.scm | 103 >> ++++++++++++++++++++++++++++++-- >> 1 file changed, 97 insertions(+), 6 deletions(-) >> >> diff --git a/gnu/home/services/fontutils.scm >> b/gnu/home/services/fontutils.scm >> index 6062eaed6a..b02f43a4fc 100644 >> --- a/gnu/home/services/fontutils.scm >> +++ b/gnu/home/services/fontutils.scm >> @@ -1,6 +1,7 @@ >> ;;; GNU Guix --- Functional package management for GNU >> ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> >> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> >> +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> >> ;;; >> ;;; This file is part of GNU Guix. >> ;;; >> @@ -20,9 +21,16 @@ >> (define-module (gnu home services fontutils) >> #:use-module (gnu home services) >> #:use-module (gnu packages fontutils) >> + #:use-module (gnu services configuration) >> #:use-module (guix gexp) >> + #:use-module (guix records) >> + #:use-module (srfi srfi-1) >> + #:use-module (sxml simple) >> + #:use-module (ice-9 match) >> >> - #:export (home-fontconfig-service-type)) >> + #:export (home-fontconfig-service-type >> + home-fontconfig-configuration >> + default-font)) >> >> ;;; Commentary: >> ;;; >> @@ -33,15 +41,96 @@ (define-module (gnu home services fontutils) >> ;;; >> ;;; Code: >> >> -(define (add-fontconfig-config-file he-symlink-path) >> +(define-record-type* <default-font> default-font >> + make-default-font >> + default-font? >> + (serif default-font-serif (default "")) >> + (sans-serif defalut-font-sans-serif (default "")) >> + (monospace default-font-monospace (default ""))) > Is the empty string a meaningful value in these places? Sure, It is not meaningful. I would remove the default value. >> +(define (sxml->xmlstring sxml) >> + (if (null? sxml) >> + "" >> + (call-with-output-string >> + (lambda (port) >> + (sxml->xml sxml port) >> + (newline port))))) >> + >> +(define font-directories? list?) >> + >> +(define (serialize-font-directories field-name value) >> + (sxml->xmlstring >> + (append >> + '((dir "~/.guix-home/profile/share/fonts")) >> + (map >> + (lambda (path) >> + `(dir ,path)) >> + value)))) >> + >> +(define extra-config-list? list?) >> + >> +(define (serialize-extra-config-list field-name value) >> + (sxml->xmlstring >> + (map (match-lambda >> + ((? pair? sxml) sxml) >> + ((? string? xml) (xml->sxml xml)) >> + (_ (error "extra-config value must be xml string or sxml >> list."))) >> + value))) >> + >> +(define (serialize-default-font field-name value) >> + (match value >> + (($ <default-font> serif sans-serif monospace) >> + (sxml->xmlstring >> + (fold (lambda (pair sxml) >> + (if (string-null? (cdr pair)) >> + sxml >> + (append sxml >> + `((alias >> + (family ,(car pair)) >> + (prefer >> + (family ,(cdr pair)))))))) >> + '() >> + `((serif . ,serif) >> + (sans-serif . ,sans-serif) >> + (monospace . ,monospace))))))) > You can greatly simplify these by serializing the fields to SXML and > only taking the final SXML and serializing it to a string. I see. We can define sanitizer for fields, right? >> +(define-configuration home-fontconfig-configuration >> + (font-directories >> + (font-directories '()) >> + "The directory list that provides fonts.") >> + (preferred-default-font >> + (default-font (default-font)) >> + "The preffered default fonts for serif, sans-serif, and >> monospace.") >> + (extra-config >> + (extra-config-list '()) >> + "Extra configuration values to append to the fonts.conf.")) >> + >> +(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 >> extend-configs))) >> + (preferred-default-font >> + (home-fontconfig-configuration-preferred-default-font >> + (if (null? extend-configs) >> + original-config >> + (last extend-configs)))) >> + (extra-config >> + (append >> + (home-fontconfig-configuration-extra-config original-config) >> + (append-map home-fontconfig-configuration-extra-config >> extend-configs))))) >> + >> +(define (add-fontconfig-config-file user-config) >> `(("fontconfig/fonts.conf" >> ,(mixed-text-file >> "fonts.conf" >> "<?xml version='1.0'?> >> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >> -<fontconfig> >> - <dir>~/.guix-home/profile/share/fonts</dir> >> -</fontconfig>")))) >> +<fontconfig>\n" >> + (serialize-configuration user-config home-fontconfig- >> configuration-fields) >> + "</fontconfig>\n")))) > Is it expected that our configuration will be pretty? If so, you might > want to use a tree fold (there sadly doesn't seem to be a built-in XML > pretty printer, which is a shame imho.) > > If not, those extra newlines do little. OK, I would remove extra newlines. >> (define (regenerate-font-cache-gexp _) >> `(("profile/share/fonts" >> @@ -49,6 +138,8 @@ (define (regenerate-font-cache-gexp _) >> >> (define home-fontconfig-service-type >> (service-type (name 'home-fontconfig) >> + (compose identity) >> + (extend home-fontconfig-extend) >> (extensions >> (list (service-extension >> home-xdg-configuration-files-service-type >> @@ -59,7 +150,7 @@ (define home-fontconfig-service-type >> (service-extension >> home-profile-service-type >> (const (list fontconfig))))) >> - (default-value #f) >> + (default-value (home-fontconfig-configuration)) >> (description >> "Provides configuration file for fontconfig and >> make >> fc-* utilities aware of font packages installed in Guix Home's >> profile."))) > > Cheers > Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 01:02:01 GMT) Full text and rfc822 format available.Message #77 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 29 Sep 2022 10:01:03 +0900
Ludovic Courtès <ludo <at> gnu.org> writes: > Hi, > > Taiju HIGASHI <higashi <at> 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 >>> extend-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’s 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 “merge” 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 ‘home-bash-service-type’, which > accepts <home-bash-extension> records as its extensions. Thank you. I understand well. I felt out of place because there was no service that can full configuration such this one. > So… > > I wonder, should we, as a first commit, move > ‘home-fontconfig-service-type’ out of the essential services to a > ‘%base-home-services’ variable yet to be defined? > > I don’t see any good reason to have it here (“essential” 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’ve done that, perhaps we can forget about extensions, at least > for now, and let users who need to configure things write: > > (modify-services %base-home-services > (home-fontconfig-service-type > config => …)) > > WDYT? I found out what essential services should be. I'm going to move it from essential services to base-home-services. >> 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’ve settled on an interface, the commit that makes this change > should include an update of doc/guix.texi. Yes. I can write the draft, but I may have to ask you to finish it because I'm not good at writing English. It would be a waste of time for you to spend a long time correcting my poor grammar and expressions. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 14:29:01 GMT) Full text and rfc822 format available.Message #80 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 29 Sep 2022 16:28:21 +0200
Hi, Taiju HIGASHI <higashi <at> taiju.info> skribis: > I found out what essential services should be. > I'm going to move it from essential services to base-home-services. Alright, let’s do that (in a separate commit). >> Once we’ve settled on an interface, the commit that makes this change >> should include an update of doc/guix.texi. > > Yes. I can write the draft, but I may have to ask you to finish it because > I'm not good at writing English. > It would be a waste of time for you to spend a long time correcting my > poor grammar and expressions. Sure; I’m not a native speaker either but I can help. Thanks, Ludo’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 14:37:02 GMT) Full text and rfc822 format available.Message #83 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: [PATCH v4 1/2] home-services: Add base. Date: Thu, 29 Sep 2022 23:36:32 +0900
* gnu/home.scm: Move home-fontconfig-service-type from home-environment-default-essential-services to %home-base-services. * gnu/home/services/base.scm: Add base. --- gnu/home.scm | 5 ++--- gnu/home/services/base.scm | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 gnu/home/services/base.scm diff --git a/gnu/home.scm b/gnu/home.scm index c95d1e0818..c79db87018 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -19,10 +19,10 @@ (define-module (gnu home) #:use-module (gnu home services) + #:use-module (gnu home services base) #:use-module (gnu home services symlink-manager) #:use-module (gnu home services shells) #:use-module (gnu home services xdg) - #:use-module (gnu home services fontutils) #:use-module (gnu services) #:use-module (guix records) #:use-module (guix diagnostics) @@ -66,7 +66,7 @@ (define-record-type* <home-environment> home-environment this-home-environment))) (services home-environment-user-services - (default '())) + (default %home-base-services)) (location home-environment-location ; <location> (default (and=> (current-source-location) @@ -82,7 +82,6 @@ (define (home-environment-default-essential-services he) (service home-symlink-manager-service-type) - (service home-fontconfig-service-type) (service home-xdg-base-directories-service-type) (service home-shell-profile-service-type) diff --git a/gnu/home/services/base.scm b/gnu/home/services/base.scm new file mode 100644 index 0000000000..fbf92ba213 --- /dev/null +++ b/gnu/home/services/base.scm @@ -0,0 +1,35 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> +;;; +;;; 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 <http://www.gnu.org/licenses/>. + +(define-module (gnu home services base) + #:use-module (gnu home services) + #:use-module (gnu home services fontutils) + #:export (%home-base-services)) + +;;; Commentary: +;; +;; Base home services---i,e., services that 99% of the users will want to use. +;; +;;; Code: + + +(define %home-base-services + ;; Convenience variable holding the basic services. + (list (service home-fontconfig-service-type))) + +;;; base.scm ends here -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 14:37:02 GMT) Full text and rfc822 format available.Message #86 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Thu, 29 Sep 2022 23:36:33 +0900
* gnu/home/services/fontutils.scm: Support user's fontconfig. --- gnu/home/services/fontutils.scm | 86 ++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm index 6062eaed6a..32127740f6 100644 --- a/gnu/home/services/fontutils.scm +++ b/gnu/home/services/fontutils.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,9 +21,16 @@ (define-module (gnu home services fontutils) #:use-module (gnu home services) #:use-module (gnu packages fontutils) + #:use-module (gnu services configuration) #:use-module (guix gexp) + #:use-module (guix records) + #:use-module (srfi srfi-1) + #:use-module (sxml simple) + #:use-module (ice-9 match) - #:export (home-fontconfig-service-type)) + #:export (home-fontconfig-service-type + home-fontconfig-configuration + default-font)) ;;; Commentary: ;;; @@ -33,15 +41,81 @@ (define-module (gnu home services fontutils) ;;; ;;; Code: -(define (add-fontconfig-config-file he-symlink-path) +(define (default-font-sanitizer type) + (lambda (value) + (if (null? value) + value + `(alias + (family ,type) + (prefer + (family ,value)))))) + +(define-record-type* <default-font> default-font + make-default-font + default-font? + (serif default-font-serif + (default '()) + (sanitize (default-font-sanitizer 'serif))) + (sans-serif defalut-font-sans-serif + (default '()) + (sanitize (default-font-sanitizer 'sans-serif))) + (monospace default-font-monospace + (default '()) + (sanitize (default-font-sanitizer 'monospace)))) + +(define (sxml->xmlstring sxml) + (if (null? sxml) + "" + (call-with-output-string + (lambda (port) + (sxml->xml sxml port))))) + +(define font-directories? list?) + +(define (serialize-font-directories field-name value) + (sxml->xmlstring + (append + '((dir "~/.guix-home/profile/share/fonts")) + (map + (lambda (path) + `(dir ,path)) + value)))) + +(define extra-config-list? list?) + +(define (serialize-extra-config-list field-name value) + (sxml->xmlstring + (map (match-lambda + ((? pair? sxml) sxml) + ((? string? xml) (xml->sxml xml)) + (_ (error "extra-config value must be xml string or sxml list."))) + value))) + +(define (serialize-default-font field-name value) + (match value + (($ <default-font> serif sans-serif monospace) + (sxml->xmlstring (list serif sans-serif monospace))))) + +(define-configuration home-fontconfig-configuration + (font-directories + (font-directories '()) + "The directory list that provides fonts.") + (preferred-default-font + (default-font (default-font)) + "The preffered default fonts for serif, sans-serif, and monospace.") + (extra-config + (extra-config-list '()) + "Extra configuration values to append to the fonts.conf.")) + +(define (add-fontconfig-config-file user-config) `(("fontconfig/fonts.conf" ,(mixed-text-file "fonts.conf" "<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> -<fontconfig> - <dir>~/.guix-home/profile/share/fonts</dir> -</fontconfig>")))) +<fontconfig>" + (serialize-configuration user-config home-fontconfig-configuration-fields) + "</fontconfig>\n")))) (define (regenerate-font-cache-gexp _) `(("profile/share/fonts" @@ -59,7 +133,7 @@ (define home-fontconfig-service-type (service-extension home-profile-service-type (const (list fontconfig))))) - (default-value #f) + (default-value (home-fontconfig-configuration)) (description "Provides configuration file for fontconfig and make fc-* utilities aware of font packages installed in Guix Home's profile."))) -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 14:44:01 GMT) Full text and rfc822 format available.Message #89 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info>, 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Thu, 29 Sep 2022 16:43:08 +0200
Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI: > * gnu/home.scm: Move home-fontconfig-service-type from > home-environment-default-essential-services to %home-base-services. Unless there is a precedent in system, I would make all the currently "essential" services %home-base-services perhaps move their code accordingly. > * gnu/home/services/base.scm: Add base. Should be "New file." Also should probably be the first item in the ChangeLog, so that other items can mention it. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 14:47:01 GMT) Full text and rfc822 format available.Message #92 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v3] home: fontutils: Support user's fontconfig. Date: Thu, 29 Sep 2022 23:46:13 +0900
Hi Liliana, I've sent you the v4 patch. Taiju HIGASHI <higashi <at> taiju.info> writes: > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > >>> -(define (add-fontconfig-config-file he-symlink-path) >>> +(define-record-type* <default-font> default-font >>> + make-default-font >>> + default-font? >>> + (serif default-font-serif (default "")) >>> + (sans-serif defalut-font-sans-serif (default "")) >>> + (monospace default-font-monospace (default ""))) >> Is the empty string a meaningful value in these places? > > Sure, It is not meaningful. I would remove the default value. I couldn't remove the default value because without a default value, for example, it can't specify only serifs. However, I've changed the serialization of the field so that it is now a comfortable default value. Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 14:53:01 GMT) Full text and rfc822 format available.Message #95 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 29 Sep 2022 23:51:49 +0900
Hi Ludovic, I've sent you the v4 patch. Ludovic Courtès <ludo <at> gnu.org> writes: > Hi, > > Taiju HIGASHI <higashi <at> taiju.info> skribis: > >> I found out what essential services should be. >> I'm going to move it from essential services to base-home-services. > > Alright, let’s do that (in a separate commit). I've tried it. In particular, I'm wondering if I defined %home-base-services in the right place. >>> Once we’ve settled on an interface, the commit that makes this change >>> should include an update of doc/guix.texi. >> >> Yes. I can write the draft, but I may have to ask you to finish it because >> I'm not good at writing English. >> It would be a waste of time for you to spend a long time correcting my >> poor grammar and expressions. > > Sure; I’m not a native speaker either but I can help. I know it will take some time, but I'll try my best. By the way, if I edit the texi file, am I correct in confirming that I read the built Info? Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 14:56:01 GMT) Full text and rfc822 format available.Message #98 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Thu, 29 Sep 2022 23:55:16 +0900
The new way to extend the service is as follows. --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 => (home-fontconfig-configuration (font-directories (list "~/fonts")) (preferred-default-font (default-font (serif "Noto Serif CJK JP") (sans-serif "Noto Sans CJK JP"))) (extra-config `((match (@ (target font)) (edit (@ (mode assign) (name antialias)) (bool true))))))))))) --8<---------------cut here---------------end--------------->8--- Taiju HIGASHI <higashi <at> taiju.info> writes: > * gnu/home/services/fontutils.scm: Support user's fontconfig. > --- > gnu/home/services/fontutils.scm | 86 ++++++++++++++++++++++++++++++--- > 1 file changed, 80 insertions(+), 6 deletions(-) > > diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm > index 6062eaed6a..32127740f6 100644 > --- a/gnu/home/services/fontutils.scm > +++ b/gnu/home/services/fontutils.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> > ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -20,9 +21,16 @@ > (define-module (gnu home services fontutils) > #:use-module (gnu home services) > #:use-module (gnu packages fontutils) > + #:use-module (gnu services configuration) > #:use-module (guix gexp) > + #:use-module (guix records) > + #:use-module (srfi srfi-1) > + #:use-module (sxml simple) > + #:use-module (ice-9 match) > > - #:export (home-fontconfig-service-type)) > + #:export (home-fontconfig-service-type > + home-fontconfig-configuration > + default-font)) > > ;;; Commentary: > ;;; > @@ -33,15 +41,81 @@ (define-module (gnu home services fontutils) > ;;; > ;;; Code: > > -(define (add-fontconfig-config-file he-symlink-path) > +(define (default-font-sanitizer type) > + (lambda (value) > + (if (null? value) > + value > + `(alias > + (family ,type) > + (prefer > + (family ,value)))))) > + > +(define-record-type* <default-font> default-font > + make-default-font > + default-font? > + (serif default-font-serif > + (default '()) > + (sanitize (default-font-sanitizer 'serif))) > + (sans-serif defalut-font-sans-serif > + (default '()) > + (sanitize (default-font-sanitizer 'sans-serif))) > + (monospace default-font-monospace > + (default '()) > + (sanitize (default-font-sanitizer 'monospace)))) > + > +(define (sxml->xmlstring sxml) > + (if (null? sxml) > + "" > + (call-with-output-string > + (lambda (port) > + (sxml->xml sxml port))))) > + > +(define font-directories? list?) > + > +(define (serialize-font-directories field-name value) > + (sxml->xmlstring > + (append > + '((dir "~/.guix-home/profile/share/fonts")) > + (map > + (lambda (path) > + `(dir ,path)) > + value)))) > + > +(define extra-config-list? list?) > + > +(define (serialize-extra-config-list field-name value) > + (sxml->xmlstring > + (map (match-lambda > + ((? pair? sxml) sxml) > + ((? string? xml) (xml->sxml xml)) > + (_ (error "extra-config value must be xml string or sxml list."))) > + value))) > + > +(define (serialize-default-font field-name value) > + (match value > + (($ <default-font> serif sans-serif monospace) > + (sxml->xmlstring (list serif sans-serif monospace))))) > + > +(define-configuration home-fontconfig-configuration > + (font-directories > + (font-directories '()) > + "The directory list that provides fonts.") > + (preferred-default-font > + (default-font (default-font)) > + "The preffered default fonts for serif, sans-serif, and monospace.") > + (extra-config > + (extra-config-list '()) > + "Extra configuration values to append to the fonts.conf.")) > + > +(define (add-fontconfig-config-file user-config) > `(("fontconfig/fonts.conf" > ,(mixed-text-file > "fonts.conf" > "<?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > -<fontconfig> > - <dir>~/.guix-home/profile/share/fonts</dir> > -</fontconfig>")))) > +<fontconfig>" > + (serialize-configuration user-config home-fontconfig-configuration-fields) > + "</fontconfig>\n")))) > > (define (regenerate-font-cache-gexp _) > `(("profile/share/fonts" > @@ -59,7 +133,7 @@ (define home-fontconfig-service-type > (service-extension > home-profile-service-type > (const (list fontconfig))))) > - (default-value #f) > + (default-value (home-fontconfig-configuration)) > (description > "Provides configuration file for fontconfig and make > fc-* utilities aware of font packages installed in Guix Home's profile."))) Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 15:11:02 GMT) Full text and rfc822 format available.Message #101 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Fri, 30 Sep 2022 00:09:44 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI: >> * gnu/home.scm: Move home-fontconfig-service-type from >> home-environment-default-essential-services to %home-base-services. > Unless there is a precedent in system, I would make all the currently > "essential" services %home-base-services perhaps move their code > accordingly. I thought it was only for home-fontconfig-service. Does that mean delete "essential" services and move everything to %home-base-services? >> * gnu/home/services/base.scm: Add base. > Should be "New file." Also should probably be the first item in the > ChangeLog, so that other items can mention it. I understood that "Add base" should be "New file", but I didn't understand the second part. I apologize for my lack of understanding. Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 29 Sep 2022 16:05:01 GMT) Full text and rfc822 format available.Message #104 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: "(" <paren <at> disroot.org> To: "Taiju HIGASHI" <higashi <at> taiju.info>, Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [bug#57963] [PATCH 0/1] Support user's fontconfig. Date: Thu, 29 Sep 2022 17:02:41 +0100
Hey Taiju and Liliana, On Thu Sep 29, 2022 at 3:51 PM BST, Taiju HIGASHI wrote: > > Sure; I’m not a native speaker either but I can help. > > I know it will take some time, but I'll try my best. If you wish I'll help you with the manual. (I'm a native British English speaker.) -- (
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 30 Sep 2022 00:13:02 GMT) Full text and rfc822 format available.Message #107 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: "(" <paren <at> disroot.org> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [bug#57963] [PATCH 0/1] Support user's fontconfig. Date: Fri, 30 Sep 2022 09:12:26 +0900
Hi (, "(" <paren <at> disroot.org> writes: > Hey Taiju and Liliana, > > On Thu Sep 29, 2022 at 3:51 PM BST, Taiju HIGASHI wrote: >> > Sure; I’m not a native speaker either but I can help. >> >> I know it will take some time, but I'll try my best. > > If you wish I'll help you with the manual. (I'm a native > British English speaker.) > > -- ( Thank you, it helps! However, the interface may still change, so it will be a little while before I write documentation. Best Regards, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 30 Sep 2022 18:22:02 GMT) Full text and rfc822 format available.Message #110 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: liliana.prikler <at> gmail.com To: Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Fri, 30 Sep 2022 20:21:50 +0200
Am Freitag, dem 30.09.2022 um 00:09 +0900 schrieb Taiju HIGASHI: > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI: > > > * gnu/home.scm: Move home-fontconfig-service-type from > > > home-environment-default-essential-services to %home-base- > > > services. > > Unless there is a precedent in system, I would make all the > > currently > > "essential" services %home-base-services perhaps move their code > > accordingly. > > I thought it was only for home-fontconfig-service. Does that mean > delete "essential" services and move everything to %home-base- > services? I'd double-check with Andrew, but my personal opinion is "yes". > > > * gnu/home/services/base.scm: Add base. > > Should be "New file." Also should probably be the first item in > > the > > ChangeLog, so that other items can mention it. > > I understood that "Add base" should be "New file", but I didn't > understand the second part. I apologize for my lack of > understanding. It means put the * gnu/home/services/base.scm entry before the * gnu/home.scm one, so that you can mention the former in the latter. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 30 Sep 2022 18:31:01 GMT) Full text and rfc822 format available.Message #113 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: liliana.prikler <at> gmail.com To: Taiju HIGASHI <higashi <at> taiju.info>, Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Fri, 30 Sep 2022 20:30:02 +0200
Am Donnerstag, dem 29.09.2022 um 23:51 +0900 schrieb Taiju HIGASHI: > I know it will take some time, but I'll try my best. By the way, if > I edit the texi file, am I correct in confirming that I read the > built Info? After running `make', you should run `info doc/guix.info' and scroll to the edited section to verify that it reads as you intended. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 30 Sep 2022 18:35:01 GMT) Full text and rfc822 format available.Message #116 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: liliana.prikler <at> gmail.com To: Taiju HIGASHI <higashi <at> taiju.info>, 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Fri, 30 Sep 2022 20:34:08 +0200
Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI: > * gnu/home/services/fontutils.scm: Support user's fontconfig. > --- > gnu/home/services/fontutils.scm | 86 ++++++++++++++++++++++++++++++- > -- > 1 file changed, 80 insertions(+), 6 deletions(-) > > diff --git a/gnu/home/services/fontutils.scm > b/gnu/home/services/fontutils.scm > index 6062eaed6a..32127740f6 100644 > --- a/gnu/home/services/fontutils.scm > +++ b/gnu/home/services/fontutils.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> > ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -20,9 +21,16 @@ > (define-module (gnu home services fontutils) > #:use-module (gnu home services) > #:use-module (gnu packages fontutils) > + #:use-module (gnu services configuration) > #:use-module (guix gexp) > + #:use-module (guix records) > + #:use-module (srfi srfi-1) > + #:use-module (sxml simple) > + #:use-module (ice-9 match) > > - #:export (home-fontconfig-service-type)) > + #:export (home-fontconfig-service-type > + home-fontconfig-configuration > + default-font)) > > ;;; Commentary: > ;;; > @@ -33,15 +41,81 @@ (define-module (gnu home services fontutils) > ;;; > ;;; Code: > > -(define (add-fontconfig-config-file he-symlink-path) > +(define (default-font-sanitizer type) > + (lambda (value) > + (if (null? value) > + value > + `(alias > + (family ,type) > + (prefer > + (family ,value)))))) > + > +(define-record-type* <default-font> default-font > + make-default-font > + default-font? > + (serif default-font-serif > + (default '()) > + (sanitize (default-font-sanitizer 'serif))) > + (sans-serif defalut-font-sans-serif default-font-sans-serif > + (default '()) > + (sanitize (default-font-sanitizer 'sans-serif))) > + (monospace default-font-monospace > + (default '()) > + (sanitize (default-font-sanitizer 'monospace)))) Rather than having a null default and sanitizing the field as here, can we have an #f default and omit the field? Btw. I'm not sure whether making this an extra record is the right idea. Wouldn't "default-(serif|sans-serif|monospace)-family" at the root make more sense? Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 01 Oct 2022 11:09:01 GMT) Full text and rfc822 format available.Message #119 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: liliana.prikler <at> gmail.com Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Sat, 01 Oct 2022 20:08:32 +0900
liliana.prikler <at> gmail.com writes: > Am Freitag, dem 30.09.2022 um 00:09 +0900 schrieb Taiju HIGASHI: >> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: >> >> > Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI: >> > > * gnu/home.scm: Move home-fontconfig-service-type from >> > > home-environment-default-essential-services to %home-base- >> > > services. >> > Unless there is a precedent in system, I would make all the >> > currently >> > "essential" services %home-base-services perhaps move their code >> > accordingly. >> >> I thought it was only for home-fontconfig-service. Does that mean >> delete "essential" services and move everything to %home-base- >> services? > I'd double-check with Andrew, but my personal opinion is "yes". Noted. It may take some time until he can reply, but I will wait for Andrew's reply. >> > > * gnu/home/services/base.scm: Add base. >> > Should be "New file." Also should probably be the first item in >> > the >> > ChangeLog, so that other items can mention it. >> >> I understood that "Add base" should be "New file", but I didn't >> understand the second part. I apologize for my lack of >> understanding. > It means put the * gnu/home/services/base.scm entry before the * > gnu/home.scm one, so that you can mention the former in the latter. Thank you for the specific explanation, I understand. Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 01 Oct 2022 11:12:02 GMT) Full text and rfc822 format available.Message #122 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: liliana.prikler <at> gmail.com Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Sat, 01 Oct 2022 20:11:02 +0900
liliana.prikler <at> gmail.com writes: > Am Donnerstag, dem 29.09.2022 um 23:51 +0900 schrieb Taiju HIGASHI: >> I know it will take some time, but I'll try my best. By the way, if >> I edit the texi file, am I correct in confirming that I read the >> built Info? > After running `make', you should run `info doc/guix.info' and scroll to > the edited section to verify that it reads as you intended. > > Cheers Thank you, I will verify the edited documentation that way. Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 01 Oct 2022 11:21:01 GMT) Full text and rfc822 format available.Message #125 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: liliana.prikler <at> gmail.com Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Sat, 01 Oct 2022 20:19:51 +0900
liliana.prikler <at> gmail.com writes: > Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI: >> * gnu/home/services/fontutils.scm: Support user's fontconfig. >> --- >> gnu/home/services/fontutils.scm | 86 ++++++++++++++++++++++++++++++- >> -- >> 1 file changed, 80 insertions(+), 6 deletions(-) >> >> diff --git a/gnu/home/services/fontutils.scm >> b/gnu/home/services/fontutils.scm >> index 6062eaed6a..32127740f6 100644 >> --- a/gnu/home/services/fontutils.scm >> +++ b/gnu/home/services/fontutils.scm >> @@ -1,6 +1,7 @@ >> ;;; GNU Guix --- Functional package management for GNU >> ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> >> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> >> +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> >> ;;; >> ;;; This file is part of GNU Guix. >> ;;; >> @@ -20,9 +21,16 @@ >> (define-module (gnu home services fontutils) >> #:use-module (gnu home services) >> #:use-module (gnu packages fontutils) >> + #:use-module (gnu services configuration) >> #:use-module (guix gexp) >> + #:use-module (guix records) >> + #:use-module (srfi srfi-1) >> + #:use-module (sxml simple) >> + #:use-module (ice-9 match) >> >> - #:export (home-fontconfig-service-type)) >> + #:export (home-fontconfig-service-type >> + home-fontconfig-configuration >> + default-font)) >> >> ;;; Commentary: >> ;;; >> @@ -33,15 +41,81 @@ (define-module (gnu home services fontutils) >> ;;; >> ;;; Code: >> >> -(define (add-fontconfig-config-file he-symlink-path) >> +(define (default-font-sanitizer type) >> + (lambda (value) >> + (if (null? value) >> + value >> + `(alias >> + (family ,type) >> + (prefer >> + (family ,value)))))) >> + >> +(define-record-type* <default-font> default-font >> + make-default-font >> + default-font? >> + (serif default-font-serif >> + (default '()) >> + (sanitize (default-font-sanitizer 'serif))) >> + (sans-serif defalut-font-sans-serif > default-font-sans-serif >> + (default '()) >> + (sanitize (default-font-sanitizer 'sans-serif))) >> + (monospace default-font-monospace >> + (default '()) >> + (sanitize (default-font-sanitizer 'monospace)))) > Rather than having a null default and sanitizing the field as here, can > we have an #f default and omit the field? > > Btw. I'm not sure whether making this an extra record is the right > idea. Wouldn't "default-(serif|sans-serif|monospace)-family" at the > root make more sense? > > Cheers Do you mean to write as follows? --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 => (home-fontconfig-configuration (font-directories (list "~/fonts")) (default-serif-family "Noto Serif CJK JP") (default-sans-serif-family "Noto Sans CJK JP") (extra-config `((match (@ (target font)) (edit (@ (mode assign) (name antialias)) (bool true))))))))))) --8<---------------cut here---------------end--------------->8--- Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 01 Oct 2022 16:15:02 GMT) Full text and rfc822 format available.Message #128 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: liliana.prikler <at> gmail.com To: Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Sat, 01 Oct 2022 18:14:51 +0200
Am Samstag, dem 01.10.2022 um 20:19 +0900 schrieb Taiju HIGASHI: > liliana.prikler <at> gmail.com writes: > > > Am Donnerstag, dem 29.09.2022 um 23:36 +0900 schrieb Taiju HIGASHI: > > > * gnu/home/services/fontutils.scm: Support user's fontconfig. > > > --- > > > gnu/home/services/fontutils.scm | 86 > > > ++++++++++++++++++++++++++++++- > > > -- > > > 1 file changed, 80 insertions(+), 6 deletions(-) > > > > > > diff --git a/gnu/home/services/fontutils.scm > > > b/gnu/home/services/fontutils.scm > > > index 6062eaed6a..32127740f6 100644 > > > --- a/gnu/home/services/fontutils.scm > > > +++ b/gnu/home/services/fontutils.scm > > > @@ -1,6 +1,7 @@ > > > ;;; GNU Guix --- Functional package management for GNU > > > ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> > > > ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> > > > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > > > ;;; > > > ;;; This file is part of GNU Guix. > > > ;;; > > > @@ -20,9 +21,16 @@ > > > (define-module (gnu home services fontutils) > > > #:use-module (gnu home services) > > > #:use-module (gnu packages fontutils) > > > + #:use-module (gnu services configuration) > > > #:use-module (guix gexp) > > > + #:use-module (guix records) > > > + #:use-module (srfi srfi-1) > > > + #:use-module (sxml simple) > > > + #:use-module (ice-9 match) > > > > > > - #:export (home-fontconfig-service-type)) > > > + #:export (home-fontconfig-service-type > > > + home-fontconfig-configuration > > > + default-font)) > > > > > > ;;; Commentary: > > > ;;; > > > @@ -33,15 +41,81 @@ (define-module (gnu home services fontutils) > > > ;;; > > > ;;; Code: > > > > > > -(define (add-fontconfig-config-file he-symlink-path) > > > +(define (default-font-sanitizer type) > > > + (lambda (value) > > > + (if (null? value) > > > + value > > > + `(alias > > > + (family ,type) > > > + (prefer > > > + (family ,value)))))) > > > + > > > +(define-record-type* <default-font> default-font > > > + make-default-font > > > + default-font? > > > + (serif default-font-serif > > > + (default '()) > > > + (sanitize (default-font-sanitizer 'serif))) > > > + (sans-serif defalut-font-sans-serif > > default-font-sans-serif > > > + (default '()) > > > + (sanitize (default-font-sanitizer 'sans-serif))) > > > + (monospace default-font-monospace > > > + (default '()) > > > + (sanitize (default-font-sanitizer 'monospace)))) > > Rather than having a null default and sanitizing the field as here, > > can > > we have an #f default and omit the field? > > > > Btw. I'm not sure whether making this an extra record is the right > > idea. Wouldn't "default-(serif|sans-serif|monospace)-family" at > > the > > root make more sense? > > > > Cheers > > Do you mean to write as follows? > > --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 => (home-fontconfig-configuration > (font-directories > (list "~/fonts")) > (default-serif-family "Noto Serif CJK JP") > (default-sans-serif-family "Noto Sans CJK JP") > (extra-config > `((match (@ (target font)) > (edit (@ (mode assign) > (name antialias)) > (bool true))))))))))) > --8<---------------cut here---------------end--------------->8--- Yep. Feels more natural imho.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 01 Oct 2022 21:48:02 GMT) Full text and rfc822 format available.Message #131 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Sat, 01 Oct 2022 23:47:41 +0200
Hi, Taiju HIGASHI <higashi <at> taiju.info> skribis: > * gnu/home.scm: Move home-fontconfig-service-type from > home-environment-default-essential-services to %home-base-services. > * gnu/home/services/base.scm: Add base. In addition to what Liliana wrote, please make sure to add the new file to ‘gnu/local.mk’. > @@ -82,7 +82,6 @@ (define (home-environment-default-essential-services he) > > (service home-symlink-manager-service-type) > > - (service home-fontconfig-service-type) > (service home-xdg-base-directories-service-type) > (service home-shell-profile-service-type) Like Liliana wrote, it may be that more of these can be moved from “essential” to “base”, we can keep that for a later patch. Otherwise LGTM! Ludo’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 01 Oct 2022 21:58:02 GMT) Full text and rfc822 format available.Message #134 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Sat, 01 Oct 2022 23:57:18 +0200
Taiju HIGASHI <higashi <at> taiju.info> skribis: > * gnu/home/services/fontutils.scm: Support user's fontconfig. I’m nitpicking a bit, but here we would describe all the variables/procedures added, removed, or modified. Please check ‘git log’ for examples. Regarding code, there’s a convention to add a docstring to each top-level procedure: https://guix.gnu.org/manual/devel/en/html_node/Formatting-Code.html It would be nice to follow it here. > +(define (default-font-sanitizer type) > + (lambda (value) > + (if (null? value) > + value > + `(alias > + (family ,type) > + (prefer > + (family ,value)))))) Giving '() special meaning here looks quite unusual. As Liliana wrote, we’d usually use #f as the value denoting “nothing”. > +(define (sxml->xmlstring sxml) > + (if (null? sxml) > + "" > + (call-with-output-string > + (lambda (port) > + (sxml->xml sxml port))))) Same here. Also, “xml-string” rather than “xmlstring”. > +(define font-directories? list?) Is it really needed? > +(define (serialize-font-directories field-name value) > + (sxml->xmlstring > + (append > + '((dir "~/.guix-home/profile/share/fonts")) > + (map > + (lambda (path) > + `(dir ,path)) > + value)))) The indentation would rather be: (append '((dir …)) (map (lambda (directory) `(dir ,directory)) value)) > + (map (match-lambda > + ((? pair? sxml) sxml) > + ((? string? xml) (xml->sxml xml)) > + (_ (error "extra-config value must be xml string or sxml list."))) Instead of ‘error’, which would lead to an ugly backtrace and an untranslated error message, write: (raise (formatted-message (G_ "'extra-config' …"))) without a trailing dot in the message. The rest LGTM! Like I wrote, could you please add documentation in ‘doc/guix.texi’, with a configuration example like the one you gave? Thanks for all the work! Ludo’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 13:13:02 GMT) Full text and rfc822 format available.Message #137 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: [PATCH v5 1/2] home: services: Add base. Date: Sun, 2 Oct 2022 22:12:31 +0900
* gnu/home/services/base.scm: New file. * gnu/home.scm (): Move home-fontconfig-service-type from home-environment-default-essential-services to its %home-base-services. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- gnu/home.scm | 5 ++--- gnu/home/services/base.scm | 35 +++++++++++++++++++++++++++++++++++ gnu/local.mk | 2 ++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 gnu/home/services/base.scm diff --git a/gnu/home.scm b/gnu/home.scm index c95d1e0818..c79db87018 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -19,10 +19,10 @@ (define-module (gnu home) #:use-module (gnu home services) + #:use-module (gnu home services base) #:use-module (gnu home services symlink-manager) #:use-module (gnu home services shells) #:use-module (gnu home services xdg) - #:use-module (gnu home services fontutils) #:use-module (gnu services) #:use-module (guix records) #:use-module (guix diagnostics) @@ -66,7 +66,7 @@ (define-record-type* <home-environment> home-environment this-home-environment))) (services home-environment-user-services - (default '())) + (default %home-base-services)) (location home-environment-location ; <location> (default (and=> (current-source-location) @@ -82,7 +82,6 @@ (define (home-environment-default-essential-services he) (service home-symlink-manager-service-type) - (service home-fontconfig-service-type) (service home-xdg-base-directories-service-type) (service home-shell-profile-service-type) diff --git a/gnu/home/services/base.scm b/gnu/home/services/base.scm new file mode 100644 index 0000000000..fbf92ba213 --- /dev/null +++ b/gnu/home/services/base.scm @@ -0,0 +1,35 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> +;;; +;;; 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 <http://www.gnu.org/licenses/>. + +(define-module (gnu home services base) + #:use-module (gnu home services) + #:use-module (gnu home services fontutils) + #:export (%home-base-services)) + +;;; Commentary: +;; +;; Base home services---i,e., services that 99% of the users will want to use. +;; +;;; Code: + + +(define %home-base-services + ;; Convenience variable holding the basic services. + (list (service home-fontconfig-service-type))) + +;;; base.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 26fdfe7ca9..c0fceafd3f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -54,6 +54,7 @@ # Copyright © 2022 muradm <mail <at> muradm.net> # Copyright © 2022 Hilton Chain <hako <at> ultrarare.space> # Copyright © 2022 Alex Griffin <a <at> ajgrf.com> +# Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> # # This file is part of GNU Guix. # @@ -85,6 +86,7 @@ GNU_SYSTEM_MODULES = \ %D%/compression.scm \ %D%/home.scm \ %D%/home/services.scm \ + %D%/home/services/base.scm \ %D%/home/services/desktop.scm \ %D%/home/services/symlink-manager.scm \ %D%/home/services/fontutils.scm \ -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 13:16:02 GMT) Full text and rfc822 format available.Message #140 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: [PATCH v5 1/2] home: services: Add base. Date: Sun, 2 Oct 2022 22:15:34 +0900
* gnu/home/services/base.scm: New file. * gnu/home.scm (home-environment): Move home-fontconfig-service-type from home-environment-default-essential-services to %home-base-services of it. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- gnu/home.scm | 5 ++--- gnu/home/services/base.scm | 35 +++++++++++++++++++++++++++++++++++ gnu/local.mk | 2 ++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 gnu/home/services/base.scm diff --git a/gnu/home.scm b/gnu/home.scm index c95d1e0818..c79db87018 100644 --- a/gnu/home.scm +++ b/gnu/home.scm @@ -19,10 +19,10 @@ (define-module (gnu home) #:use-module (gnu home services) + #:use-module (gnu home services base) #:use-module (gnu home services symlink-manager) #:use-module (gnu home services shells) #:use-module (gnu home services xdg) - #:use-module (gnu home services fontutils) #:use-module (gnu services) #:use-module (guix records) #:use-module (guix diagnostics) @@ -66,7 +66,7 @@ (define-record-type* <home-environment> home-environment this-home-environment))) (services home-environment-user-services - (default '())) + (default %home-base-services)) (location home-environment-location ; <location> (default (and=> (current-source-location) @@ -82,7 +82,6 @@ (define (home-environment-default-essential-services he) (service home-symlink-manager-service-type) - (service home-fontconfig-service-type) (service home-xdg-base-directories-service-type) (service home-shell-profile-service-type) diff --git a/gnu/home/services/base.scm b/gnu/home/services/base.scm new file mode 100644 index 0000000000..fbf92ba213 --- /dev/null +++ b/gnu/home/services/base.scm @@ -0,0 +1,35 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> +;;; +;;; 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 <http://www.gnu.org/licenses/>. + +(define-module (gnu home services base) + #:use-module (gnu home services) + #:use-module (gnu home services fontutils) + #:export (%home-base-services)) + +;;; Commentary: +;; +;; Base home services---i,e., services that 99% of the users will want to use. +;; +;;; Code: + + +(define %home-base-services + ;; Convenience variable holding the basic services. + (list (service home-fontconfig-service-type))) + +;;; base.scm ends here diff --git a/gnu/local.mk b/gnu/local.mk index 26fdfe7ca9..c0fceafd3f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -54,6 +54,7 @@ # Copyright © 2022 muradm <mail <at> muradm.net> # Copyright © 2022 Hilton Chain <hako <at> ultrarare.space> # Copyright © 2022 Alex Griffin <a <at> ajgrf.com> +# Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> # # This file is part of GNU Guix. # @@ -85,6 +86,7 @@ GNU_SYSTEM_MODULES = \ %D%/compression.scm \ %D%/home.scm \ %D%/home/services.scm \ + %D%/home/services/base.scm \ %D%/home/services/desktop.scm \ %D%/home/services/symlink-manager.scm \ %D%/home/services/fontutils.scm \ -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 13:16:02 GMT) Full text and rfc822 format available.Message #143 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Sun, 2 Oct 2022 22:15:35 +0900
* gnu/home/services/fontutils.scm (add-fontconfig-config-file): Support user's fontconfig configuration. (home-fontconfig-configuration): New configuration for it. (string-list, maybe-string, maybe-extra-config-list): New types for it. (string-list?, extra-config-list?): New predicate procedures for it. (serialize-string-list, serialize-string, serialize-extra-config-list): New serialize procedures for it. (guix-home-font-dir): New variable. --- gnu/home/services/fontutils.scm | 89 ++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 6 deletions(-) diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm index 6062eaed6a..4b3caf3985 100644 --- a/gnu/home/services/fontutils.scm +++ b/gnu/home/services/fontutils.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,9 +21,17 @@ (define-module (gnu home services fontutils) #:use-module (gnu home services) #:use-module (gnu packages fontutils) + #:use-module (gnu services configuration) + #:use-module (guix diagnostics) #:use-module (guix gexp) + #:use-module (guix i18n) + #:use-module (guix records) + #:use-module (srfi srfi-1) + #:use-module (sxml simple) + #:use-module (ice-9 match) - #:export (home-fontconfig-service-type)) + #:export (home-fontconfig-service-type + home-fontconfig-configuration)) ;;; Commentary: ;;; @@ -33,15 +42,83 @@ (define-module (gnu home services fontutils) ;;; ;;; Code: -(define (add-fontconfig-config-file he-symlink-path) +(define (sxml->xml-string sxml) + "Serialize the sxml tree @var{tree} as XML. The output will be string." + (call-with-output-string + (lambda (port) + (sxml->xml sxml port)))) + +(define guix-home-font-dir "~/.guix-home/profile/share/fonts") + +(define (string-list? value) + (and (pair? value) (every string? value))) + +(define (serialize-string-list field-name value) + (sxml->xml-string + (map + (lambda (path) `(dir ,path)) + (if (member guix-home-font-dir value) + value + (append (list guix-home-font-dir) value))))) + +(define (serialize-string field-name value) + (define (serialize type value) + (sxml->xml-string + `(alias + (family ,type) + (prefer + (family ,value))))) + (match (list field-name value) + (('default-font-serif-family family) + (serialize 'serif family)) + (('default-font-sans-serif-family family) + (serialize 'sans-serif family)) + (('default-font-monospace-family family) + (serialize 'monospace family)))) + +(define-maybe string) + +(define extra-config-list? list?) + +(define-maybe extra-config-list) + +(define (serialize-extra-config-list field-name value) + (sxml->xml-string + (map (match-lambda + ((? pair? sxml) sxml) + ((? string? xml) (xml->sxml xml)) + (else + (raise (formatted-message + (G_ "'extra-config' type must be xml string or sxml list, was given: ~a") + value)))) + value))) + +(define-configuration home-fontconfig-configuration + (font-directories + (string-list (list guix-home-font-dir)) + "The directory list that provides fonts.") + (default-font-serif-family + maybe-string + "The preffered default fonts of serif.") + (default-font-sans-serif-family + maybe-string + "The preffered default fonts of sans-serif.") + (default-font-monospace-family + maybe-string + "The preffered default fonts of monospace.") + (extra-config + maybe-extra-config-list + "Extra configuration values to append to the fonts.conf.")) + +(define (add-fontconfig-config-file user-config) `(("fontconfig/fonts.conf" ,(mixed-text-file "fonts.conf" "<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> -<fontconfig> - <dir>~/.guix-home/profile/share/fonts</dir> -</fontconfig>")))) +<fontconfig>" + (serialize-configuration user-config home-fontconfig-configuration-fields) + "</fontconfig>\n")))) (define (regenerate-font-cache-gexp _) `(("profile/share/fonts" @@ -59,7 +136,7 @@ (define home-fontconfig-service-type (service-extension home-profile-service-type (const (list fontconfig))))) - (default-value #f) + (default-value (home-fontconfig-configuration)) (description "Provides configuration file for fontconfig and make fc-* utilities aware of font packages installed in Guix Home's profile."))) -- 2.37.3
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 13:21:02 GMT) Full text and rfc822 format available.Message #146 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [PATCH v5 1/2] home: services: Add base. Date: Sun, 02 Oct 2022 22:20:49 +0900
Hi, I'm sorry. This email is incorrect; the second email, "[PATCH v5 1/2] home: services: Add base." is correct. Taiju HIGASHI <higashi <at> taiju.info> writes: > * gnu/home/services/base.scm: New file. > * gnu/home.scm (): Move home-fontconfig-service-type from > home-environment-default-essential-services to its %home-base-services. > * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. > --- > gnu/home.scm | 5 ++--- > gnu/home/services/base.scm | 35 +++++++++++++++++++++++++++++++++++ > gnu/local.mk | 2 ++ > 3 files changed, 39 insertions(+), 3 deletions(-) > create mode 100644 gnu/home/services/base.scm > > diff --git a/gnu/home.scm b/gnu/home.scm > index c95d1e0818..c79db87018 100644 > --- a/gnu/home.scm > +++ b/gnu/home.scm > @@ -19,10 +19,10 @@ > > (define-module (gnu home) > #:use-module (gnu home services) > + #:use-module (gnu home services base) > #:use-module (gnu home services symlink-manager) > #:use-module (gnu home services shells) > #:use-module (gnu home services xdg) > - #:use-module (gnu home services fontutils) > #:use-module (gnu services) > #:use-module (guix records) > #:use-module (guix diagnostics) > @@ -66,7 +66,7 @@ (define-record-type* <home-environment> home-environment > this-home-environment))) > > (services home-environment-user-services > - (default '())) > + (default %home-base-services)) > > (location home-environment-location ; <location> > (default (and=> (current-source-location) > @@ -82,7 +82,6 @@ (define (home-environment-default-essential-services he) > > (service home-symlink-manager-service-type) > > - (service home-fontconfig-service-type) > (service home-xdg-base-directories-service-type) > (service home-shell-profile-service-type) > > diff --git a/gnu/home/services/base.scm b/gnu/home/services/base.scm > new file mode 100644 > index 0000000000..fbf92ba213 > --- /dev/null > +++ b/gnu/home/services/base.scm > @@ -0,0 +1,35 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > +;;; > +;;; 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 <http://www.gnu.org/licenses/>. > + > +(define-module (gnu home services base) > + #:use-module (gnu home services) > + #:use-module (gnu home services fontutils) > + #:export (%home-base-services)) > + > +;;; Commentary: > +;; > +;; Base home services---i,e., services that 99% of the users will want to use. > +;; > +;;; Code: > + > + > +(define %home-base-services > + ;; Convenience variable holding the basic services. > + (list (service home-fontconfig-service-type))) > + > +;;; base.scm ends here > diff --git a/gnu/local.mk b/gnu/local.mk > index 26fdfe7ca9..c0fceafd3f 100644 > --- a/gnu/local.mk > +++ b/gnu/local.mk > @@ -54,6 +54,7 @@ > # Copyright © 2022 muradm <mail <at> muradm.net> > # Copyright © 2022 Hilton Chain <hako <at> ultrarare.space> > # Copyright © 2022 Alex Griffin <a <at> ajgrf.com> > +# Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > # > # This file is part of GNU Guix. > # > @@ -85,6 +86,7 @@ GNU_SYSTEM_MODULES = \ > %D%/compression.scm \ > %D%/home.scm \ > %D%/home/services.scm \ > + %D%/home/services/base.scm \ > %D%/home/services/desktop.scm \ > %D%/home/services/symlink-manager.scm \ > %D%/home/services/fontutils.scm \ --
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 13:23:02 GMT) Full text and rfc822 format available.Message #149 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: liliana.prikler <at> gmail.com Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Sun, 02 Oct 2022 22:22:42 +0900
>> > > +(define-record-type* <default-font> default-font >> > > + make-default-font >> > > + default-font? >> > > + (serif default-font-serif >> > > + (default '()) >> > > + (sanitize (default-font-sanitizer 'serif))) >> > > + (sans-serif defalut-font-sans-serif >> > default-font-sans-serif >> > > + (default '()) >> > > + (sanitize (default-font-sanitizer 'sans-serif))) >> > > + (monospace default-font-monospace >> > > + (default '()) >> > > + (sanitize (default-font-sanitizer 'monospace)))) >> > Rather than having a null default and sanitizing the field as here, >> > can >> > we have an #f default and omit the field? >> > >> > Btw. I'm not sure whether making this an extra record is the right >> > idea. Wouldn't "default-(serif|sans-serif|monospace)-family" at >> > the >> > root make more sense? >> > >> > Cheers >> >> Do you mean to write as follows? >> >> --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 => (home-fontconfig-configuration >> (font-directories >> (list "~/fonts")) >> (default-serif-family "Noto Serif CJK JP") >> (default-sans-serif-family "Noto Sans CJK JP") >> (extra-config >> `((match (@ (target font)) >> (edit (@ (mode assign) >> (name antialias)) >> (bool true))))))))))) >> --8<---------------cut here---------------end--------------->8--- > Yep. Feels more natural imho. I have changed the interface as you suggested in the v5 patch. Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 13:40:01 GMT) Full text and rfc822 format available.Message #152 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [PATCH v4 2/2] home: fontutils: Support user's fontconfig. Date: Sun, 02 Oct 2022 22:38:55 +0900
Hi, Ludovic Courtès <ludo <at> gnu.org> writes: > Taiju HIGASHI <higashi <at> taiju.info> skribis: > >> * gnu/home/services/fontutils.scm: Support user's fontconfig. > > I’m nitpicking a bit, but here we would describe all the > variables/procedures added, removed, or modified. Please check ‘git > log’ for examples. > > Regarding code, there’s a convention to add a docstring to each > top-level procedure: > > https://guix.gnu.org/manual/devel/en/html_node/Formatting-Code.html > > It would be nice to follow it here. I have listed them all in the v5 patch. As for the serializer/predicate procedure, I did not add it because there was no docstring in the existing procedure. >> +(define (default-font-sanitizer type) >> + (lambda (value) >> + (if (null? value) >> + value >> + `(alias >> + (family ,type) >> + (prefer >> + (family ,value)))))) > > Giving '() special meaning here looks quite unusual. As Liliana wrote, > we’d usually use #f as the value denoting “nothing”. I may have confused it with Common Lisp. I have eliminated the field with the empty list as the default value. >> +(define (sxml->xmlstring sxml) >> + (if (null? sxml) >> + "" >> + (call-with-output-string >> + (lambda (port) >> + (sxml->xml sxml port))))) > > Same here. Also, “xml-string” rather than “xmlstring”. Fixed to xml-string. >> +(define font-directories? list?) > > Is it really needed? I may not have addressed this point yet. Is it possible to not define a predicate procedure to be used for a configuration field? >> +(define (serialize-font-directories field-name value) >> + (sxml->xmlstring >> + (append >> + '((dir "~/.guix-home/profile/share/fonts")) >> + (map >> + (lambda (path) >> + `(dir ,path)) >> + value)))) > > The indentation would rather be: > > (append '((dir …)) > (map (lambda (directory) > `(dir ,directory)) > value)) I think I fixed it by refactoring. >> + (map (match-lambda >> + ((? pair? sxml) sxml) >> + ((? string? xml) (xml->sxml xml)) >> + (_ (error "extra-config value must be xml string or sxml list."))) > > Instead of ‘error’, which would lead to an ugly backtrace and an > untranslated error message, write: > > (raise (formatted-message (G_ "'extra-config' …"))) > > without a trailing dot in the message. I have fixed it. > The rest LGTM! Like I wrote, could you please add documentation in > ‘doc/guix.texi’, with a configuration example like the one you gave? Since there were many points raised and interface changes in this case, I will revise the document after the review is complete. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 13:46:02 GMT) Full text and rfc822 format available.Message #155 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Sun, 02 Oct 2022 22:45:03 +0900
Ludovic Courtès <ludo <at> gnu.org> writes: > Hi, > > Taiju HIGASHI <higashi <at> taiju.info> skribis: > >> * gnu/home.scm: Move home-fontconfig-service-type from >> home-environment-default-essential-services to %home-base-services. >> * gnu/home/services/base.scm: Add base. > > In addition to what Liliana wrote, please make sure to add the new file > to ‘gnu/local.mk’. I have added it. >> @@ -82,7 +82,6 @@ (define (home-environment-default-essential-services he) >> >> (service home-symlink-manager-service-type) >> >> - (service home-fontconfig-service-type) >> (service home-xdg-base-directories-service-type) >> (service home-shell-profile-service-type) > > Like Liliana wrote, it may be that more of these can be moved from > “essential” to “base”, we can keep that for a later patch. Please let us address this in a later patch. I would like to discuss something with you. I'm aware that this patch is a breaking change. We are aware that if we do not add %base-home-services to the existing home configuration, fontconfig will change. I'm concerned about how the community will react to this. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 02 Oct 2022 15:00:02 GMT) Full text and rfc822 format available.Message #158 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info>, Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Sun, 02 Oct 2022 16:59:26 +0200
Am Sonntag, dem 02.10.2022 um 22:45 +0900 schrieb Taiju HIGASHI: > > Like Liliana wrote, it may be that more of these can be moved from > > “essential” to “base”, we can keep that for a later patch. > > Please let us address this in a later patch. > > I would like to discuss something with you. > I'm aware that this patch is a breaking change. We are aware that if > we do not add %base-home-services to the existing home configuration, > fontconfig will change. I'm concerned about how the community will > react to this. As long as the out-of-the-box behaviour stays the same, the community has no reason to complain. For what it's worth, you could also leave fontconfig as an essential service, but then you get another field to configure. As far as I see, essential services are also a thing on the system side, but the home and system variants have a somewhat different feel to them. The fontconfig-service is not actually essential, the profile service type arguably isn't either (it acts as yet another profile and simultaneously fails to satisfy the multi-profile use-case; more on that elsewhere), the xdg-base-directories one notably violates the XDG Base Directories specification, and so on. I'd get Andrew's approval before moving services, but I'd move them in one go rather than bit by bit. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Mon, 03 Oct 2022 23:28:02 GMT) Full text and rfc822 format available.Message #161 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, andrew <at> trop.in Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Tue, 04 Oct 2022 08:27:13 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Sonntag, dem 02.10.2022 um 22:45 +0900 schrieb Taiju HIGASHI: >> > Like Liliana wrote, it may be that more of these can be moved from >> > “essential” to “base”, we can keep that for a later patch. >> >> Please let us address this in a later patch. >> >> I would like to discuss something with you. >> I'm aware that this patch is a breaking change. We are aware that if >> we do not add %base-home-services to the existing home configuration, >> fontconfig will change. I'm concerned about how the community will >> react to this. > As long as the out-of-the-box behaviour stays the same, the community > has no reason to complain. For what it's worth, you could also leave > fontconfig as an essential service, but then you get another field to > configure. > > As far as I see, essential services are also a thing on the system > side, but the home and system variants have a somewhat different feel > to them. The fontconfig-service is not actually essential, the profile > service type arguably isn't either (it acts as yet another profile and > simultaneously fails to satisfy the multi-profile use-case; more on > that elsewhere), the xdg-base-directories one notably violates the XDG > Base Directories specification, and so on. I was relieved to hear that. > I'd get Andrew's approval before moving services, but I'd move them in > one go rather than bit by bit. Noted. I'll wait for his reply. Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 07 Oct 2022 05:21:02 GMT) Full text and rfc822 format available.Message #164 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: iliana.prikler <at> gmail.com, ludo <at> gnu.org, andrew <at> trop.in Subject: Next steps for this issue Date: Fri, 07 Oct 2022 14:20:46 +0900
Hi, What are the next steps for this issue? I recognize that the following work remains. 1. Review of the v5 patch 2. Consider which services to move from essentials services to base services 3. Modify Document If I forgot to do something, please point it out. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 07 Oct 2022 05:46:02 GMT) Full text and rfc822 format available.Message #167 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: Next steps for this issue Date: Fri, 07 Oct 2022 14:44:56 +0900
Hi Liliana, I'm sorry, I had the wrong email address. Taiju HIGASHI <higashi <at> taiju.info> writes: > Hi, > > What are the next steps for this issue? > > I recognize that the following work remains. > > 1. Review of the v5 patch > 2. Consider which services to move from essentials services to base services > 3. Modify Document > > If I forgot to do something, please point it out. > > Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Mon, 10 Oct 2022 05:51:01 GMT) Full text and rfc822 format available.Message #170 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Taiju HIGASHI <higashi <at> taiju.info>, Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [PATCH v4 1/2] home-services: Add base. Date: Mon, 10 Oct 2022 09:50:24 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-02 16:59, Liliana Marie Prikler wrote: > Am Sonntag, dem 02.10.2022 um 22:45 +0900 schrieb Taiju HIGASHI: >> > Like Liliana wrote, it may be that more of these can be moved from >> > “essential” to “base”, we can keep that for a later patch. >> >> Please let us address this in a later patch. >> >> I would like to discuss something with you. >> I'm aware that this patch is a breaking change. We are aware that if >> we do not add %base-home-services to the existing home configuration, >> fontconfig will change. I'm concerned about how the community will >> react to this. > As long as the out-of-the-box behaviour stays the same, the community > has no reason to complain. For what it's worth, you could also leave > fontconfig as an essential service, but then you get another field to > configure. > > As far as I see, essential services are also a thing on the system > side, but the home and system variants have a somewhat different feel > to them. Originially purpose was the same - to have services depending on home-environment record fields (fontconfig depended on symlink-path field, which was configurable back in the days), later we made ~/.guix-home hardcoded and did other changes to remove all the dependencies for essential services from home-environment. Now the purpose feels somewhat different, because it basically a good list of default services, but not actually essential. The only thing, that still depends on home-environment fields is home-profile-service-type. Globally, I'm good with the reorganization of essential services, but let's make another thread for this issue. > The fontconfig-service is not actually essential, the profile service > type arguably isn't either (it acts as yet another profile and > simultaneously fails to satisfy the multi-profile use-case; more on > that elsewhere), the xdg-base-directories one notably violates the XDG > Base Directories specification, and so on. > > I'd get Andrew's approval before moving services, but I'd move them in > one go rather than bit by bit. > > Cheers -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Mon, 10 Oct 2022 06:41:02 GMT) Full text and rfc822 format available.Message #173 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Taiju HIGASHI <higashi <at> taiju.info>, 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Mon, 10 Oct 2022 10:40:30 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-02 22:15, Taiju HIGASHI wrote: > * gnu/home/services/fontutils.scm (add-fontconfig-config-file): Support user's > fontconfig configuration. > (home-fontconfig-configuration): New configuration for it. > (string-list, maybe-string, maybe-extra-config-list): New types for it. > (string-list?, extra-config-list?): New predicate procedures for it. > (serialize-string-list, serialize-string, serialize-extra-config-list): New > serialize procedures for it. > (guix-home-font-dir): New variable. > --- > gnu/home/services/fontutils.scm | 89 ++++++++++++++++++++++++++++++--- > 1 file changed, 83 insertions(+), 6 deletions(-) > > diff --git a/gnu/home/services/fontutils.scm b/gnu/home/services/fontutils.scm > index 6062eaed6a..4b3caf3985 100644 > --- a/gnu/home/services/fontutils.scm > +++ b/gnu/home/services/fontutils.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2021 Andrew Tropin <andrew <at> trop.in> > ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz> > +;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -20,9 +21,17 @@ > (define-module (gnu home services fontutils) > #:use-module (gnu home services) > #:use-module (gnu packages fontutils) > + #:use-module (gnu services configuration) > + #:use-module (guix diagnostics) > #:use-module (guix gexp) > + #:use-module (guix i18n) > + #:use-module (guix records) > + #:use-module (srfi srfi-1) > + #:use-module (sxml simple) > + #:use-module (ice-9 match) > > - #:export (home-fontconfig-service-type)) > + #:export (home-fontconfig-service-type > + home-fontconfig-configuration)) > > ;;; Commentary: > ;;; > @@ -33,15 +42,83 @@ (define-module (gnu home services fontutils) > ;;; > ;;; Code: > > -(define (add-fontconfig-config-file he-symlink-path) > +(define (sxml->xml-string sxml) > + "Serialize the sxml tree @var{tree} as XML. The output will be string." > + (call-with-output-string > + (lambda (port) > + (sxml->xml sxml port)))) > + > +(define guix-home-font-dir "~/.guix-home/profile/share/fonts") > + > +(define (string-list? value) > + (and (pair? value) (every string? value))) Better to use list? here and in the other places, at least for the consistency, but also for semantic meaning. > + > +(define (serialize-string-list field-name value) > + (sxml->xml-string > + (map > + (lambda (path) `(dir ,path)) > + (if (member guix-home-font-dir value) > + value > + (append (list guix-home-font-dir) value))))) > + > +(define (serialize-string field-name value) > + (define (serialize type value) > + (sxml->xml-string > + `(alias > + (family ,type) > + (prefer > + (family ,value))))) > + (match (list field-name value) > + (('default-font-serif-family family) > + (serialize 'serif family)) > + (('default-font-sans-serif-family family) > + (serialize 'sans-serif family)) > + (('default-font-monospace-family family) > + (serialize 'monospace family)))) > + > +(define-maybe string) > + > +(define extra-config-list? list?) > + > +(define-maybe extra-config-list) > + > +(define (serialize-extra-config-list field-name value) > + (sxml->xml-string > + (map (match-lambda > + ((? pair? sxml) sxml) Other branches would never be visited because it will fail earlier by define-configuration predicate check for extra-config-list? (which is basically list?). Also, making multi-type fields is debatable, but isn't great IMO. If serialization would support G-exps, we could write (list #~"RAW_XML_HERE") or even something like this: (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) > + ((? string? xml) (xml->sxml xml)) > + (else > + (raise (formatted-message > + (G_ "'extra-config' type must be xml string or sxml list, was given: ~a") > + value)))) > + value))) > + > +(define-configuration home-fontconfig-configuration > + (font-directories > + (string-list (list guix-home-font-dir)) It's not a generic string-list, but a specific font-directories-list with extra logic inside. Also, because guix-home-font-dir always added to the list, the default value should '() and field should be called additional-font-directories instead. Otherwise it will be confusing, why guix-home-font-dir is not removed from the final configuration, when this field is set to a different value. I skimmed previous messages, but sorry, if I missed any already mentioned points. > + "The directory list that provides fonts.") > + (default-font-serif-family > + maybe-string > + "The preffered default fonts of serif.") > + (default-font-sans-serif-family > + maybe-string > + "The preffered default fonts of sans-serif.") > + (default-font-monospace-family > + maybe-string > + "The preffered default fonts of monospace.") > + (extra-config > + maybe-extra-config-list > + "Extra configuration values to append to the fonts.conf.")) > + > +(define (add-fontconfig-config-file user-config) > `(("fontconfig/fonts.conf" > ,(mixed-text-file > "fonts.conf" > "<?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > -<fontconfig> > - <dir>~/.guix-home/profile/share/fonts</dir> > -</fontconfig>")))) > +<fontconfig>" > + (serialize-configuration user-config home-fontconfig-configuration-fields) Just a thought for the future and a point for configuration module improvements: It would be cool if serialize-configuration and all other serialize- functions returned a G-exps, this way we could write something like that: (home-fontconfig-configuration (font-directories (list (file-append font-iosevka "/share/fonts")))) > + "</fontconfig>\n")))) > > (define (regenerate-font-cache-gexp _) > `(("profile/share/fonts" > @@ -59,7 +136,7 @@ (define home-fontconfig-service-type > (service-extension > home-profile-service-type > (const (list fontconfig))))) > - (default-value #f) > + (default-value (home-fontconfig-configuration)) > (description > "Provides configuration file for fontconfig and make > fc-* utilities aware of font packages installed in Guix Home's profile."))) -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Mon, 10 Oct 2022 16:16:02 GMT) Full text and rfc822 format available.Message #176 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Andrew Tropin <andrew <at> trop.in>, Taiju HIGASHI <higashi <at> taiju.info>, 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Mon, 10 Oct 2022 18:15:37 +0200
Am Montag, dem 10.10.2022 um 10:40 +0400 schrieb Andrew Tropin: > Also, because guix-home-font-dir always added to the list, the > default value should '() and field should be called > additional-font-directories instead. Otherwise it will be confusing, > why guix-home-font-dir is not removed from the final configuration, > when this field is set to a different value. Actually, I think the default value should (if possible) explicitly contain the one being added by Guix Home. I also think it shouldn't be added when the user explicitly removed it. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 11 Oct 2022 03:55:01 GMT) Full text and rfc822 format available.Message #179 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Andrew Tropin <andrew <at> trop.in> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Tue, 11 Oct 2022 12:54:19 +0900
Hi Andrew, Thank you for your review! >> +(define (string-list? value) >> + (and (pair? value) (every string? value))) > > Better to use list? here and in the other places, at least for the > consistency, but also for semantic meaning. OK. I'll rewrite it to below. --8<---------------cut here---------------start------------->8--- (define (string-list? value) (and (list? value) (every string? value))) --8<---------------cut here---------------end--------------->8--- >> + >> +(define (serialize-string-list field-name value) >> + (sxml->xml-string >> + (map >> + (lambda (path) `(dir ,path)) >> + (if (member guix-home-font-dir value) >> + value >> + (append (list guix-home-font-dir) value))))) >> + >> +(define (serialize-string field-name value) >> + (define (serialize type value) >> + (sxml->xml-string >> + `(alias >> + (family ,type) >> + (prefer >> + (family ,value))))) >> + (match (list field-name value) >> + (('default-font-serif-family family) >> + (serialize 'serif family)) >> + (('default-font-sans-serif-family family) >> + (serialize 'sans-serif family)) >> + (('default-font-monospace-family family) >> + (serialize 'monospace family)))) >> + >> +(define-maybe string) >> + >> +(define extra-config-list? list?) >> + >> +(define-maybe extra-config-list) >> + >> +(define (serialize-extra-config-list field-name value) >> + (sxml->xml-string >> + (map (match-lambda >> + ((? pair? sxml) sxml) > > Other branches would never be visited because it will fail earlier by > define-configuration predicate check for extra-config-list? (which is > basically list?). We can specify invalid value such as (list "foo" '(foo bar) 123). > Also, making multi-type fields is debatable, but isn't great IMO. I see. If we had to choose one or the other, I would prefer the string-type field. > If serialization would support G-exps, we could write > > (list #~"RAW_XML_HERE") > > or even something like this: > > (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) Does it mean that the specification does not allow it now? Or does it mean that it is not possible with my implementation? >> + ((? string? xml) (xml->sxml xml)) >> + (else >> + (raise (formatted-message >> + (G_ "'extra-config' type must be xml string or sxml list, was >> given: ~a") >> + value)))) >> + value))) >> + >> +(define-configuration home-fontconfig-configuration >> + (font-directories >> + (string-list (list guix-home-font-dir)) > > It's not a generic string-list, but a specific font-directories-list > with extra logic inside. > > Also, because guix-home-font-dir always added to the list, the default > value should '() and field should be called additional-font-directories > instead. Otherwise it will be confusing, why guix-home-font-dir is not > removed from the final configuration, when this field is set to a > different value. > > I skimmed previous messages, but sorry, if I missed any already > mentioned points. Sure, It is more appropriate that the field type is to font-directories-list field name is to additional-font-directories. >> + "The directory list that provides fonts.") >> + (default-font-serif-family >> + maybe-string >> + "The preffered default fonts of serif.") >> + (default-font-sans-serif-family >> + maybe-string >> + "The preffered default fonts of sans-serif.") >> + (default-font-monospace-family >> + maybe-string >> + "The preffered default fonts of monospace.") >> + (extra-config >> + maybe-extra-config-list >> + "Extra configuration values to append to the fonts.conf.")) >> + >> +(define (add-fontconfig-config-file user-config) >> `(("fontconfig/fonts.conf" >> ,(mixed-text-file >> "fonts.conf" >> "<?xml version='1.0'?> >> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >> -<fontconfig> >> - <dir>~/.guix-home/profile/share/fonts</dir> >> -</fontconfig>")))) >> +<fontconfig>" >> + (serialize-configuration user-config home-fontconfig-configuration-fields) > > Just a thought for the future and a point for configuration module > improvements: It would be cool if serialize-configuration and all other > serialize- functions returned a G-exps, this way we could write > something like that: > > (home-fontconfig-configuration > (font-directories (list (file-append font-iosevka "/share/fonts")))) Nice. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 11 Oct 2022 04:22:01 GMT) Full text and rfc822 format available.Message #182 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info>, Andrew Tropin <andrew <at> trop.in> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Tue, 11 Oct 2022 06:21:49 +0200
Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju HIGASHI: > We can specify invalid value such as (list "foo" '(foo bar) 123). It will be sanitized before that. > > Also, making multi-type fields is debatable, but isn't great IMO. > > I see. If we had to choose one or the other, I would prefer the > string-type field. Prefer sexp-type. > > If serialization would support G-exps, we could write > > > > (list #~"RAW_XML_HERE") > > > > or even something like this: > > > > (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) > > Does it mean that the specification does not allow it now? Or does it > mean that it is not possible with my implementation? I think your serialize would have to unpack the G-Expressions. You can test that with some example configs of your own. > > Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 11 Oct 2022 08:10:03 GMT) Full text and rfc822 format available.Message #185 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Tue, 11 Oct 2022 17:09:42 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju HIGASHI: >> We can specify invalid value such as (list "foo" '(foo bar) 123). > It will be sanitized before that. I'm sorry, I may not be getting it. When I reconfigure with the following settings: --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 => (home-fontconfig-configuration (extra-config (list "<dir>foo</dir>" 123)))))))) --8<---------------cut here---------------end--------------->8--- The following error occurs. --8<---------------cut here---------------start------------->8--- ./pre-inst-env guix home container home-fontconfig-config.scm Backtrace: In guix/monads.scm: 487:9 19 (_ _) In gnu/services.scm: 1137:16 18 (_ _) In guix/monads.scm: 487:9 17 (_ _) In gnu/services.scm: 1140:36 16 (_ _) In srfi/srfi-1.scm: 586:17 15 (map1 (#<<service> type: #<service-type home-fontconfig 7f1926abf…>)) In ice-9/eval.scm: 155:9 14 (_ #(#(#<directory (gnu home services fontutils) 7f1926df8780>) #)) 159:9 13 (_ #(#(#<directory (gnu home services fontutils) 7f1926df8780>) #)) 173:55 12 (_ #(#(#<directory (gnu home services fontutils) 7f1926df8780>) #)) In gnu/services/configuration.scm: 124:8 11 (serialize-configuration _ _) In srfi/srfi-1.scm: 586:29 10 (map1 (#<<configuration-field> name: font-directories type: str…> …)) 586:29 9 (map1 (#<<configuration-field> name: default-font-serif-family …> …)) 586:29 8 (map1 (#<<configuration-field> name: default-font-sans-serif-fa…> …)) 586:29 7 (map1 (#<<configuration-field> name: default-font-monospace-fam…> …)) 586:17 6 (map1 (#<<configuration-field> name: extra-config type: maybe-ext…>)) In ice-9/eval.scm: 155:9 5 (_ #(#(#<directory (gnu home services fontutils) 7f1926df8780>) # …)) In srfi/srfi-1.scm: 586:29 4 (map1 ("<dir>foo</dir>" 123)) 586:17 3 (map1 (123)) In unknown file: 2 (raise #<&formatted-message format: "'extra-config' type must be x…>) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Wrong type (expecting exact integer): #<&formatted-message format: "'extra-config' type must be xml string or sxml list, was given: ~a\n" arguments: (("<dir>foo</dir>" 123))> --8<---------------cut here---------------end--------------->8--- Is it sanitized before? >> > Also, making multi-type fields is debatable, but isn't great IMO. >> >> I see. If we had to choose one or the other, I would prefer the >> string-type field. > Prefer sexp-type. I too would like to write my settings in S-expression, but for users who know the XML format of fontconfig but do not know how to use SXML, I believe the effort of converting XML to SXML in their head and writing it cannot be ignored. Still, users can write settings in SXML and convert them to strings. That is a choice the user prefers to make; someone who doesn't know SXML writing strings and converting them to SXML is not a choice the user prefers to make. >> > If serialization would support G-exps, we could write >> > >> > (list #~"RAW_XML_HERE") >> > >> > or even something like this: >> > >> > (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) >> >> Does it mean that the specification does not allow it now? Or does it >> mean that it is not possible with my implementation? > I think your serialize would have to unpack the G-Expressions. You can > test that with some example configs of your own. Thank you. I'll give it a try. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 11 Oct 2022 18:25:02 GMT) Full text and rfc822 format available.Message #188 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Tue, 11 Oct 2022 20:24:48 +0200
Am Dienstag, dem 11.10.2022 um 17:09 +0900 schrieb Taiju HIGASHI: > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju HIGASHI: > > > We can specify invalid value such as (list "foo" '(foo bar) 123). > > It will be sanitized before that. > > I'm sorry, I may not be getting it. > > When I reconfigure with the following settings: > > --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 => (home-fontconfig-configuration > (extra-config > (list "<dir>foo</dir>" 123)))))))) > --8<---------------cut here---------------end--------------->8--- > > The following error occurs. > > --8<---------------cut here---------------start------------->8--- > ./pre-inst-env guix home container home-fontconfig-config.scm > Backtrace: > In guix/monads.scm: > 487:9 19 (_ _) > In gnu/services.scm: > 1137:16 18 (_ _) > In guix/monads.scm: > 487:9 17 (_ _) > In gnu/services.scm: > 1140:36 16 (_ _) > In srfi/srfi-1.scm: > 586:17 15 (map1 (#<<service> type: #<service-type home-fontconfig > 7f1926abf…>)) > In ice-9/eval.scm: > 155:9 14 (_ #(#(#<directory (gnu home services fontutils) > 7f1926df8780>) #)) > 159:9 13 (_ #(#(#<directory (gnu home services fontutils) > 7f1926df8780>) #)) > 173:55 12 (_ #(#(#<directory (gnu home services fontutils) > 7f1926df8780>) #)) > In gnu/services/configuration.scm: > 124:8 11 (serialize-configuration _ _) > In srfi/srfi-1.scm: > 586:29 10 (map1 (#<<configuration-field> name: font-directories > type: str…> …)) > 586:29 9 (map1 (#<<configuration-field> name: default-font-serif- > family …> …)) > 586:29 8 (map1 (#<<configuration-field> name: default-font-sans- > serif-fa…> …)) > 586:29 7 (map1 (#<<configuration-field> name: default-font- > monospace-fam…> …)) > 586:17 6 (map1 (#<<configuration-field> name: extra-config type: > maybe-ext…>)) > In ice-9/eval.scm: > 155:9 5 (_ #(#(#<directory (gnu home services fontutils) > 7f1926df8780>) # …)) > In srfi/srfi-1.scm: > 586:29 4 (map1 ("<dir>foo</dir>" 123)) > 586:17 3 (map1 (123)) > In unknown file: > 2 (raise #<&formatted-message format: "'extra-config' type > must be x…>) > In ice-9/boot-9.scm: > 1685:16 1 (raise-exception _ #:continuable? _) > 1685:16 0 (raise-exception _ #:continuable? _) > > ice-9/boot-9.scm:1685:16: In procedure raise-exception: > Wrong type (expecting exact integer): #<&formatted-message format: > "'extra-config' type must be xml string or sxml list, was given: > ~a\n" arguments: (("<dir>foo</dir>" 123))> > --8<---------------cut here---------------end--------------->8--- > > Is it sanitized before? That error seems to be coming from your sanitizer if I read this correctly. > > > > Also, making multi-type fields is debatable, but isn't great > > > > IMO. > > > > > > I see. If we had to choose one or the other, I would prefer the > > > string-type field. > > Prefer sexp-type. > > I too would like to write my settings in S-expression, but for users > who know the XML format of fontconfig but do not know how to use > SXML, I believe the effort of converting XML to SXML in their head > and writing it cannot be ignored. > Still, users can write settings in SXML and convert them to > strings. That is a choice the user prefers to make; someone who > doesn't know SXML writing strings and converting them to SXML is not > a choice the user prefers to make. You can likewise convert xml->sxml explicitly, there's not really any difference here. Providing this in a sanitizer just makes it more user-friendly. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 04:00:03 GMT) Full text and rfc822 format available.Message #191 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 12 Oct 2022 12:59:02 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Dienstag, dem 11.10.2022 um 17:09 +0900 schrieb Taiju HIGASHI: >> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: >> >> > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju HIGASHI: >> > > We can specify invalid value such as (list "foo" '(foo bar) 123). >> > It will be sanitized before that. >> >> I'm sorry, I may not be getting it. >> >> When I reconfigure with the following settings: >> >> --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 => (home-fontconfig-configuration >> (extra-config >> (list "<dir>foo</dir>" 123)))))))) >> --8<---------------cut here---------------end--------------->8--- >> >> The following error occurs. >> >> --8<---------------cut here---------------start------------->8--- >> ./pre-inst-env guix home container home-fontconfig-config.scm >> Backtrace: >> In guix/monads.scm: >> 487:9 19 (_ _) >> In gnu/services.scm: >> 1137:16 18 (_ _) >> In guix/monads.scm: >> 487:9 17 (_ _) >> In gnu/services.scm: >> 1140:36 16 (_ _) >> In srfi/srfi-1.scm: >> 586:17 15 (map1 (#<<service> type: #<service-type home-fontconfig >> 7f1926abf…>)) >> In ice-9/eval.scm: >> 155:9 14 (_ #(#(#<directory (gnu home services fontutils) >> 7f1926df8780>) #)) >> 159:9 13 (_ #(#(#<directory (gnu home services fontutils) >> 7f1926df8780>) #)) >> 173:55 12 (_ #(#(#<directory (gnu home services fontutils) >> 7f1926df8780>) #)) >> In gnu/services/configuration.scm: >> 124:8 11 (serialize-configuration _ _) >> In srfi/srfi-1.scm: >> 586:29 10 (map1 (#<<configuration-field> name: font-directories >> type: str…> …)) >> 586:29 9 (map1 (#<<configuration-field> name: default-font-serif- >> family …> …)) >> 586:29 8 (map1 (#<<configuration-field> name: default-font-sans- >> serif-fa…> …)) >> 586:29 7 (map1 (#<<configuration-field> name: default-font- >> monospace-fam…> …)) >> 586:17 6 (map1 (#<<configuration-field> name: extra-config type: >> maybe-ext…>)) >> In ice-9/eval.scm: >> 155:9 5 (_ #(#(#<directory (gnu home services fontutils) >> 7f1926df8780>) # …)) >> In srfi/srfi-1.scm: >> 586:29 4 (map1 ("<dir>foo</dir>" 123)) >> 586:17 3 (map1 (123)) >> In unknown file: >> 2 (raise #<&formatted-message format: "'extra-config' type >> must be x…>) >> In ice-9/boot-9.scm: >> 1685:16 1 (raise-exception _ #:continuable? _) >> 1685:16 0 (raise-exception _ #:continuable? _) >> >> ice-9/boot-9.scm:1685:16: In procedure raise-exception: >> Wrong type (expecting exact integer): #<&formatted-message format: >> "'extra-config' type must be xml string or sxml list, was given: >> ~a\n" arguments: (("<dir>foo</dir>" 123))> >> --8<---------------cut here---------------end--------------->8--- >> >> Is it sanitized before? > That error seems to be coming from your sanitizer if I read this > correctly. Yes, I think so. So I do not know what he meant when he said "Other branches would never be visited." Other branches would never be visited because it will fail earlier by define-configuration predicate check for extra-config-list? (which is basically list?). I may have misunderstood the location of the code to which his comment refers. >> > > > Also, making multi-type fields is debatable, but isn't great >> > > > IMO. >> > > >> > > I see. If we had to choose one or the other, I would prefer the >> > > string-type field. >> > Prefer sexp-type. >> >> I too would like to write my settings in S-expression, but for users >> who know the XML format of fontconfig but do not know how to use >> SXML, I believe the effort of converting XML to SXML in their head >> and writing it cannot be ignored. >> Still, users can write settings in SXML and convert them to >> strings. That is a choice the user prefers to make; someone who >> doesn't know SXML writing strings and converting them to SXML is not >> a choice the user prefers to make. > You can likewise convert xml->sxml explicitly, there's not really any > difference here. Providing this in a sanitizer just makes it more > user-friendly. I believe the v5 patch currently does that. Do you think a multi-type field is acceptable? Or do you think it is better to keep only the SXML-type field? Cheers, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 04:22:02 GMT) Full text and rfc822 format available.Message #194 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 12 Oct 2022 06:21:06 +0200
Am Mittwoch, dem 12.10.2022 um 12:59 +0900 schrieb Taiju HIGASHI: > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > Am Dienstag, dem 11.10.2022 um 17:09 +0900 schrieb Taiju HIGASHI: > > > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > > > > > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju > > > > HIGASHI: > > > > > We can specify invalid value such as (list "foo" '(foo bar) > > > > > 123). > > > > It will be sanitized before that. > > > > > > I'm sorry, I may not be getting it. > > > > > > When I reconfigure with the following settings: > > > > > > --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 => (home-fontconfig-configuration > > > (extra-config > > > (list "<dir>foo</dir>" 123)))))))) > > > --8<---------------cut here---------------end--------------->8--- > > > > > > The following error occurs. > > > > > > --8<---------------cut here---------------start------------->8--- > > > ./pre-inst-env guix home container home-fontconfig-config.scm > > > Backtrace: > > > In guix/monads.scm: > > > 487:9 19 (_ _) > > > In gnu/services.scm: > > > 1137:16 18 (_ _) > > > In guix/monads.scm: > > > 487:9 17 (_ _) > > > In gnu/services.scm: > > > 1140:36 16 (_ _) > > > In srfi/srfi-1.scm: > > > 586:17 15 (map1 (#<<service> type: #<service-type home- > > > fontconfig > > > 7f1926abf…>)) > > > In ice-9/eval.scm: > > > 155:9 14 (_ #(#(#<directory (gnu home services fontutils) > > > 7f1926df8780>) #)) > > > 159:9 13 (_ #(#(#<directory (gnu home services fontutils) > > > 7f1926df8780>) #)) > > > 173:55 12 (_ #(#(#<directory (gnu home services fontutils) > > > 7f1926df8780>) #)) > > > In gnu/services/configuration.scm: > > > 124:8 11 (serialize-configuration _ _) > > > In srfi/srfi-1.scm: > > > 586:29 10 (map1 (#<<configuration-field> name: font- > > > directories > > > type: str…> …)) > > > 586:29 9 (map1 (#<<configuration-field> name: default-font- > > > serif- > > > family …> …)) > > > 586:29 8 (map1 (#<<configuration-field> name: default-font- > > > sans- > > > serif-fa…> …)) > > > 586:29 7 (map1 (#<<configuration-field> name: default-font- > > > monospace-fam…> …)) > > > 586:17 6 (map1 (#<<configuration-field> name: extra-config > > > type: > > > maybe-ext…>)) > > > In ice-9/eval.scm: > > > 155:9 5 (_ #(#(#<directory (gnu home services fontutils) > > > 7f1926df8780>) # …)) > > > In srfi/srfi-1.scm: > > > 586:29 4 (map1 ("<dir>foo</dir>" 123)) > > > 586:17 3 (map1 (123)) > > > In unknown file: > > > 2 (raise #<&formatted-message format: "'extra-config' > > > type > > > must be x…>) > > > In ice-9/boot-9.scm: > > > 1685:16 1 (raise-exception _ #:continuable? _) > > > 1685:16 0 (raise-exception _ #:continuable? _) > > > > > > ice-9/boot-9.scm:1685:16: In procedure raise-exception: > > > Wrong type (expecting exact integer): #<&formatted-message > > > format: > > > "'extra-config' type must be xml string or sxml list, was given: > > > ~a\n" arguments: (("<dir>foo</dir>" 123))> > > > --8<---------------cut here---------------end--------------->8--- > > > > > > Is it sanitized before? > > That error seems to be coming from your sanitizer if I read this > > correctly. > > Yes, I think so. So I do not know what he meant when he said "Other > branches would never be visited." > > Other branches would never be visited because it will fail > earlier > by define-configuration predicate check for extra-config-list? > (which is basically list?). > > I may have misunderstood the location of the code to which his > comment refers. I think this basically means that you can't have a raw string, but only a list of strings, which conflicts with how you distinguish xml and sxml? > > > > > > Also, making multi-type fields is debatable, but isn't > > > > > > great > > > > > > IMO. > > > > > > > > > > I see. If we had to choose one or the other, I would prefer > > > > > the > > > > > string-type field. > > > > Prefer sexp-type. > > > > > > I too would like to write my settings in S-expression, but for > > > users > > > who know the XML format of fontconfig but do not know how to use > > > SXML, I believe the effort of converting XML to SXML in their > > > head > > > and writing it cannot be ignored. > > > Still, users can write settings in SXML and convert them to > > > strings. That is a choice the user prefers to make; someone who > > > doesn't know SXML writing strings and converting them to SXML is > > > not > > > a choice the user prefers to make. > > You can likewise convert xml->sxml explicitly, there's not really > > any > > difference here. Providing this in a sanitizer just makes it more > > user-friendly. > > I believe the v5 patch currently does that. Do you think a multi-type > field is acceptable? Or do you think it is better to keep only the > SXML-type field? I think the field, once sanitized, should be SXML. I care little about what happens before. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 06:07:02 GMT) Full text and rfc822 format available.Message #197 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Taiju HIGASHI <higashi <at> taiju.info>, 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 12 Oct 2022 10:05:56 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-10 18:15, Liliana Marie Prikler wrote: > Am Montag, dem 10.10.2022 um 10:40 +0400 schrieb Andrew Tropin: >> Also, because guix-home-font-dir always added to the list, the >> default value should '() and field should be called >> additional-font-directories instead. Otherwise it will be confusing, >> why guix-home-font-dir is not removed from the final configuration, >> when this field is set to a different value. > Actually, I think the default value should (if possible) explicitly > contain the one being added by Guix Home. I also think it shouldn't be > added when the user explicitly removed it. > Completely agree. Probably I had to be more explicit on the implication of my comment. -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 06:44:02 GMT) Full text and rfc822 format available.Message #200 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 12 Oct 2022 10:43:34 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-11 12:54, Taiju HIGASHI wrote: > Hi Andrew, > > Thank you for your review! > >>> +(define (string-list? value) >>> + (and (pair? value) (every string? value))) >> >> Better to use list? here and in the other places, at least for the >> consistency, but also for semantic meaning. > > OK. I'll rewrite it to below. > > --8<---------------cut here---------------start------------->8--- > (define (string-list? value) > (and (list? value) (every string? value))) > --8<---------------cut here---------------end--------------->8--- > >>> + >>> +(define (serialize-string-list field-name value) >>> + (sxml->xml-string >>> + (map >>> + (lambda (path) `(dir ,path)) >>> + (if (member guix-home-font-dir value) >>> + value >>> + (append (list guix-home-font-dir) value))))) >>> + >>> +(define (serialize-string field-name value) >>> + (define (serialize type value) >>> + (sxml->xml-string >>> + `(alias >>> + (family ,type) >>> + (prefer >>> + (family ,value))))) >>> + (match (list field-name value) >>> + (('default-font-serif-family family) >>> + (serialize 'serif family)) >>> + (('default-font-sans-serif-family family) >>> + (serialize 'sans-serif family)) >>> + (('default-font-monospace-family family) >>> + (serialize 'monospace family)))) >>> + >>> +(define-maybe string) >>> + >>> +(define extra-config-list? list?) >>> + >>> +(define-maybe extra-config-list) >>> + >>> +(define (serialize-extra-config-list field-name value) >>> + (sxml->xml-string >>> + (map (match-lambda >>> + ((? pair? sxml) sxml) >> >> Other branches would never be visited because it will fail earlier by >> define-configuration predicate check for extra-config-list? (which is >> basically list?). Oh, I missed the map over the list elements and slightly missread the code. I thought (according to my incorrect perception of implementation) extra-config have to be either sxml or string, that's is why I said that it will fail earlier because plan string value won't satisfy list predicate attached to extra-config field, but in a fact extra-config is always a list, but can be a list of sxml's and strings mixed together. Thus, some of my comments are invalid. Sorry for the confusion. I'll rephrase and elaborate in the later message. > > We can specify invalid value such as (list "foo" '(foo bar) 123). > >> Also, making multi-type fields is debatable, but isn't great IMO. > > I see. If we had to choose one or the other, I would prefer the > string-type field. > >> If serialization would support G-exps, we could write >> >> (list #~"RAW_XML_HERE") >> >> or even something like this: >> >> (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) > > Does it mean that the specification does not allow it now? Or does it > mean that it is not possible with my implementation? > It's not possible with the current implementation. >>> + ((? string? xml) (xml->sxml xml)) + (else + (raise >>> (formatted-message + (G_ "'extra-config' type must be xml string or >>> sxml list, was given: ~a") + value)))) + value))) + >>> +(define-configuration home-fontconfig-configuration + >>> (font-directories + (string-list (list guix-home-font-dir)) >> >> It's not a generic string-list, but a specific font-directories-list >> with extra logic inside. >> >> Also, because guix-home-font-dir always added to the list, the default >> value should '() and field should be called additional-font-directories >> instead. Otherwise it will be confusing, why guix-home-font-dir is not >> removed from the final configuration, when this field is set to a >> different value. >> >> I skimmed previous messages, but sorry, if I missed any already >> mentioned points. > > Sure, It is more appropriate that the field type is to > font-directories-list field name is to additional-font-directories. > As Liliana mentioned in the other message, it's better not to set anything implicitly. It's better to keep the name, but change the implementation and remove implicitly and unconditionally added directory. >>> + "The directory list that provides fonts.") >>> + (default-font-serif-family >>> + maybe-string >>> + "The preffered default fonts of serif.") >>> + (default-font-sans-serif-family >>> + maybe-string >>> + "The preffered default fonts of sans-serif.") >>> + (default-font-monospace-family >>> + maybe-string >>> + "The preffered default fonts of monospace.") >>> + (extra-config >>> + maybe-extra-config-list >>> + "Extra configuration values to append to the fonts.conf.")) >>> + >>> +(define (add-fontconfig-config-file user-config) >>> `(("fontconfig/fonts.conf" >>> ,(mixed-text-file >>> "fonts.conf" >>> "<?xml version='1.0'?> >>> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >>> -<fontconfig> >>> - <dir>~/.guix-home/profile/share/fonts</dir> >>> -</fontconfig>")))) >>> +<fontconfig>" >>> + (serialize-configuration user-config home-fontconfig-configuration-fields) >> >> Just a thought for the future and a point for configuration module >> improvements: It would be cool if serialize-configuration and all other >> serialize- functions returned a G-exps, this way we could write >> something like that: >> >> (home-fontconfig-configuration >> (font-directories (list (file-append font-iosevka "/share/fonts")))) > > Nice. > > Thanks, > -- > Taiju -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 07:08:01 GMT) Full text and rfc822 format available.Message #203 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org Subject: Almost plain SXML serializer Date: Wed, 12 Oct 2022 11:07:33 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-11 06:21, Liliana Marie Prikler wrote: > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju HIGASHI: >> We can specify invalid value such as (list "foo" '(foo bar) 123). > It will be sanitized before that. > >> > Also, making multi-type fields is debatable, but isn't great IMO. >> >> I see. If we had to choose one or the other, I would prefer the >> string-type field. > Prefer sexp-type. > Current (v5) extra-config has a list type. This list can contain strings and nested lists, string elements are for raw XML, and list elements are for SXML. This is done I guess to support following use case: --8<---------------cut here---------------start------------->8--- (list "<tag>Already existing XML copied from existing .xml file, which we don't want to rewrite to SXML.</tag>" '((tag (@ (attr1 "value1") (attr2 "value2")) (nested "Part of the configuration defined with SXML") (empty))) "<another-tag>Maybe some other part of raw XML</another-tag>") --8<---------------cut here---------------end--------------->8--- This way we can combine SXML with already existing raw XML. Am I right? >> > If serialization would support G-exps, we could write >> > >> > (list #~"RAW_XML_HERE") >> > >> > or even something like this: >> > >> > (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) >> >> Does it mean that the specification does not allow it now? Or does it >> mean that it is not possible with my implementation? > I think your serialize would have to unpack the G-Expressions. You can > test that with some example configs of your own. > >> > > Cheers -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 11:39:02 GMT) Full text and rfc822 format available.Message #206 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Andrew Tropin <andrew <at> trop.in> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 12 Oct 2022 20:38:11 +0900
Andrew Tropin <andrew <at> trop.in> writes: > On 2022-10-11 12:54, Taiju HIGASHI wrote: > >> Hi Andrew, >> >> Thank you for your review! >> >>>> +(define (string-list? value) >>>> + (and (pair? value) (every string? value))) >>> >>> Better to use list? here and in the other places, at least for the >>> consistency, but also for semantic meaning. >> >> OK. I'll rewrite it to below. >> >> --8<---------------cut here---------------start------------->8--- >> (define (string-list? value) >> (and (list? value) (every string? value))) >> --8<---------------cut here---------------end--------------->8--- >> >>>> + >>>> +(define (serialize-string-list field-name value) >>>> + (sxml->xml-string >>>> + (map >>>> + (lambda (path) `(dir ,path)) >>>> + (if (member guix-home-font-dir value) >>>> + value >>>> + (append (list guix-home-font-dir) value))))) >>>> + >>>> +(define (serialize-string field-name value) >>>> + (define (serialize type value) >>>> + (sxml->xml-string >>>> + `(alias >>>> + (family ,type) >>>> + (prefer >>>> + (family ,value))))) >>>> + (match (list field-name value) >>>> + (('default-font-serif-family family) >>>> + (serialize 'serif family)) >>>> + (('default-font-sans-serif-family family) >>>> + (serialize 'sans-serif family)) >>>> + (('default-font-monospace-family family) >>>> + (serialize 'monospace family)))) >>>> + >>>> +(define-maybe string) >>>> + >>>> +(define extra-config-list? list?) >>>> + >>>> +(define-maybe extra-config-list) >>>> + >>>> +(define (serialize-extra-config-list field-name value) >>>> + (sxml->xml-string >>>> + (map (match-lambda >>>> + ((? pair? sxml) sxml) >>> >>> Other branches would never be visited because it will fail earlier by >>> define-configuration predicate check for extra-config-list? (which is >>> basically list?). > > Oh, I missed the map over the list elements and slightly missread the > code. I thought (according to my incorrect perception of > implementation) extra-config have to be either sxml or string, that's is > why I said that it will fail earlier because plan string value won't > satisfy list predicate attached to extra-config field, but in a fact > extra-config is always a list, but can be a list of sxml's and strings > mixed together. > > Thus, some of my comments are invalid. Sorry for the confusion. I'll > rephrase and elaborate in the later message. I was worried that I was the only one who did not understand the code I wrote, but I've relieved to hear that it was a misunderstanding :) Is it OK to have multiple data types (XML string and SXML list) in a list? >> We can specify invalid value such as (list "foo" '(foo bar) 123). >> >>> Also, making multi-type fields is debatable, but isn't great IMO. >> >> I see. If we had to choose one or the other, I would prefer the >> string-type field. >> >>> If serialization would support G-exps, we could write >>> >>> (list #~"RAW_XML_HERE") >>> >>> or even something like this: >>> >>> (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) >> >> Does it mean that the specification does not allow it now? Or does it >> mean that it is not possible with my implementation? >> > > It's not possible with the current implementation. I'll try to modify it so that it can support G-exps. >>>> + ((? string? xml) (xml->sxml xml)) + (else + (raise >>>> (formatted-message + (G_ "'extra-config' type must be xml string or >>>> sxml list, was given: ~a") + value)))) + value))) + >>>> +(define-configuration home-fontconfig-configuration + >>>> (font-directories + (string-list (list guix-home-font-dir)) >>> >>> It's not a generic string-list, but a specific font-directories-list >>> with extra logic inside. >>> >>> Also, because guix-home-font-dir always added to the list, the default >>> value should '() and field should be called additional-font-directories >>> instead. Otherwise it will be confusing, why guix-home-font-dir is not >>> removed from the final configuration, when this field is set to a >>> different value. >>> >>> I skimmed previous messages, but sorry, if I missed any already >>> mentioned points. >> >> Sure, It is more appropriate that the field type is to >> font-directories-list field name is to additional-font-directories. >> > > As Liliana mentioned in the other message, it's better not to set > anything implicitly. It's better to keep the name, but change the > implementation and remove implicitly and unconditionally added > directory. OK. I'll modify the default value to an empty list and include ~/.guix-home/profile/share/fonts in the sample code in the documentation. >>>> + "The directory list that provides fonts.") >>>> + (default-font-serif-family >>>> + maybe-string >>>> + "The preffered default fonts of serif.") >>>> + (default-font-sans-serif-family >>>> + maybe-string >>>> + "The preffered default fonts of sans-serif.") >>>> + (default-font-monospace-family >>>> + maybe-string >>>> + "The preffered default fonts of monospace.") >>>> + (extra-config >>>> + maybe-extra-config-list >>>> + "Extra configuration values to append to the fonts.conf.")) >>>> + >>>> +(define (add-fontconfig-config-file user-config) >>>> `(("fontconfig/fonts.conf" >>>> ,(mixed-text-file >>>> "fonts.conf" >>>> "<?xml version='1.0'?> >>>> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >>>> -<fontconfig> >>>> - <dir>~/.guix-home/profile/share/fonts</dir> >>>> -</fontconfig>")))) >>>> +<fontconfig>" >>>> + (serialize-configuration user-config home-fontconfig-configuration-fields) >>> >>> Just a thought for the future and a point for configuration module >>> improvements: It would be cool if serialize-configuration and all other >>> serialize- functions returned a G-exps, this way we could write >>> something like that: >>> >>> (home-fontconfig-configuration >>> (font-directories (list (file-append font-iosevka "/share/fonts")))) >> >> Nice. >> >> Thanks, >> -- >> Taiju Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 11:43:05 GMT) Full text and rfc822 format available.Message #209 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Andrew Tropin <andrew <at> trop.in> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com> Subject: Re: Almost plain SXML serializer Date: Wed, 12 Oct 2022 20:42:05 +0900
Andrew Tropin <andrew <at> trop.in> writes: > On 2022-10-11 06:21, Liliana Marie Prikler wrote: > >> Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju HIGASHI: >>> We can specify invalid value such as (list "foo" '(foo bar) 123). >> It will be sanitized before that. >> >>> > Also, making multi-type fields is debatable, but isn't great IMO. >>> >>> I see. If we had to choose one or the other, I would prefer the >>> string-type field. >> Prefer sexp-type. >> > > Current (v5) extra-config has a list type. This list can contain strings > and nested lists, string elements are for raw XML, and list > elements are for SXML. > > This is done I guess to support following use case: > > (list "<tag>Already existing XML copied from existing .xml file, which > we don't want to rewrite to SXML.</tag>" > '((tag (@ (attr1 "value1") > (attr2 "value2")) > (nested "Part of the configuration defined with SXML") > (empty))) > "<another-tag>Maybe some other part of raw XML</another-tag>") > > This way we can combine SXML with already existing raw XML. > > Am I right? You're right. The current implementation allows XML string and SXML list in the list. Also, it can mix those. >>> > If serialization would support G-exps, we could write >>> > >>> > (list #~"RAW_XML_HERE") >>> > >>> > or even something like this: >>> > >>> > (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) >>> >>> Does it mean that the specification does not allow it now? Or does it >>> mean that it is not possible with my implementation? >> I think your serialize would have to unpack the G-Expressions. You can >> test that with some example configs of your own. >> >>> > >> Cheers Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 12:42:01 GMT) Full text and rfc822 format available.Message #212 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 12 Oct 2022 16:41:16 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-12 20:38, Taiju HIGASHI wrote: > Andrew Tropin <andrew <at> trop.in> writes: > >> On 2022-10-11 12:54, Taiju HIGASHI wrote: >> >>> Hi Andrew, >>> >>> Thank you for your review! >>> >>>>> +(define (string-list? value) >>>>> + (and (pair? value) (every string? value))) >>>> >>>> Better to use list? here and in the other places, at least for the >>>> consistency, but also for semantic meaning. >>> >>> OK. I'll rewrite it to below. >>> >>> --8<---------------cut here---------------start------------->8--- >>> (define (string-list? value) >>> (and (list? value) (every string? value))) >>> --8<---------------cut here---------------end--------------->8--- >>> >>>>> + >>>>> +(define (serialize-string-list field-name value) >>>>> + (sxml->xml-string >>>>> + (map >>>>> + (lambda (path) `(dir ,path)) >>>>> + (if (member guix-home-font-dir value) >>>>> + value >>>>> + (append (list guix-home-font-dir) value))))) >>>>> + >>>>> +(define (serialize-string field-name value) >>>>> + (define (serialize type value) >>>>> + (sxml->xml-string >>>>> + `(alias >>>>> + (family ,type) >>>>> + (prefer >>>>> + (family ,value))))) >>>>> + (match (list field-name value) >>>>> + (('default-font-serif-family family) >>>>> + (serialize 'serif family)) >>>>> + (('default-font-sans-serif-family family) >>>>> + (serialize 'sans-serif family)) >>>>> + (('default-font-monospace-family family) >>>>> + (serialize 'monospace family)))) >>>>> + >>>>> +(define-maybe string) >>>>> + >>>>> +(define extra-config-list? list?) >>>>> + >>>>> +(define-maybe extra-config-list) >>>>> + >>>>> +(define (serialize-extra-config-list field-name value) >>>>> + (sxml->xml-string >>>>> + (map (match-lambda >>>>> + ((? pair? sxml) sxml) >>>> >>>> Other branches would never be visited because it will fail earlier by >>>> define-configuration predicate check for extra-config-list? (which is >>>> basically list?). >> >> Oh, I missed the map over the list elements and slightly missread the >> code. I thought (according to my incorrect perception of >> implementation) extra-config have to be either sxml or string, that's is >> why I said that it will fail earlier because plan string value won't >> satisfy list predicate attached to extra-config field, but in a fact >> extra-config is always a list, but can be a list of sxml's and strings >> mixed together. >> >> Thus, some of my comments are invalid. Sorry for the confusion. I'll >> rephrase and elaborate in the later message. > > I was worried that I was the only one who did not understand the code I > wrote, but I've relieved to hear that it was a misunderstanding :) > > Is it OK to have multiple data types (XML string and SXML list) in a > list? > I think it's not a great practice, I'll describe an alternative approach in the other message. >>> We can specify invalid value such as (list "foo" '(foo bar) 123). >>> >>>> Also, making multi-type fields is debatable, but isn't great IMO. >>> >>> I see. If we had to choose one or the other, I would prefer the >>> string-type field. >>> >>>> If serialization would support G-exps, we could write >>>> >>>> (list #~"RAW_XML_HERE") >>>> >>>> or even something like this: >>>> >>>> (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) >>> >>> Does it mean that the specification does not allow it now? Or does it >>> mean that it is not possible with my implementation? >>> >> >> It's not possible with the current implementation. > > I'll try to modify it so that it can support G-exps. > >>>>> + ((? string? xml) (xml->sxml xml)) + (else + (raise >>>>> (formatted-message + (G_ "'extra-config' type must be xml string or >>>>> sxml list, was given: ~a") + value)))) + value))) + >>>>> +(define-configuration home-fontconfig-configuration + >>>>> (font-directories + (string-list (list guix-home-font-dir)) >>>> >>>> It's not a generic string-list, but a specific font-directories-list >>>> with extra logic inside. >>>> >>>> Also, because guix-home-font-dir always added to the list, the default >>>> value should '() and field should be called additional-font-directories >>>> instead. Otherwise it will be confusing, why guix-home-font-dir is not >>>> removed from the final configuration, when this field is set to a >>>> different value. >>>> >>>> I skimmed previous messages, but sorry, if I missed any already >>>> mentioned points. >>> >>> Sure, It is more appropriate that the field type is to >>> font-directories-list field name is to additional-font-directories. >>> >> >> As Liliana mentioned in the other message, it's better not to set >> anything implicitly. It's better to keep the name, but change the >> implementation and remove implicitly and unconditionally added >> directory. > > OK. I'll modify the default value to an empty list and include > ~/.guix-home/profile/share/fonts in the sample code in the > documentation. > The default value is good, but the code, which always adds ~/.guix-home/profile/share/fonts to fontdirs is not. --8<---------------cut here---------------start------------->8--- + (if (member guix-home-font-dir value) + value + (append (list guix-home-font-dir) value)) --8<---------------cut here---------------end--------------->8--- >>>>> + "The directory list that provides fonts.") >>>>> + (default-font-serif-family >>>>> + maybe-string >>>>> + "The preffered default fonts of serif.") >>>>> + (default-font-sans-serif-family >>>>> + maybe-string >>>>> + "The preffered default fonts of sans-serif.") >>>>> + (default-font-monospace-family >>>>> + maybe-string >>>>> + "The preffered default fonts of monospace.") >>>>> + (extra-config >>>>> + maybe-extra-config-list >>>>> + "Extra configuration values to append to the fonts.conf.")) >>>>> + >>>>> +(define (add-fontconfig-config-file user-config) >>>>> `(("fontconfig/fonts.conf" >>>>> ,(mixed-text-file >>>>> "fonts.conf" >>>>> "<?xml version='1.0'?> >>>>> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >>>>> -<fontconfig> >>>>> - <dir>~/.guix-home/profile/share/fonts</dir> >>>>> -</fontconfig>")))) >>>>> +<fontconfig>" >>>>> + (serialize-configuration user-config home-fontconfig-configuration-fields) >>>> >>>> Just a thought for the future and a point for configuration module >>>> improvements: It would be cool if serialize-configuration and all other >>>> serialize- functions returned a G-exps, this way we could write >>>> something like that: >>>> >>>> (home-fontconfig-configuration >>>> (font-directories (list (file-append font-iosevka "/share/fonts")))) >>> >>> Nice. >>> >>> Thanks, >>> -- >>> Taiju > > Thanks, > -- > Taiju -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 13:04:02 GMT) Full text and rfc822 format available.Message #215 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com> Subject: Re: Almost plain SXML serializer Date: Wed, 12 Oct 2022 17:03:27 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-12 20:42, Taiju HIGASHI wrote: > Andrew Tropin <andrew <at> trop.in> writes: > >> On 2022-10-11 06:21, Liliana Marie Prikler wrote: >> >>> Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju HIGASHI: >>>> We can specify invalid value such as (list "foo" '(foo bar) 123). >>> It will be sanitized before that. >>> >>>> > Also, making multi-type fields is debatable, but isn't great IMO. >>>> >>>> I see. If we had to choose one or the other, I would prefer the >>>> string-type field. >>> Prefer sexp-type. >>> >> >> Current (v5) extra-config has a list type. This list can contain strings >> and nested lists, string elements are for raw XML, and list >> elements are for SXML. >> >> This is done I guess to support following use case: >> >> (list "<tag>Already existing XML copied from existing .xml file, which >> we don't want to rewrite to SXML.</tag>" >> '((tag (@ (attr1 "value1") >> (attr2 "value2")) >> (nested "Part of the configuration defined with SXML") >> (empty))) >> "<another-tag>Maybe some other part of raw XML</another-tag>") >> >> This way we can combine SXML with already existing raw XML. >> >> Am I right? > > You're right. The current implementation allows XML string and SXML > list in the list. Also, it can mix those. > Ok, that means we can cover this use case, but at the same time have more functionality, clarity and consistency. We can make extra-config to be SXML only (with G-exps support), this way we will achieve not only the same functionality, but will get more advanced features like referencing files/directiories in the /gnu/store or generating parts of configuration using full-fledged scheme (the simpliest example is just reading the content of the existing file-like object or using format to generate "raw XML" and insert it in arbitrary place of SXML tree). --8<---------------cut here---------------start------------->8--- (list #~"<tag>Already existing XML copied from existing .xml file, which we don't want to rewrite to SXML.</tag>" `((tag (@ (attr1 "value1") (attr2 "value2")) (nested "Part of the configuration defined with SXML") ,#~(format #f " <nested-tag>~a</nested-tag>" #$variable) (fontdirs (dirs ,(file-append font-iosevka "/share/fonts"))) (empty))) #~(call-with-input-file #$(local-file "old.xml") get-string-all) #~"<another-tag>Maybe some other part of raw XML</another-tag>") --8<---------------cut here---------------end--------------->8--- Liliana, Ludo what do you think? >>>> > If serialization would support G-exps, we could write >>>> > >>>> > (list #~"RAW_XML_HERE") >>>> > >>>> > or even something like this: >>>> > >>>> > (list #~(READ-THE-WHOLE-FILE #$(local-file "our-old.xml"))) >>>> >>>> Does it mean that the specification does not allow it now? Or does it >>>> mean that it is not possible with my implementation? >>> I think your serialize would have to unpack the G-Expressions. You can >>> test that with some example configs of your own. >>> >>>> > >>> Cheers > > Thanks, -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 12 Oct 2022 18:24:01 GMT) Full text and rfc822 format available.Message #218 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Andrew Tropin <andrew <at> trop.in>, Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org Subject: Re: Almost plain SXML serializer Date: Wed, 12 Oct 2022 20:23:08 +0200
Am Mittwoch, dem 12.10.2022 um 17:03 +0400 schrieb Andrew Tropin: > On 2022-10-12 20:42, Taiju HIGASHI wrote: > > > Andrew Tropin <andrew <at> trop.in> writes: > > > > > On 2022-10-11 06:21, Liliana Marie Prikler wrote: > > > > > > > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju > > > > HIGASHI: > > > > > We can specify invalid value such as (list "foo" '(foo bar) > > > > > 123). > > > > It will be sanitized before that. > > > > > > > > > > Also, making multi-type fields is debatable, but isn't > > > > > > great IMO. > > > > > > > > > > I see. If we had to choose one or the other, I would prefer > > > > > the > > > > > string-type field. > > > > Prefer sexp-type. > > > > > > > > > > Current (v5) extra-config has a list type. This list can contain > > > strings > > > and nested lists, string elements are for raw XML, and list > > > elements are for SXML. > > > > > > This is done I guess to support following use case: > > > > > > (list "<tag>Already existing XML copied from existing .xml file, > > > which > > > we don't want to rewrite to SXML.</tag>" > > > '((tag (@ (attr1 "value1") > > > (attr2 "value2")) > > > (nested "Part of the configuration defined with > > > SXML") > > > (empty))) > > > "<another-tag>Maybe some other part of raw XML</another- > > > tag>") > > > > > > This way we can combine SXML with already existing raw XML. > > > > > > Am I right? > > > > You're right. The current implementation allows XML string and > > SXML > > list in the list. Also, it can mix those. > > > > Ok, that means we can cover this use case, but at the same time have > more functionality, clarity and consistency. > > We can make extra-config to be SXML only (with G-exps support), this > way we will achieve not only the same functionality, but will get > more advanced features like referencing files/directiories in the > /gnu/store or generating parts of configuration using full-fledged > scheme (the simpliest example is just reading the content of the > existing file-like object or using format to generate "raw XML" and > insert it in arbitrary place of SXML tree). > > --8<---------------cut here---------------start------------->8--- > (list #~"<tag>Already existing XML copied from existing .xml file, > which > we don't want to rewrite to SXML.</tag>" > `((tag (@ (attr1 "value1") > (attr2 "value2")) > (nested "Part of the configuration defined with SXML") > ,#~(format #f " <nested-tag>~a</nested-tag>" > #$variable) > (fontdirs > (dirs ,(file-append font-iosevka "/share/fonts"))) > (empty))) > #~(call-with-input-file #$(local-file "old.xml") get-string- > all) > #~"<another-tag>Maybe some other part of raw XML</another- > tag>") > --8<---------------cut here---------------end--------------->8--- > > Liliana, Ludo what do you think? I think the mockup implementation is a little unclear. Do you mean that G-Expressions should imply a string that is to be parsed? Because note that gexp->sexp exists and you could likewise #~(sxml->xml #$some- file-in-the-store) imho. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 13 Oct 2022 03:52:02 GMT) Full text and rfc822 format available.Message #221 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Taiju HIGASHI <higashi <at> taiju.info> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org Subject: Re: Almost plain SXML serializer Date: Thu, 13 Oct 2022 07:51:35 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-12 20:23, Liliana Marie Prikler wrote: > Am Mittwoch, dem 12.10.2022 um 17:03 +0400 schrieb Andrew Tropin: >> On 2022-10-12 20:42, Taiju HIGASHI wrote: >> >> > Andrew Tropin <andrew <at> trop.in> writes: >> > >> > > On 2022-10-11 06:21, Liliana Marie Prikler wrote: >> > > >> > > > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju >> > > > HIGASHI: >> > > > > We can specify invalid value such as (list "foo" '(foo bar) >> > > > > 123). >> > > > It will be sanitized before that. >> > > > >> > > > > > Also, making multi-type fields is debatable, but isn't >> > > > > > great IMO. >> > > > > >> > > > > I see. If we had to choose one or the other, I would prefer >> > > > > the >> > > > > string-type field. >> > > > Prefer sexp-type. >> > > > >> > > >> > > Current (v5) extra-config has a list type. This list can contain >> > > strings >> > > and nested lists, string elements are for raw XML, and list >> > > elements are for SXML. >> > > >> > > This is done I guess to support following use case: >> > > >> > > (list "<tag>Already existing XML copied from existing .xml file, >> > > which >> > > we don't want to rewrite to SXML.</tag>" >> > > '((tag (@ (attr1 "value1") >> > > (attr2 "value2")) >> > > (nested "Part of the configuration defined with >> > > SXML") >> > > (empty))) >> > > "<another-tag>Maybe some other part of raw XML</another- >> > > tag>") >> > > >> > > This way we can combine SXML with already existing raw XML. >> > > >> > > Am I right? >> > >> > You're right. The current implementation allows XML string and >> > SXML >> > list in the list. Also, it can mix those. >> > >> >> Ok, that means we can cover this use case, but at the same time have >> more functionality, clarity and consistency. >> >> We can make extra-config to be SXML only (with G-exps support), this >> way we will achieve not only the same functionality, but will get >> more advanced features like referencing files/directiories in the >> /gnu/store or generating parts of configuration using full-fledged >> scheme (the simpliest example is just reading the content of the >> existing file-like object or using format to generate "raw XML" and >> insert it in arbitrary place of SXML tree). >> >> --8<---------------cut here---------------start------------->8--- >> (list #~"<tag>Already existing XML copied from existing .xml file, >> which >> we don't want to rewrite to SXML.</tag>" >> `((tag (@ (attr1 "value1") >> (attr2 "value2")) >> (nested "Part of the configuration defined with SXML") >> ,#~(format #f " <nested-tag>~a</nested-tag>" >> #$variable) >> (fontdirs >> (dirs ,(file-append font-iosevka "/share/fonts"))) >> (empty))) >> #~(call-with-input-file #$(local-file "old.xml") get-string- >> all) >> #~"<another-tag>Maybe some other part of raw XML</another- >> tag>") >> --8<---------------cut here---------------end--------------->8--- >> >> Liliana, Ludo what do you think? > I think the mockup implementation is a little unclear. The file generated from definition above should look like: --8<---------------cut here---------------start------------->8--- <tag>Already existing XML copied from existing .xml file, which we don't want to rewrite to SXML.</tag> <tag attr1="value1" attr2="value2"> <nested>Text node</nested> <nested-tag>variable value here</nested-tag> <fontdirs> <dirs> /gnu/store/w2wvg2229lj3qba0r44pmd786mkllvjl-font-iosevka-15.2.0/share/fonts </dirs> </fontdirs> <empty/> </tag> <!-- the literal content of old.xml file here --> <another-tag>Maybe some other part of raw XML</another-tag> --8<---------------cut here---------------end--------------->8--- Hope it helps, let me know if you want me to rephrase or clarify something. > Do you mean that G-Expressions should imply a string that is to be > parsed? Because note that gexp->sexp exists and you could likewise > #~(sxml->xml #$some- file-in-the-store) imho. Not sure what you mean. Can you elaborate, please? -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 13 Oct 2022 12:39:03 GMT) Full text and rfc822 format available.Message #224 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Andrew Tropin <andrew <at> trop.in> Cc: 57963 <at> debbugs.gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com Subject: Re: [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Thu, 13 Oct 2022 14:37:48 +0200
Hello, Andrew Tropin <andrew <at> trop.in> skribis: > If serialization would support G-exps, we could write > > (list #~"RAW_XML_HERE") There’s a one-to-one lossless mapping between XML and SXML, so I don’t 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 generate syntactically-invalid XML. Maybe we can live without it? :-) Thanks, Ludo’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 14 Oct 2022 05:08:02 GMT) Full text and rfc822 format available.Message #227 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Andrew Tropin <andrew <at> trop.in> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Fri, 14 Oct 2022 09:06:42 +0400
[Message part 1 (text/plain, inline)]
On 2022-10-13 14:37, Ludovic Courtès wrote: > Hello, > > Andrew Tropin <andrew <at> trop.in> skribis: > >> If serialization would support G-exps, we could write >> >> (list #~"RAW_XML_HERE") > > There’s a one-to-one lossless mapping between XML and SXML, so I don’t > 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 generate > 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. 2. Use full path to gnu store of file-like objects. -- Best regards, Andrew Tropin
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sat, 15 Oct 2022 11:14:02 GMT) Full text and rfc822 format available.Message #230 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Andrew Tropin <andrew <at> trop.in> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Sat, 15 Oct 2022 20:13:30 +0900
Andrew Tropin <andrew <at> trop.in> writes: > On 2022-10-13 14:37, Ludovic Courtès wrote: > >> Hello, >> >> Andrew Tropin <andrew <at> trop.in> skribis: >> >>> If serialization would support G-exps, we could write >>> >>> (list #~"RAW_XML_HERE") >> >> There’s a one-to-one lossless mapping between XML and SXML, so I don’t >> 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 generate >> 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. > 2. Use full path to gnu store of file-like objects. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Mon, 17 Oct 2022 16:30:02 GMT) Full text and rfc822 format available.Message #233 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Ludovic Courtès <ludo <at> gnu.org> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Mon, 17 Oct 2022 18:28:58 +0200
Hi, Taiju HIGASHI <higashi <at> taiju.info> skribis: > Andrew Tropin <andrew <at> trop.in> writes: [...] >>> Andrew Tropin <andrew <at> trop.in> skribis: >>> >>>> If serialization would support G-exps, we could write >>>> >>>> (list #~"RAW_XML_HERE") >>> >>> There’s a one-to-one lossless mapping between XML and SXML, so I don’t >>> 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 generate >>> 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’s 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’d 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 “gexp compiler” for <fontconfig-configuration> to make that transparent.) Thanks, Ludo’.
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 18 Oct 2022 12:42:02 GMT) Full text and rfc822 format available.Message #236 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Tue, 18 Oct 2022 21:41:03 +0900
Hi, Ludovic Courtès <ludo <at> gnu.org> writes: > Hi, > > Taiju HIGASHI <higashi <at> taiju.info> skribis: > >> Andrew Tropin <andrew <at> trop.in> writes: > > [...] > >>>> Andrew Tropin <andrew <at> trop.in> skribis: >>>> >>>>> If serialization would support G-exps, we could write >>>>> >>>>> (list #~"RAW_XML_HERE") >>>> >>>> There’s a one-to-one lossless mapping between XML and SXML, so I don’t >>>> 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 generate >>>> 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’s 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’d 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 “gexp compiler” for <fontconfig-configuration> 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, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 19 Oct 2022 21:44:02 GMT) Full text and rfc822 format available.Message #239 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Thu, 20 Oct 2022 06:42:54 +0900
Taiju HIGASHI <higashi <at> taiju.info> writes: > Hi, > > Ludovic Courtès <ludo <at> gnu.org> writes: > >> Hi, >> >> Taiju HIGASHI <higashi <at> taiju.info> skribis: >> >>> Andrew Tropin <andrew <at> trop.in> writes: >> >> [...] >> >>>>> Andrew Tropin <andrew <at> trop.in> skribis: >>>>> >>>>>> If serialization would support G-exps, we could write >>>>>> >>>>>> (list #~"RAW_XML_HERE") >>>>> >>>>> There’s a one-to-one lossless mapping between XML and SXML, so I don’t >>>>> 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 generate >>>>> 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’s 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’d 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 “gexp compiler” for <fontconfig-configuration> 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='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig>" (serialize-configuration user-config home-fontconfig-configuration-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 => (home-fontconfig-configuration (font-directories (cons* "~/fonts" %home-fontconfig-base-font-directories)) (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 => (local-file "/path/to/your/fonts.conf")))))) --8<---------------cut here---------------end--------------->8--- Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 20 Oct 2022 01:24:02 GMT) Full text and rfc822 format available.Message #242 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Declan Tsien <declantsien <at> riseup.net> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 20 Oct 2022 09:23:01 +0800
[Message part 1 (text/plain, inline)]
Taiju HIGASHI <higashi <at> taiju.info> writes: > (default-font-serif-family "Noto Serif CJK JP") > (default-font-sans-serif-family "Noto Sans Serif CJK JP") > (default-font-monospace-family "PlemolJP Console") Does this take a list as value? Because I have specified some fallback fonts in my configuration. I directly use sxml to serialize the config file right now. Below is a portion of it. It would be great if I could use this home-service without writing extra sxml code once it gets merged. #+begin_src scheme (alias (@ (binding "strong")) (family "sans-serif") (prefer (family "WenQuanYi Micro Hei") (family "Noto Sans"))) (alias (@ (binding "strong")) (family "monospace") (prefer (family "Sarasa Mono CL") (family "Inconsolata") (family "Noto Mono"))) #+end_src
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 20 Oct 2022 01:38:02 GMT) Full text and rfc822 format available.Message #245 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Declan Tsien <declantsien <at> riseup.net> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 20 Oct 2022 10:37:29 +0900
Hi Declan, Declan Tsien <declantsien <at> riseup.net> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> (default-font-serif-family "Noto Serif CJK JP") >> (default-font-sans-serif-family "Noto Sans Serif CJK JP") >> (default-font-monospace-family "PlemolJP Console") > > Does this take a list as value? Because I have specified some fallback fonts in my configuration. > I directly use sxml to serialize the config file right now. Below is a portion of it. > > It would be great if I could use this home-service without writing extra sxml code once it gets merged. > > #+begin_src scheme > (alias (@ (binding "strong")) > (family "sans-serif") > (prefer > (family "WenQuanYi Micro Hei") > (family "Noto Sans"))) > > (alias (@ (binding "strong")) > (family "monospace") > (prefer > (family "Sarasa Mono CL") > (family "Inconsolata") > (family "Noto Mono"))) > #+end_src > That makes sense. I thought that being able to specify one preferred font would be sufficient, but since actual fontconfig allows multiple specification, I thought it would certainly be better to be able to specify more than one in this setting as well. By the way, should we be able to specify the binding attribute as well? Best Regards, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 20 Oct 2022 02:04:01 GMT) Full text and rfc822 format available.Message #248 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Declan Tsien <declantsien <at> riseup.net> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 20 Oct 2022 10:03:35 +0800
[Message part 1 (text/plain, inline)]
Taiju HIGASHI <higashi <at> taiju.info> writes: > > By the way, should we be able to specify the binding attribute as well? > I checked the fontconfig doc. https://www.freedesktop.org/software/fontconfig/fontconfig-user.html Here is the relevant portation: > There is one special case to this rule; family names are split into > two bindings; strong and weak. Strong family names are given greater > precedence in the match than lang elements while weak family names are > given lower precedence than lang elements. This permits the document > language to drive font selection when any document specified font is > unavailable. I guess it's ok to ignore or set a default =strong= when serializing?
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 20 Oct 2022 03:45:01 GMT) Full text and rfc822 format available.Message #251 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Declan Tsien <declantsien <at> riseup.net> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 20 Oct 2022 12:44:33 +0900
Declan Tsien <declantsien <at> riseup.net> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> >> By the way, should we be able to specify the binding attribute as well? >> > > I checked the fontconfig doc. > https://www.freedesktop.org/software/fontconfig/fontconfig-user.html > Here is the relevant portation: > >> There is one special case to this rule; family names are split into >> two bindings; strong and weak. Strong family names are given greater >> precedence in the match than lang elements while weak family names are >> given lower precedence than lang elements. This permits the document >> language to drive font selection when any document specified font is >> unavailable. > > I guess it's ok to ignore or set a default =strong= when serializing? > If you put the setting below, --8<---------------cut here---------------start------------->8--- (home-fontconfig-configuration (default-font-serif-family "Noto Serif CJK JP") (default-font-sans-serif-family "Noto Sans Serif CJK JP") (default-font-monospace-family "PlemolJP Console")) --8<---------------cut here---------------end--------------->8--- The current implementation serializes below. --8<---------------cut here---------------start------------->8--- <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig> <dir>~/.guix-home/profile/share/fonts</dir> <alias> <family>serif</family> <prefer> <family>Noto Serif CJK JP</family> </prefer> </alias> <alias> <family>sans-serif</family> <prefer> <family>Noto Sans Serif CJK JP</family> </prefer> </alias> <alias> <family>monospace</family> <prefer> <family>PlemolJP Console</family> </prefer> </alias> </fontconfig> --8<---------------cut here---------------end--------------->8--- Since the binding attribute is omitted, it would be interpreted as the default weak. ref: https://github.com/behdad/fontconfig/blob/5b41ded2b0ddb98a07ac86264b94403cb7a0fd82/fonts.dtd#L127-L128 I would like the default-font-* fields to cover only typical settings. Instead, we provide extra-config field to be used for settings that are not typical. You can also configure the settings you want by specifying them in extra-config. --8<---------------cut here---------------start------------->8--- (home-fontconfig-configuration (extra-config '((alias (@ (binding "strong")) (family "sans-serif") (prefer (family "WenQuanYi Micro Hei") (family "Noto Sans"))) (alias (@ (binding "strong")) (family "monospace") (prefer (family "Sarasa Mono CL") (family "Inconsolata") (family "Noto Mono")))))) --8<---------------cut here---------------end--------------->8--- I don't see clearly what the typical configuration of alias should be, but I believe the current specification is sufficient for our needs. Do you still think it is preferable to change the default-font-* field interface, even knowing that you can configure it in the extra-config field? Please give me your frank opinion :) Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 20 Oct 2022 05:07:02 GMT) Full text and rfc822 format available.Message #254 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Declan Tsien <declantsien <at> riseup.net> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Thu, 20 Oct 2022 13:06:03 +0800
[Message part 1 (text/plain, inline)]
Taiju HIGASHI <higashi <at> taiju.info> writes: > > You can also configure the settings you want by specifying them in > extra-config. > Oh, nice. So my use case is covered. Didn't realize that. Nice work. > > I don't see clearly what the typical configuration of alias should be, > but I believe the current specification is sufficient for our needs. > > Do you still think it is preferable to change the default-font-* field > interface, even knowing that you can configure it in the extra-config > field? Please give me your frank opinion :) > Let's stick to the current specification, no changes needed. Cheers. Thanks
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 20 Oct 2022 05:41:01 GMT) Full text and rfc822 format available.Message #257 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Declan Tsien <declantsien <at> riseup.net> To: 57963 <at> debbugs.gnu.org Cc: ludo <at> gnu.org, Taiju HIGASHI <higashi <at> taiju.info>, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Thu, 20 Oct 2022 13:40:33 +0800
[Message part 1 (text/plain, inline)]
Taiju HIGASHI <higashi <at> taiju.info> writes: > @@ -59,7 +136,7 @@ (define home-fontconfig-service-type > (service-extension > home-profile-service-type > (const (list fontconfig))))) > - (default-value #f) > + (default-value (home-fontconfig-configuration)) > (description > "Provides configuration file for fontconfig and make > fc-* utilities aware of font packages installed in Guix Home's profile."))) > -- > 2.37.3 Do we also have support service extension here? like this. #+begin_src scheme (compose identity) (extend home-fontconfig-extensions) (default-value (home-fontconfig-configuration)) #+end_src
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 21 Oct 2022 01:03:02 GMT) Full text and rfc822 format available.Message #260 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Declan Tsien <declantsien <at> riseup.net> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: bug#57963: [PATCH 0/1] Support user's fontconfig. Date: Fri, 21 Oct 2022 10:02:10 +0900
Declan Tsien <declantsien <at> riseup.net> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> >> You can also configure the settings you want by specifying them in >> extra-config. >> > > Oh, nice. So my use case is covered. Didn't realize that. Nice work. > >> >> I don't see clearly what the typical configuration of alias should be, >> but I believe the current specification is sufficient for our needs. >> >> Do you still think it is preferable to change the default-font-* field >> interface, even knowing that you can configure it in the extra-config >> field? Please give me your frank opinion :) >> > > Let's stick to the current specification, no changes needed. Cheers. OK. Thank you for your input! Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 21 Oct 2022 04:04:02 GMT) Full text and rfc822 format available.Message #263 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Declan Tsien <declantsien <at> riseup.net> Cc: ludo <at> gnu.org, 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, andrew <at> trop.in Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Fri, 21 Oct 2022 13:03:26 +0900
Declan Tsien <declantsien <at> riseup.net> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> @@ -59,7 +136,7 @@ (define home-fontconfig-service-type >> (service-extension >> home-profile-service-type >> (const (list fontconfig))))) >> - (default-value #f) >> + (default-value (home-fontconfig-configuration)) >> (description >> "Provides configuration file for fontconfig and make >> fc-* utilities aware of font packages installed in Guix Home's profile."))) >> -- >> 2.37.3 > > Do we also have support service extension here? like this. > > #+begin_src scheme > (compose identity) > (extend home-fontconfig-extensions) > (default-value (home-fontconfig-configuration)) > #+end_src > Sorry, I didn't understand your question. Could you give me more specific needs? Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 21 Oct 2022 05:03:01 GMT) Full text and rfc822 format available.Message #266 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Declan Tsien <declantsien <at> riseup.net> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Fri, 21 Oct 2022 13:02:30 +0800
[Message part 1 (text/plain, inline)]
Taiju HIGASHI <higashi <at> taiju.info> writes: > > Sorry, I didn't understand your question. Could you give me more > specific needs? > My apologies. I should be more clear. I think I saw we are using =modify-services= (somewhere in this thread) to configure =home-fontconfig-service-type=. But wouldn't be nice if user can just use =simple-service= to extend it? Like this in my guix-config: https://git.sr.ht/~declantsien/guix-config/tree/master/item/home-conf/appearance/font.scm#L30-55 https://git.sr.ht/~declantsien/guix-config/tree/master/item/guix/gnu/home/services/fontutils.scm#L94-96
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 21 Oct 2022 08:02:01 GMT) Full text and rfc822 format available.Message #269 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Declan Tsien <declantsien <at> riseup.net> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Fri, 21 Oct 2022 17:01:17 +0900
Declan Tsien <declantsien <at> riseup.net> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> >> Sorry, I didn't understand your question. Could you give me more >> specific needs? >> > > My apologies. I should be more clear. > > I think I saw we are using =modify-services= (somewhere in this > thread) to configure =home-fontconfig-service-type=. But wouldn't be nice > if user can just use =simple-service= to extend it? > > Like this in my guix-config: > > https://git.sr.ht/~declantsien/guix-config/tree/master/item/home-conf/appearance/font.scm#L30-55 > https://git.sr.ht/~declantsien/guix-config/tree/master/item/guix/gnu/home/services/fontutils.scm#L94-96 > Thank you for detail information. Currently, It not support. The interface is not suitable for extension, so we decided to forgot it. See: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#71 We have to come up with a merge strategy if we allow to extend, how would you like to extend it? Perhaps I am less experienced in Guix customization than you are, and don't understand the use cases that cannot be achieved with modify-services. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 21 Oct 2022 09:16:01 GMT) Full text and rfc822 format available.Message #272 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Declan Tsien <declantsien <at> riseup.net> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Fri, 21 Oct 2022 17:15:33 +0800
[Message part 1 (text/plain, inline)]
Taiju HIGASHI <higashi <at> taiju.info> writes: > See: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#71 > > We have to come up with a merge strategy if we allow to extend, how > would you like to extend it? OK, got it. Sounds reasonable. I should have followed the conversation thoroughly, Sorry about that. > > Perhaps I am less experienced in Guix customization than you are, and Nah, I haven't contributed much to Guix community yet. Only poking around with my guix-config ha. > don't understand the use cases that cannot be achieved with > modify-services. I'd prefer =simple-service= over =modify-services= when possible. For example, in this case. Let's say I want to add an item to =font-directories=, I should not forget to include =guix-home-font-dir= too, like this: #+begin_src scheme (home-fontconfig-configuration (font-directories (string-list (list guix-home-font-dir "another-dir"))) #+end_src But with service extension I can just write: #+begin_src scheme (home-fontconfig-extension (font-directories (string-list (list "another-dir"))) #+end_src =guix-home-font-dir= doesn't need to show up in my configuration. ---- Thanks
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 23 Oct 2022 06:33:02 GMT) Full text and rfc822 format available.Message #275 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Declan Tsien <declantsien <at> riseup.net> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Sun, 23 Oct 2022 15:32:45 +0900
Declan Tsien <declantsien <at> riseup.net> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> See: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#71 >> >> We have to come up with a merge strategy if we allow to extend, how >> would you like to extend it? > > OK, got it. Sounds reasonable. > I should have followed the conversation thoroughly, Sorry about that. > >> >> Perhaps I am less experienced in Guix customization than you are, and > > Nah, I haven't contributed much to Guix community yet. Only poking around with my > guix-config ha. > >> don't understand the use cases that cannot be achieved with >> modify-services. > > I'd prefer =simple-service= over =modify-services= when possible. > For example, in this case. Let's say I want to add an item to > =font-directories=, I should not forget to include =guix-home-font-dir= > too, like this: > > #+begin_src scheme > (home-fontconfig-configuration > (font-directories > (string-list (list guix-home-font-dir "another-dir"))) > #+end_src > > > But with service extension I can just write: > > #+begin_src scheme > (home-fontconfig-extension > (font-directories > (string-list (list "another-dir"))) > #+end_src > > =guix-home-font-dir= doesn't need to show up in my configuration. I see. We may make the interface even more unsuitable for extensions since we plan to allow the user to choose whether to configure with the fontconfig-configuration or a file-like object. I am taking a very long time to finalize the interface on this issue, should I still think about it more carefully...? Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 23 Oct 2022 07:35:02 GMT) Full text and rfc822 format available.Message #278 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Declan Tsien <declantsien <at> riseup.net> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Sun, 23 Oct 2022 15:33:44 +0800
[Message part 1 (text/plain, inline)]
Taiju HIGASHI <higashi <at> taiju.info> writes: > > I see. We may make the interface even more unsuitable for extensions > since we plan to allow the user to choose whether to configure with the > fontconfig-configuration or a file-like object. > > I am taking a very long time to finalize the interface on this issue, > should I still think about it more carefully...? > > Thanks, > -- > Taiju I think we can stick to the current specification for now. We can go from there later.
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 23 Oct 2022 11:41:02 GMT) Full text and rfc822 format available.Message #281 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Declan Tsien <declantsien <at> riseup.net> Cc: 57963 <at> debbugs.gnu.org Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Sun, 23 Oct 2022 20:40:47 +0900
Declan Tsien <declantsien <at> riseup.net> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> >> I see. We may make the interface even more unsuitable for extensions >> since we plan to allow the user to choose whether to configure with the >> fontconfig-configuration or a file-like object. >> >> I am taking a very long time to finalize the interface on this issue, >> should I still think about it more carefully...? >> >> Thanks, >> -- >> Taiju > > I think we can stick to the current specification for now. We can go from > there later. > Thank you. I will proceed with the current specification. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 27 Oct 2022 04:01:02 GMT) Full text and rfc822 format available.Message #284 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, liliana.prikler <at> gmail.com, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Thu, 27 Oct 2022 13:00:11 +0900
Hi, Taiju HIGASHI <higashi <at> taiju.info> writes: > Taiju HIGASHI <higashi <at> taiju.info> writes: > >> Hi, >> >> Ludovic Courtès <ludo <at> gnu.org> writes: >> >>> Hi, >>> >>> Taiju HIGASHI <higashi <at> taiju.info> skribis: >>> >>>> Andrew Tropin <andrew <at> trop.in> writes: >>> >>> [...] >>> >>>>>> Andrew Tropin <andrew <at> trop.in> skribis: >>>>>> >>>>>>> If serialization would support G-exps, we could write >>>>>>> >>>>>>> (list #~"RAW_XML_HERE") >>>>>> >>>>>> There’s a one-to-one lossless mapping between XML and SXML, so I don’t >>>>>> 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 generate >>>>>> 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’s 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’d 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 “gexp compiler” for <fontconfig-configuration> 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? > > (define (add-fontconfig-config-file user-config) > `(("fontconfig/fonts.conf" > ,(if (home-fontconfig-configuration? user-config) > (mixed-text-file > "fonts.conf" > "<?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > <fontconfig>" > (serialize-configuration user-config home-fontconfig-configuration-fields) > "</fontconfig>\n") > user-config)))) > > > It is assumed that configurations can be specified in one of the > following ways. > > * fontconfig-configuration: > > (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 => (home-fontconfig-configuration > (font-directories > (cons* "~/fonts" %home-fontconfig-base-font-directories)) > (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")))))))) > > > 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: > > (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 => (local-file "/path/to/your/fonts.conf")))))) > > Thanks, Sorry for the long time it has taken to resolve the issue. What do you think about it? Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 27 Oct 2022 05:19:01 GMT) Full text and rfc822 format available.Message #287 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info>, Ludovic Courtès <ludo <at> gnu.org> Cc: 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Thu, 27 Oct 2022 07:18:22 +0200
Am Donnerstag, dem 27.10.2022 um 13:00 +0900 schrieb Taiju HIGASHI: > Sorry for the long time it has taken to resolve the issue. > What do you think about it? Putting the discussion with Declan aside, the last thing mentioned was not trying to mix SXML and XML-in-strings. Ludo offered the solutions: 1. Taking a <fontconfig-configuration> or a file-like object 2. (Optionally) using a gexp-compiler for the former Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 27 Oct 2022 05:32:02 GMT) Full text and rfc822 format available.Message #290 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Thu, 27 Oct 2022 14:31:33 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Donnerstag, dem 27.10.2022 um 13:00 +0900 schrieb Taiju HIGASHI: >> Sorry for the long time it has taken to resolve the issue. >> What do you think about it? > Putting the discussion with Declan aside, the last thing mentioned was > not trying to mix SXML and XML-in-strings. Ludo offered the solutions: > 1. Taking a <fontconfig-configuration> or a file-like object > 2. (Optionally) using a gexp-compiler for the former > > Cheers Sorry for the lack of clarity. I had sent you a past email confirming that the direction of the implementation was correct and was waiting for your response. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#239 Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Thu, 27 Oct 2022 06:37:02 GMT) Full text and rfc822 format available.Message #293 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Thu, 27 Oct 2022 08:36:42 +0200
Am Donnerstag, dem 27.10.2022 um 14:31 +0900 schrieb Taiju HIGASHI: > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > Am Donnerstag, dem 27.10.2022 um 13:00 +0900 schrieb Taiju HIGASHI: > > > Sorry for the long time it has taken to resolve the issue. > > > What do you think about it? > > Putting the discussion with Declan aside, the last thing mentioned > > was > > not trying to mix SXML and XML-in-strings. Ludo offered the > > solutions: > > 1. Taking a <fontconfig-configuration> or a file-like object > > 2. (Optionally) using a gexp-compiler for the former > > > > Cheers > > Sorry for the lack of clarity. > I had sent you a past email confirming that the direction of the > implementation was correct and was waiting for your response. > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#239 Ahh, I missed that. If you pull in the XML declarations and the <fontconfig></fontconfig> stuff to the serialization, you should basically have most of what you'd need for a G-Exp compiler, but even if not it'd simplify this to (match ((? home-font-config-configuration? config) (serialize-... config ...)) ((? file-like? config) config)) Not sure if a match for type-checking would be needed since it's already taken care of elsewhere, so writing it just in case. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 02 Nov 2022 01:44:02 GMT) Full text and rfc822 format available.Message #296 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 02 Nov 2022 10:43:21 +0900
Hi, Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Donnerstag, dem 27.10.2022 um 14:31 +0900 schrieb Taiju HIGASHI: >> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: >> >> > Am Donnerstag, dem 27.10.2022 um 13:00 +0900 schrieb Taiju HIGASHI: >> > > Sorry for the long time it has taken to resolve the issue. >> > > What do you think about it? >> > Putting the discussion with Declan aside, the last thing mentioned >> > was >> > not trying to mix SXML and XML-in-strings. Ludo offered the >> > solutions: >> > 1. Taking a <fontconfig-configuration> or a file-like object >> > 2. (Optionally) using a gexp-compiler for the former >> > >> > Cheers >> >> Sorry for the lack of clarity. >> I had sent you a past email confirming that the direction of the >> implementation was correct and was waiting for your response. >> >> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#239 > Ahh, I missed that. If you pull in the XML declarations and the > <fontconfig></fontconfig> stuff to the serialization, you should > basically have most of what you'd need for a G-Exp compiler, but even > if not it'd simplify this to > > (match > ((? home-font-config-configuration? config) > (serialize-... config ...)) > ((? file-like? config) config)) > > Not sure if a match for type-checking would be needed since it's > already taken care of elsewhere, so writing it just in case. > > Cheers Sorry for my response delay. Is my recognition correct? I have plan to rewrite it as below. --8<---------------cut here---------------start------------->8--- (define (serialize-fontconfig-configuration config) (define start-of-fontconfig "<?xml version='1.0'?> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <fontconfig>") (define end-of-fontconfig "</fontconfig>\n") (mixed-text-file "fonts.conf" start-of-fontconfig (serialize-configuration config home-fontconfig-configuration-fields) end-of-fontconfig)) (define (add-fontconfig-config-file user-config) `(("fontconfig/fonts.conf" ,(match user-config ((? home-fontconfig-configuration? user-config) (serialize-fontconfig-configuration user-config)) ((? file-like? user-config) user-config))))) --8<---------------cut here---------------end--------------->8--- Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Wed, 02 Nov 2022 06:46:01 GMT) Full text and rfc822 format available.Message #299 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Taiju HIGASHI <higashi <at> taiju.info> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Wed, 02 Nov 2022 07:45:34 +0100
Am Mittwoch, dem 02.11.2022 um 10:43 +0900 schrieb Taiju HIGASHI: > Hi, > > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > Am Donnerstag, dem 27.10.2022 um 14:31 +0900 schrieb Taiju HIGASHI: > > > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > > > > > > > Am Donnerstag, dem 27.10.2022 um 13:00 +0900 schrieb Taiju > > > > HIGASHI: > > > > > Sorry for the long time it has taken to resolve the issue. > > > > > What do you think about it? > > > > Putting the discussion with Declan aside, the last thing > > > > mentioned > > > > was > > > > not trying to mix SXML and XML-in-strings. Ludo offered the > > > > solutions: > > > > 1. Taking a <fontconfig-configuration> or a file-like object > > > > 2. (Optionally) using a gexp-compiler for the former > > > > > > > > Cheers > > > > > > Sorry for the lack of clarity. > > > I had sent you a past email confirming that the direction of the > > > implementation was correct and was waiting for your response. > > > > > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#239 > > Ahh, I missed that. If you pull in the XML declarations and the > > <fontconfig></fontconfig> stuff to the serialization, you should > > basically have most of what you'd need for a G-Exp compiler, but > > even > > if not it'd simplify this to > > > > (match > > ((? home-font-config-configuration? config) > > (serialize-... config ...)) > > ((? file-like? config) config)) > > > > Not sure if a match for type-checking would be needed since it's > > already taken care of elsewhere, so writing it just in case. > > > > Cheers > > Sorry for my response delay. > Is my recognition correct? I have plan to rewrite it as below. > > --8<---------------cut here---------------start------------->8--- > (define (serialize-fontconfig-configuration config) > (define start-of-fontconfig "<?xml version='1.0'?> > <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> > <fontconfig>") > > (define end-of-fontconfig "</fontconfig>\n") > > (mixed-text-file > "fonts.conf" > start-of-fontconfig > (serialize-configuration config home-fontconfig-configuration- > fields) > end-of-fontconfig)) > > (define (add-fontconfig-config-file user-config) > `(("fontconfig/fonts.conf" > ,(match user-config > ((? home-fontconfig-configuration? user-config) > (serialize-fontconfig-configuration user-config)) > ((? file-like? user-config) user-config))))) > --8<---------------cut here---------------end--------------->8--- More or less. For one, I don't think start-of-fontconfig and end-of- fontconfig need to be declared. The (serialize-configuration ) call is a little opaque atm, but let's suppose it returns properly formatted XML. Finally, as hinted already and since you're returning a file-like object anyway, you may want to make this serializer a gexp-compiler instead. Cheers
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 04 Nov 2022 08:47:01 GMT) Full text and rfc822 format available.Message #302 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Fri, 04 Nov 2022 17:46:43 +0900
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: > Am Mittwoch, dem 02.11.2022 um 10:43 +0900 schrieb Taiju HIGASHI: >> Hi, >> >> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: >> >> > Am Donnerstag, dem 27.10.2022 um 14:31 +0900 schrieb Taiju HIGASHI: >> > > Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes: >> > > >> > > > Am Donnerstag, dem 27.10.2022 um 13:00 +0900 schrieb Taiju >> > > > HIGASHI: >> > > > > Sorry for the long time it has taken to resolve the issue. >> > > > > What do you think about it? >> > > > Putting the discussion with Declan aside, the last thing >> > > > mentioned >> > > > was >> > > > not trying to mix SXML and XML-in-strings. Ludo offered the >> > > > solutions: >> > > > 1. Taking a <fontconfig-configuration> or a file-like object >> > > > 2. (Optionally) using a gexp-compiler for the former >> > > > >> > > > Cheers >> > > >> > > Sorry for the lack of clarity. >> > > I had sent you a past email confirming that the direction of the >> > > implementation was correct and was waiting for your response. >> > > >> > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57963#239 >> > Ahh, I missed that. If you pull in the XML declarations and the >> > <fontconfig></fontconfig> stuff to the serialization, you should >> > basically have most of what you'd need for a G-Exp compiler, but >> > even >> > if not it'd simplify this to >> > >> > (match >> > ((? home-font-config-configuration? config) >> > (serialize-... config ...)) >> > ((? file-like? config) config)) >> > >> > Not sure if a match for type-checking would be needed since it's >> > already taken care of elsewhere, so writing it just in case. >> > >> > Cheers >> >> Sorry for my response delay. >> Is my recognition correct? I have plan to rewrite it as below. >> >> --8<---------------cut here---------------start------------->8--- >> (define (serialize-fontconfig-configuration config) >> (define start-of-fontconfig "<?xml version='1.0'?> >> <!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> >> <fontconfig>") >> >> (define end-of-fontconfig "</fontconfig>\n") >> >> (mixed-text-file >> "fonts.conf" >> start-of-fontconfig >> (serialize-configuration config home-fontconfig-configuration- >> fields) >> end-of-fontconfig)) >> >> (define (add-fontconfig-config-file user-config) >> `(("fontconfig/fonts.conf" >> ,(match user-config >> ((? home-fontconfig-configuration? user-config) >> (serialize-fontconfig-configuration user-config)) >> ((? file-like? user-config) user-config))))) >> --8<---------------cut here---------------end--------------->8--- > More or less. For one, I don't think start-of-fontconfig and end-of- > fontconfig need to be declared. The (serialize-configuration ) call is > a little opaque atm, but let's suppose it returns properly formatted > XML. Finally, as hinted already and since you're returning a file-like > object anyway, you may want to make this serializer a gexp-compiler > instead. > > Cheers Sorry. I did not understand what you meant by making it a gexp-compiler instead. Is there anything reference documents or codes? I believe it was presented to me in advance as an optional proposal, but I do not know what it means and have not been able to respond. Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Fri, 04 Nov 2022 16:31:02 GMT) Full text and rfc822 format available.Message #305 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: "(" <paren <at> disroot.org> To: "Taiju HIGASHI" <higashi <at> taiju.info>, "Liliana Marie Prikler" <liliana.prikler <at> gmail.com> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Fri, 04 Nov 2022 16:29:56 +0000
Heya, On Fri Nov 4, 2022 at 8:46 AM GMT, Taiju HIGASHI wrote: > Sorry. I did not understand what you meant by making it a gexp-compiler > instead. Is there anything reference documents or codes? Guix's file-like objects are compiled into derivations using gexp-compilers, which may be defined using the ``define-gexp-compiler'' form. These two are equivalent: ;;; with procedure (define (foo->file-like foo) "Turns FOO into a derivation." (plain-file "foo" (foo-text foo))) ;; this way, you need to use foo->file-like whenever you want to use ;; foo in place of a file-like object (foo->file-like (foo (text "hello"))) ;;; with gexp compiler (define-gexp-compiler (foo-compiler (foo <foo-record>) system target) ;; (lower-object (plain-file "foo" (foo-text foo)))) ;; now, a ``foo'' can be treated as a lowerable file-like object! you ;; can put it anywhere you'd put a file-like. (foo (text "hello")) So, basically, define-gexp-compiler lets you make new kinds of file-like object from records! This is actually how computed-file, file-append, et al are defined; see guix/gexp.scm. (Many of the gexp-compilers define both a compiler and an expander; the compiler is a derivation to build when the object is built, and the expander is the string to return when it's gexped. file-append [line 680 in my checkout] is a good, clear example of this.) -- (
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Sun, 06 Nov 2022 13:26:01 GMT) Full text and rfc822 format available.Message #308 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Taiju HIGASHI <higashi <at> taiju.info> To: "(" <paren <at> disroot.org> Cc: Ludovic Courtès <ludo <at> gnu.org>, 57963 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler <at> gmail.com>, Andrew Tropin <andrew <at> trop.in> Subject: Re: [bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig configuration. Date: Sun, 06 Nov 2022 22:24:47 +0900
"(" <paren <at> disroot.org> writes: > Heya, > > On Fri Nov 4, 2022 at 8:46 AM GMT, Taiju HIGASHI wrote: >> Sorry. I did not understand what you meant by making it a gexp-compiler >> instead. Is there anything reference documents or codes? > > Guix's file-like objects are compiled into derivations using gexp-compilers, > which may be defined using the ``define-gexp-compiler'' form. These two are > equivalent: > > ;;; with procedure > > (define (foo->file-like foo) > "Turns FOO into a derivation." > (plain-file "foo" > (foo-text foo))) > > ;; this way, you need to use foo->file-like whenever you want to use > ;; foo in place of a file-like object > > (foo->file-like (foo (text "hello"))) > > ;;; with gexp compiler > > (define-gexp-compiler (foo-compiler (foo <foo-record>) system target) > ;; > (lower-object > (plain-file "foo" > (foo-text foo)))) > > ;; now, a ``foo'' can be treated as a lowerable file-like object! you > ;; can put it anywhere you'd put a file-like. > (foo (text "hello")) > > So, basically, define-gexp-compiler lets you make new kinds of file-like > object from records! This is actually how computed-file, file-append, et > al are defined; see guix/gexp.scm. (Many of the gexp-compilers define both > a compiler and an expander; the compiler is a derivation to build when > the object is built, and the expander is the string to return when it's > gexped. file-append [line 680 in my checkout] is a good, clear example of > this.) > > -- ( Thank you for your kindness. I think I understand a little more now, and I will read the surrounding source code to better understand it. Thanks to you, I may be able to understand what was suggested earlier in this thread! Thanks, -- Taiju
guix-patches <at> gnu.org
:bug#57963
; Package guix-patches
.
(Tue, 12 Nov 2024 06:19:02 GMT) Full text and rfc822 format available.Message #311 received at 57963 <at> debbugs.gnu.org (full text, mbox):
From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com> To: Liliana Prikler <liliana.prikler <at> gmail.com>, ludo <at> gnu.org, andrew <at> trop.in Cc: 57963 <at> debbugs.gnu.org, Taiju HIGASHI <higashi <at> taiju.info> Subject: Re: [bug#57963] Next steps for this issue Date: Tue, 12 Nov 2024 15:17:18 +0900
Hi, Taiju HIGASHI <higashi <at> taiju.info> writes: > Hi, > > What are the next steps for this issue? > > I recognize that the following work remains. > > 1. Review of the v5 patch > 2. Consider which services to move from essentials services to base services > 3. Modify Document > > If I forgot to do something, please point it out. Liliana, Andrew, Ludovic; as you were involved in the initial review (2 years ago!), would you mind to have a look at what's missing here? It seems a valuable contribution. -- Thanks, Maxim
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.