GNU bug report logs - #57963
[PATCH 0/1] Support user's fontconfig.

Previous Next

Package: guix-patches;

Reported by: Taiju HIGASHI <higashi <at> taiju.info>

Date: Wed, 21 Sep 2022 00:28:02 UTC

Severity: normal

Tags: patch

Full log


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.)

    -- (




This bug report was last modified 216 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.