[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#57963] [PATCH v5 2/2] home: services: Support user's fontconfig con
From: |
( |
Subject: |
[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.)
-- (