summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2023-03-08 01:22:08 +0000
committerLudovic Courtès <ludo@gnu.org>2023-03-13 15:08:35 +0100
commit3c40dfe2851dd4ef48d2711f9f3531c06afbe1f2 (patch)
treee13c152b7b3262a35c9eb8232da2877ab5c6c7be /doc
parentdbfaca42a0377c65b96e11ef292275cb0113108f (diff)
doc: Use @defun for procedures.
* doc/guix.texi (Inferiors, Defining Packages, package Reference) (origin Reference, Defining Package Variants, Writing Manifests) (Build Utilities, Search Paths, The Store, Derivations, The Store Monad) (G-Expressions, File Systems, Keyboard Layout, Base Services, X Window) (Desktop Services, File-Sharing Services, Web Services, Virtualization Services) (Version Control Services, Miscellaneous Services, Initial RAM Disk) (Bootloader Configuration, Service Reference, Shepherd Services) (Complex Configurations): Use @defun for procedures. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi504
1 files changed, 238 insertions, 266 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index a2beaa832c1..539490d69b2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4958,60 +4958,57 @@ be much faster because the Guix revision will be cached.
4958The @code{(guix inferior)} module provides the following procedures to open an 4958The @code{(guix inferior)} module provides the following procedures to open an
4959inferior: 4959inferior:
4960 4960
4961@deffn {Scheme Procedure} inferior-for-channels @var{channels} @ 4961@defun inferior-for-channels channels [#:cache-directory] [#:ttl]
4962 [#:cache-directory] [#:ttl]
4963Return an inferior for @var{channels}, a list of channels. Use the cache at 4962Return an inferior for @var{channels}, a list of channels. Use the cache at
4964@var{cache-directory}, where entries can be reclaimed after @var{ttl} seconds. 4963@var{cache-directory}, where entries can be reclaimed after @var{ttl} seconds.
4965This procedure opens a new connection to the build daemon. 4964This procedure opens a new connection to the build daemon.
4966 4965
4967As a side effect, this procedure may build or substitute binaries for 4966As a side effect, this procedure may build or substitute binaries for
4968@var{channels}, which can take time. 4967@var{channels}, which can take time.
4969@end deffn 4968@end defun
4970 4969
4971@deffn {Scheme Procedure} open-inferior @var{directory} @ 4970@defun open-inferior directory [#:command "bin/guix"]
4972 [#:command "bin/guix"]
4973Open the inferior Guix in @var{directory}, running 4971Open the inferior Guix in @var{directory}, running
4974@code{@var{directory}/@var{command} repl} or equivalent. Return @code{#f} if 4972@code{@var{directory}/@var{command} repl} or equivalent. Return @code{#f} if
4975the inferior could not be launched. 4973the inferior could not be launched.
4976@end deffn 4974@end defun
4977 4975
4978@cindex inferior packages 4976@cindex inferior packages
4979The procedures listed below allow you to obtain and manipulate inferior 4977The procedures listed below allow you to obtain and manipulate inferior
4980packages. 4978packages.
4981 4979
4982@deffn {Scheme Procedure} inferior-packages @var{inferior} 4980@defun inferior-packages inferior
4983Return the list of packages known to @var{inferior}. 4981Return the list of packages known to @var{inferior}.
4984@end deffn 4982@end defun
4985 4983
4986@deffn {Scheme Procedure} lookup-inferior-packages @var{inferior} @var{name} @ 4984@defun lookup-inferior-packages inferior name [version]
4987 [@var{version}]
4988Return the sorted list of inferior packages matching @var{name} in 4985Return the sorted list of inferior packages matching @var{name} in
4989@var{inferior}, with highest version numbers first. If @var{version} is true, 4986@var{inferior}, with highest version numbers first. If @var{version} is true,
4990return only packages with a version number prefixed by @var{version}. 4987return only packages with a version number prefixed by @var{version}.
4991@end deffn 4988@end defun
4992 4989
4993@deffn {Scheme Procedure} inferior-package? @var{obj} 4990@defun inferior-package? obj
4994Return true if @var{obj} is an inferior package. 4991Return true if @var{obj} is an inferior package.
4995@end deffn 4992@end defun
4996 4993
4997@deffn {Scheme Procedure} inferior-package-name @var{package} 4994@defun inferior-package-name package
4998@deffnx {Scheme Procedure} inferior-package-version @var{package} 4995@defunx inferior-package-version package
4999@deffnx {Scheme Procedure} inferior-package-synopsis @var{package} 4996@defunx inferior-package-synopsis package
5000@deffnx {Scheme Procedure} inferior-package-description @var{package} 4997@defunx inferior-package-description package
5001@deffnx {Scheme Procedure} inferior-package-home-page @var{package} 4998@defunx inferior-package-home-page package
5002@deffnx {Scheme Procedure} inferior-package-location @var{package} 4999@defunx inferior-package-location package
5003@deffnx {Scheme Procedure} inferior-package-inputs @var{package} 5000@defunx inferior-package-inputs package
5004@deffnx {Scheme Procedure} inferior-package-native-inputs @var{package} 5001@defunx inferior-package-native-inputs package
5005@deffnx {Scheme Procedure} inferior-package-propagated-inputs @var{package} 5002@defunx inferior-package-propagated-inputs package
5006@deffnx {Scheme Procedure} inferior-package-transitive-propagated-inputs @var{package} 5003@defunx inferior-package-transitive-propagated-inputs package
5007@deffnx {Scheme Procedure} inferior-package-native-search-paths @var{package} 5004@defunx inferior-package-native-search-paths package
5008@deffnx {Scheme Procedure} inferior-package-transitive-native-search-paths @var{package} 5005@defunx inferior-package-transitive-native-search-paths package
5009@deffnx {Scheme Procedure} inferior-package-search-paths @var{package} 5006@defunx inferior-package-search-paths package
5010These procedures are the counterpart of package record accessors 5007These procedures are the counterpart of package record accessors
5011(@pxref{package Reference}). Most of them work by querying the inferior 5008(@pxref{package Reference}). Most of them work by querying the inferior
5012@var{package} comes from, so the inferior must still be live when you call 5009@var{package} comes from, so the inferior must still be live when you call
5013these procedures. 5010these procedures.
5014@end deffn 5011@end defun
5015 5012
5016Inferior packages can be used transparently like any other package or 5013Inferior packages can be used transparently like any other package or
5017file-like object in G-expressions (@pxref{G-Expressions}). They are also 5014file-like object in G-expressions (@pxref{G-Expressions}). They are also
@@ -7575,7 +7572,7 @@ That derivation is stored in a @file{.drv} file under @file{/gnu/store}.
7575The build actions it prescribes may then be realized by using the 7572The build actions it prescribes may then be realized by using the
7576@code{build-derivations} procedure (@pxref{The Store}). 7573@code{build-derivations} procedure (@pxref{The Store}).
7577 7574
7578@deffn {Scheme Procedure} package-derivation @var{store} @var{package} [@var{system}] 7575@defun package-derivation store package [system]
7579Return the @code{<derivation>} object of @var{package} for @var{system} 7576Return the @code{<derivation>} object of @var{package} for @var{system}
7580(@pxref{Derivations}). 7577(@pxref{Derivations}).
7581 7578
@@ -7584,22 +7581,21 @@ must be a string denoting the target system type---e.g.,
7584@code{"x86_64-linux"} for an x86_64 Linux-based GNU system. @var{store} 7581@code{"x86_64-linux"} for an x86_64 Linux-based GNU system. @var{store}
7585must be a connection to the daemon, which operates on the store 7582must be a connection to the daemon, which operates on the store
7586(@pxref{The Store}). 7583(@pxref{The Store}).
7587@end deffn 7584@end defun
7588 7585
7589@noindent 7586@noindent
7590@cindex cross-compilation 7587@cindex cross-compilation
7591Similarly, it is possible to compute a derivation that cross-builds a 7588Similarly, it is possible to compute a derivation that cross-builds a
7592package for some other system: 7589package for some other system:
7593 7590
7594@deffn {Scheme Procedure} package-cross-derivation @var{store} @ 7591@defun package-cross-derivation store package target [system]
7595 @var{package} @var{target} [@var{system}]
7596Return the @code{<derivation>} object of @var{package} cross-built from 7592Return the @code{<derivation>} object of @var{package} cross-built from
7597@var{system} to @var{target}. 7593@var{system} to @var{target}.
7598 7594
7599@var{target} must be a valid GNU triplet denoting the target hardware 7595@var{target} must be a valid GNU triplet denoting the target hardware
7600and operating system, such as @code{"aarch64-linux-gnu"} 7596and operating system, such as @code{"aarch64-linux-gnu"}
7601(@pxref{Specifying Target Triplets,,, autoconf, Autoconf}). 7597(@pxref{Specifying Target Triplets,,, autoconf, Autoconf}).
7602@end deffn 7598@end defun
7603 7599
7604Once you have package definitions, you can easily define @emph{variants} 7600Once you have package definitions, you can easily define @emph{variants}
7605of those packages. @xref{Defining Package Variants}, for more on that. 7601of those packages. @xref{Defining Package Variants}, for more on that.
@@ -7810,10 +7806,10 @@ It is an error to refer to @code{this-package} outside a package definition.
7810The following helper procedures are provided to help deal with package 7806The following helper procedures are provided to help deal with package
7811inputs. 7807inputs.
7812 7808
7813@deffn {Scheme Procedure} lookup-package-input @var{package} @var{name} 7809@defun lookup-package-input package name
7814@deffnx {Scheme Procedure} lookup-package-native-input @var{package} @var{name} 7810@defunx lookup-package-native-input package name
7815@deffnx {Scheme Procedure} lookup-package-propagated-input @var{package} @var{name} 7811@defunx lookup-package-propagated-input package name
7816@deffnx {Scheme Procedure} lookup-package-direct-input @var{package} @var{name} 7812@defunx lookup-package-direct-input package name
7817Look up @var{name} among @var{package}'s inputs (or native, propagated, 7813Look up @var{name} among @var{package}'s inputs (or native, propagated,
7818or direct inputs). Return it if found, @code{#f} otherwise. 7814or direct inputs). Return it if found, @code{#f} otherwise.
7819 7815
@@ -7829,7 +7825,7 @@ use it:
7829 7825
7830In this example we obtain the @code{gmp} package that is among the 7826In this example we obtain the @code{gmp} package that is among the
7831direct inputs of @code{coreutils}. 7827direct inputs of @code{coreutils}.
7832@end deffn 7828@end defun
7833 7829
7834@cindex development inputs, of a package 7830@cindex development inputs, of a package
7835@cindex implicit inputs, of a package 7831@cindex implicit inputs, of a package
@@ -7838,8 +7834,7 @@ Sometimes you will want to obtain the list of inputs needed to
7838package is compiled. This is what the @code{package-development-inputs} 7834package is compiled. This is what the @code{package-development-inputs}
7839procedure returns. 7835procedure returns.
7840 7836
7841@deffn {Scheme Procedure} package-development-inputs @var{package} @ 7837@defun package-development-inputs package [system] [#:target #f]
7842 [@var{system}] [#:target #f]
7843Return the list of inputs required by @var{package} for development 7838Return the list of inputs required by @var{package} for development
7844purposes on @var{system}. When @var{target} is true, return the inputs 7839purposes on @var{system}. When @var{target} is true, return the inputs
7845needed to cross-compile @var{package} from @var{system} to 7840needed to cross-compile @var{package} from @var{system} to
@@ -7870,7 +7865,7 @@ because @code{hello} has zero explicit dependencies. Conversely,
7870gzip, GCC, libc, Bash, and more. To visualize it, @command{guix graph 7865gzip, GCC, libc, Bash, and more. To visualize it, @command{guix graph
7871hello} would show you explicit inputs, whereas @command{guix graph -t 7866hello} would show you explicit inputs, whereas @command{guix graph -t
7872bag hello} would include implicit inputs (@pxref{Invoking guix graph}). 7867bag hello} would include implicit inputs (@pxref{Invoking guix graph}).
7873@end deffn 7868@end defun
7874 7869
7875Because packages are regular Scheme objects that capture a complete 7870Because packages are regular Scheme objects that capture a complete
7876dependency graph and associated build procedures, it is often useful to 7871dependency graph and associated build procedures, it is often useful to
@@ -7878,7 +7873,7 @@ write procedures that take a package and return a modified version
7878thereof according to some parameters. Below are a few examples. 7873thereof according to some parameters. Below are a few examples.
7879 7874
7880@cindex tool chain, choosing a package's tool chain 7875@cindex tool chain, choosing a package's tool chain
7881@deffn {Scheme Procedure} package-with-c-toolchain @var{package} @var{toolchain} 7876@defun package-with-c-toolchain package toolchain
7882Return a variant of @var{package} that uses @var{toolchain} instead of 7877Return a variant of @var{package} that uses @var{toolchain} instead of
7883the default GNU C/C++ toolchain. @var{toolchain} must be a list of 7878the default GNU C/C++ toolchain. @var{toolchain} must be a list of
7884inputs (label/package tuples) providing equivalent functionality, such 7879inputs (label/package tuples) providing equivalent functionality, such
@@ -7899,7 +7894,7 @@ fields and is instead pulled in by the build system. Consequently, this
7899procedure works by changing the build system of @var{package} so that it 7894procedure works by changing the build system of @var{package} so that it
7900pulls in @var{toolchain} instead of the defaults. @ref{Build Systems}, 7895pulls in @var{toolchain} instead of the defaults. @ref{Build Systems},
7901for more on build systems. 7896for more on build systems.
7902@end deffn 7897@end defun
7903 7898
7904@node origin Reference 7899@node origin Reference
7905@subsection @code{origin} Reference 7900@subsection @code{origin} Reference
@@ -8016,8 +8011,7 @@ retrieved is determined by its @code{method} field. The @code{(guix
8016download)} module provides the most common method, @code{url-fetch}, 8011download)} module provides the most common method, @code{url-fetch},
8017described below. 8012described below.
8018 8013
8019@deffn {Scheme Procedure} url-fetch @var{url} @var{hash-algo} @var{hash} @ 8014@defun url-fetch url hash-algo hash [name] [#:executable? #f]
8020 [name] [#:executable? #f]
8021Return a fixed-output derivation that fetches data from @var{url} (a 8015Return a fixed-output derivation that fetches data from @var{url} (a
8022string, or a list of strings denoting alternate URLs), which is expected 8016string, or a list of strings denoting alternate URLs), which is expected
8023to have hash @var{hash} of type @var{hash-algo} (a symbol). By default, 8017to have hash @var{hash} of type @var{hash-algo} (a symbol). By default,
@@ -8030,19 +8024,19 @@ interpreted as the name of a mirror scheme, taken from @file{%mirror-file}.
8030 8024
8031Alternatively, when URL starts with @code{file://}, return the 8025Alternatively, when URL starts with @code{file://}, return the
8032corresponding file name in the store. 8026corresponding file name in the store.
8033@end deffn 8027@end defun
8034 8028
8035Likewise, the @code{(guix git-download)} module defines the 8029Likewise, the @code{(guix git-download)} module defines the
8036@code{git-fetch} origin method, which fetches data from a Git version 8030@code{git-fetch} origin method, which fetches data from a Git version
8037control repository, and the @code{git-reference} data type to describe 8031control repository, and the @code{git-reference} data type to describe
8038the repository and revision to fetch. 8032the repository and revision to fetch.
8039 8033
8040@deffn {Scheme Procedure} git-fetch @var{ref} @var{hash-algo} @var{hash} 8034@defun git-fetch ref hash-algo hash
8041Return a fixed-output derivation that fetches @var{ref}, a 8035Return a fixed-output derivation that fetches @var{ref}, a
8042@code{<git-reference>} object. The output is expected to have recursive 8036@code{<git-reference>} object. The output is expected to have recursive
8043hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as 8037hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as
8044the file name, or a generic name if @code{#f}. 8038the file name, or a generic name if @code{#f}.
8045@end deffn 8039@end defun
8046 8040
8047@deftp {Data Type} git-reference 8041@deftp {Data Type} git-reference
8048This data type represents a Git reference for @code{git-fetch} to 8042This data type represents a Git reference for @code{git-fetch} to
@@ -8085,13 +8079,12 @@ For Mercurial repositories, the module @code{(guix hg-download)} defines
8085the @code{hg-fetch} origin method and @code{hg-reference} data type for 8079the @code{hg-fetch} origin method and @code{hg-reference} data type for
8086support of the Mercurial version control system. 8080support of the Mercurial version control system.
8087 8081
8088@deffn {Scheme Procedure} hg-fetch @var{ref} @var{hash-algo} @var{hash} @ 8082@defun hg-fetch ref hash-algo hash [name]
8089 [name]
8090Return a fixed-output derivation that fetches @var{ref}, a 8083Return a fixed-output derivation that fetches @var{ref}, a
8091@code{<hg-reference>} object. The output is expected to have recursive 8084@code{<hg-reference>} object. The output is expected to have recursive
8092hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as 8085hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as
8093the file name, or a generic name if @code{#false}. 8086the file name, or a generic name if @code{#false}.
8094@end deffn 8087@end defun
8095 8088
8096@node Defining Package Variants 8089@node Defining Package Variants
8097@section Defining Package Variants 8090@section Defining Package Variants
@@ -8242,7 +8235,7 @@ These are pretty simple package variants. As a convenience, the
8242that directly maps to the more sophisticated package transformation 8235that directly maps to the more sophisticated package transformation
8243options (@pxref{Package Transformation Options}): 8236options (@pxref{Package Transformation Options}):
8244 8237
8245@deffn {Scheme Procedure} options->transformation @var{opts} 8238@defun options->transformation opts
8246Return a procedure that, when passed an object to build (package, 8239Return a procedure that, when passed an object to build (package,
8247derivation, etc.), applies the transformations specified by @var{opts} and returns 8240derivation, etc.), applies the transformations specified by @var{opts} and returns
8248the resulting objects. @var{opts} must be a list of symbol/string pairs such as: 8241the resulting objects. @var{opts} must be a list of symbol/string pairs such as:
@@ -8254,7 +8247,7 @@ the resulting objects. @var{opts} must be a list of symbol/string pairs such as
8254 8247
8255Each symbol names a transformation and the corresponding string is an argument 8248Each symbol names a transformation and the corresponding string is an argument
8256to that transformation. 8249to that transformation.
8257@end deffn 8250@end defun
8258 8251
8259For instance, a manifest equivalent to this command: 8252For instance, a manifest equivalent to this command:
8260 8253
@@ -8293,8 +8286,7 @@ Dependency graph rewriting, for the purposes of swapping packages in the
8293graph, is what the @code{package-input-rewriting} procedure in 8286graph, is what the @code{package-input-rewriting} procedure in
8294@code{(guix packages)} implements. 8287@code{(guix packages)} implements.
8295 8288
8296@deffn {Scheme Procedure} package-input-rewriting @var{replacements} @ 8289@defun package-input-rewriting replacements [rewrite-name] [#:deep? #t]
8297 [@var{rewrite-name}] [#:deep? #t]
8298Return a procedure that, when passed a package, replaces its direct and 8290Return a procedure that, when passed a package, replaces its direct and
8299indirect dependencies, including implicit inputs when @var{deep?} is 8291indirect dependencies, including implicit inputs when @var{deep?} is
8300true, according to @var{replacements}. @var{replacements} is a list of 8292true, according to @var{replacements}. @var{replacements} is a list of
@@ -8303,7 +8295,7 @@ and the second one is the replacement.
8303 8295
8304Optionally, @var{rewrite-name} is a one-argument procedure that takes 8296Optionally, @var{rewrite-name} is a one-argument procedure that takes
8305the name of a package and returns its new name after rewrite. 8297the name of a package and returns its new name after rewrite.
8306@end deffn 8298@end defun
8307 8299
8308@noindent 8300@noindent
8309Consider this example: 8301Consider this example:
@@ -8356,12 +8348,12 @@ A more generic procedure to rewrite a package dependency graph is
8356@code{package-mapping}: it supports arbitrary changes to nodes in the 8348@code{package-mapping}: it supports arbitrary changes to nodes in the
8357graph. 8349graph.
8358 8350
8359@deffn {Scheme Procedure} package-mapping @var{proc} [@var{cut?}] [#:deep? #f] 8351@defun package-mapping proc [cut?] [#:deep? #f]
8360Return a procedure that, given a package, applies @var{proc} to all the packages 8352Return a procedure that, given a package, applies @var{proc} to all the packages
8361depended on and returns the resulting package. The procedure stops recursion 8353depended on and returns the resulting package. The procedure stops recursion
8362when @var{cut?} returns true for a given package. When @var{deep?} is true, @var{proc} is 8354when @var{cut?} returns true for a given package. When @var{deep?} is true, @var{proc} is
8363applied to implicit inputs as well. 8355applied to implicit inputs as well.
8364@end deffn 8356@end defun
8365 8357
8366@node Writing Manifests 8358@node Writing Manifests
8367@section Writing Manifests 8359@section Writing Manifests
@@ -8566,15 +8558,14 @@ related to a manifest entry coming from a @code{dependencies} field.
8566@end table 8558@end table
8567@end deftp 8559@end deftp
8568 8560
8569@deffn {Scheme Procedure} concatenate-manifests @var{lst} 8561@defun concatenate-manifests lst
8570Concatenate the manifests listed in @var{lst} and return the resulting 8562Concatenate the manifests listed in @var{lst} and return the resulting
8571manifest. 8563manifest.
8572@end deffn 8564@end defun
8573 8565
8574@c TODO: <manifest-pattern>, manifest-lookup, manifest-remove, etc. 8566@c TODO: <manifest-pattern>, manifest-lookup, manifest-remove, etc.
8575 8567
8576@deffn {Scheme Procedure} package->manifest-entry @var{package} @ 8568@defun package->manifest-entry package [output] [#:properties]
8577 [@var{output}] [#:properties]
8578Return a manifest entry for the @var{output} of package @var{package}, 8569Return a manifest entry for the @var{output} of package @var{package},
8579where @var{output} defaults to @code{"out"}, and with the given 8570where @var{output} defaults to @code{"out"}, and with the given
8580@var{properties}. By default @var{properties} is the empty list or, if 8571@var{properties}. By default @var{properties} is the empty list or, if
@@ -8592,9 +8583,9 @@ output and the @code{send-email} output of the @code{git} package:
8592(manifest (list (package->manifest-entry git) 8583(manifest (list (package->manifest-entry git)
8593 (package->manifest-entry git "send-email"))) 8584 (package->manifest-entry git "send-email")))
8594@end lisp 8585@end lisp
8595@end deffn 8586@end defun
8596 8587
8597@deffn {Scheme Procedure} packages->manifest @var{packages} 8588@defun packages->manifest packages
8598Return a list of manifest entries, one for each item listed in 8589Return a list of manifest entries, one for each item listed in
8599@var{packages}. Elements of @var{packages} can be either package 8590@var{packages}. Elements of @var{packages} can be either package
8600objects or package/string tuples denoting a specific output of a 8591objects or package/string tuples denoting a specific output of a
@@ -8608,11 +8599,10 @@ concisely:
8608 8599
8609(packages->manifest (list git `(,git "send-email"))) 8600(packages->manifest (list git `(,git "send-email")))
8610@end lisp 8601@end lisp
8611@end deffn 8602@end defun
8612 8603
8613@anchor{package-development-manifest} 8604@anchor{package-development-manifest}
8614@deffn {Scheme Procedure} package->development-manifest @var{package} @ 8605@defun package->development-manifest package [system] [#:target]
8615 [@var{system}] [#:target]
8616Return a manifest for the @dfn{development inputs} of @var{package} for 8606Return a manifest for the @dfn{development inputs} of @var{package} for
8617@var{system}, optionally when cross-compiling to @var{target}. 8607@var{system}, optionally when cross-compiling to @var{target}.
8618Development inputs include both explicit and implicit inputs of 8608Development inputs include both explicit and implicit inputs of
@@ -8640,7 +8630,7 @@ In this example, the development manifest that
8640(GCC), the many supporting libraries (Boost, GLib, GTK, etc.), and a 8630(GCC), the many supporting libraries (Boost, GLib, GTK, etc.), and a
8641couple of additional development tools---these are the dependencies 8631couple of additional development tools---these are the dependencies
8642@command{guix show inkscape} lists. 8632@command{guix show inkscape} lists.
8643@end deffn 8633@end defun
8644 8634
8645@c TODO: Move (gnu packages) interface to a section of its own. 8635@c TODO: Move (gnu packages) interface to a section of its own.
8646 8636
@@ -8648,7 +8638,7 @@ Last, the @code{(gnu packages)} module provides higher-level facilities
8648to build manifests. In particular, it lets you look up packages by 8638to build manifests. In particular, it lets you look up packages by
8649name---see below. 8639name---see below.
8650 8640
8651@deffn {Scheme Procedure} specifications->manifest @var{specs} 8641@defun specifications->manifest specs
8652Given @var{specs}, a list of specifications such as @code{"emacs@@25.2"} 8642Given @var{specs}, a list of specifications such as @code{"emacs@@25.2"}
8653or @code{"guile:debug"}, return a manifest. Specs have the format that 8643or @code{"guile:debug"}, return a manifest. Specs have the format that
8654command-line tools such as @command{guix install} and @command{guix 8644command-line tools such as @command{guix install} and @command{guix
@@ -8665,7 +8655,7 @@ Notice that we do not need to worry about @code{use-modules}, importing
8665the right set of modules, and referring to the right variables. 8655the right set of modules, and referring to the right variables.
8666Instead, we directly refer to packages in the same way as on the command 8656Instead, we directly refer to packages in the same way as on the command
8667line, which can often be more convenient. 8657line, which can often be more convenient.
8668@end deffn 8658@end defun
8669 8659
8670@c TODO: specifications->package, etc. 8660@c TODO: specifications->package, etc.
8671 8661
@@ -10117,54 +10107,54 @@ procedures provided by @code{(guix build utils)}.
10117 10107
10118This section documents procedures that deal with store file names. 10108This section documents procedures that deal with store file names.
10119 10109
10120@deffn {Scheme Procedure} %store-directory 10110@defun %store-directory
10121Return the directory name of the store. 10111Return the directory name of the store.
10122@end deffn 10112@end defun
10123 10113
10124@deffn {Scheme Procedure} store-file-name? @var{file} 10114@defun store-file-name? file
10125Return true if @var{file} is in the store. 10115Return true if @var{file} is in the store.
10126@end deffn 10116@end defun
10127 10117
10128@deffn {Scheme Procedure} strip-store-file-name @var{file} 10118@defun strip-store-file-name file
10129Strip the @file{/gnu/store} and hash from @var{file}, a store file name. 10119Strip the @file{/gnu/store} and hash from @var{file}, a store file name.
10130The result is typically a @code{"@var{package}-@var{version}"} string. 10120The result is typically a @code{"@var{package}-@var{version}"} string.
10131@end deffn 10121@end defun
10132 10122
10133@deffn {Scheme Procedure} package-name->name+version @var{name} 10123@defun package-name->name+version name
10134Given @var{name}, a package name like @code{"foo-0.9.1b"}, return two 10124Given @var{name}, a package name like @code{"foo-0.9.1b"}, return two
10135values: @code{"foo"} and @code{"0.9.1b"}. When the version part is 10125values: @code{"foo"} and @code{"0.9.1b"}. When the version part is
10136unavailable, @var{name} and @code{#f} are returned. The first hyphen 10126unavailable, @var{name} and @code{#f} are returned. The first hyphen
10137followed by a digit is considered to introduce the version part. 10127followed by a digit is considered to introduce the version part.
10138@end deffn 10128@end defun
10139 10129
10140@subsection File Types 10130@subsection File Types
10141 10131
10142The procedures below deal with files and file types. 10132The procedures below deal with files and file types.
10143 10133
10144@deffn {Scheme Procedure} directory-exists? @var{dir} 10134@defun directory-exists? dir
10145Return @code{#t} if @var{dir} exists and is a directory. 10135Return @code{#t} if @var{dir} exists and is a directory.
10146@end deffn 10136@end defun
10147 10137
10148@deffn {Scheme Procedure} executable-file? @var{file} 10138@defun executable-file? file
10149Return @code{#t} if @var{file} exists and is executable. 10139Return @code{#t} if @var{file} exists and is executable.
10150@end deffn 10140@end defun
10151 10141
10152@deffn {Scheme Procedure} symbolic-link? @var{file} 10142@defun symbolic-link? file
10153Return @code{#t} if @var{file} is a symbolic link (aka. a ``symlink''). 10143Return @code{#t} if @var{file} is a symbolic link (aka. a ``symlink'').
10154@end deffn 10144@end defun
10155 10145
10156@deffn {Scheme Procedure} elf-file? @var{file} 10146@defun elf-file? file
10157@deffnx {Scheme Procedure} ar-file? @var{file} 10147@defunx ar-file? file
10158@deffnx {Scheme Procedure} gzip-file? @var{file} 10148@defunx gzip-file? file
10159Return @code{#t} if @var{file} is, respectively, an ELF file, an 10149Return @code{#t} if @var{file} is, respectively, an ELF file, an
10160@code{ar} archive (such as a @file{.a} static library), or a gzip file. 10150@code{ar} archive (such as a @file{.a} static library), or a gzip file.
10161@end deffn 10151@end defun
10162 10152
10163@deffn {Scheme Procedure} reset-gzip-timestamp @var{file} [#:keep-mtime? #t] 10153@defun reset-gzip-timestamp file [#:keep-mtime? #t]
10164If @var{file} is a gzip file, reset its embedded timestamp (as with 10154If @var{file} is a gzip file, reset its embedded timestamp (as with
10165@command{gzip --no-name}) and return true. Otherwise return @code{#f}. 10155@command{gzip --no-name}) and return true. Otherwise return @code{#f}.
10166When @var{keep-mtime?} is true, preserve @var{file}'s modification time. 10156When @var{keep-mtime?} is true, preserve @var{file}'s modification time.
10167@end deffn 10157@end defun
10168 10158
10169@subsection File Manipulation 10159@subsection File Manipulation
10170 10160
@@ -10185,20 +10175,20 @@ normal procedure return or @i{via} a non-local exit such as an
10185exception. 10175exception.
10186@end deffn 10176@end deffn
10187 10177
10188@deffn {Scheme Procedure} mkdir-p @var{dir} 10178@defun mkdir-p dir
10189Create directory @var{dir} and all its ancestors. 10179Create directory @var{dir} and all its ancestors.
10190@end deffn 10180@end defun
10191 10181
10192@deffn {Scheme Procedure} install-file @var{file} @var{directory} 10182@defun install-file file directory
10193Create @var{directory} if it does not exist and copy @var{file} in there 10183Create @var{directory} if it does not exist and copy @var{file} in there
10194under the same name. 10184under the same name.
10195@end deffn 10185@end defun
10196 10186
10197@deffn {Scheme Procedure} make-file-writable @var{file} 10187@defun make-file-writable file
10198Make @var{file} writable for its owner. 10188Make @var{file} writable for its owner.
10199@end deffn 10189@end defun
10200 10190
10201@deffn {Scheme Procedure} copy-recursively @var{source} @var{destination} @ 10191@defun copy-recursively source destination @
10202 [#:log (current-output-port)] [#:follow-symlinks? #f] @ 10192 [#:log (current-output-port)] [#:follow-symlinks? #f] @
10203 [#:copy-file copy-file] [#:keep-mtime? #f] [#:keep-permissions? #t] 10193 [#:copy-file copy-file] [#:keep-mtime? #f] [#:keep-permissions? #t]
10204Copy @var{source} directory to @var{destination}. Follow symlinks if 10194Copy @var{source} directory to @var{destination}. Follow symlinks if
@@ -10207,14 +10197,13 @@ Copy @var{source} directory to @var{destination}. Follow symlinks if
10207keep the modification time of the files in @var{source} on those of 10197keep the modification time of the files in @var{source} on those of
10208@var{destination}. When @var{keep-permissions?} is true, preserve file 10198@var{destination}. When @var{keep-permissions?} is true, preserve file
10209permissions. Write verbose output to the @var{log} port. 10199permissions. Write verbose output to the @var{log} port.
10210@end deffn 10200@end defun
10211 10201
10212@deffn {Scheme Procedure} delete-file-recursively @var{dir} @ 10202@defun delete-file-recursively dir [#:follow-mounts? #f]
10213 [#:follow-mounts? #f]
10214Delete @var{dir} recursively, like @command{rm -rf}, without following 10203Delete @var{dir} recursively, like @command{rm -rf}, without following
10215symlinks. Don't follow mount points either, unless @var{follow-mounts?} 10204symlinks. Don't follow mount points either, unless @var{follow-mounts?}
10216is true. Report but ignore errors. 10205is true. Report but ignore errors.
10217@end deffn 10206@end defun
10218 10207
10219@deffn {Scheme Syntax} substitute* @var{file} @ 10208@deffn {Scheme Syntax} substitute* @var{file} @
10220 ((@var{regexp} @var{match-var}@dots{}) @var{body}@dots{}) @dots{} 10209 ((@var{regexp} @var{match-var}@dots{}) @var{body}@dots{}) @dots{}
@@ -10250,12 +10239,12 @@ won't match the terminating newline of a line.
10250@cindex file, searching 10239@cindex file, searching
10251This section documents procedures to search and filter files. 10240This section documents procedures to search and filter files.
10252 10241
10253@deffn {Scheme Procedure} file-name-predicate @var{regexp} 10242@defun file-name-predicate regexp
10254Return a predicate that returns true when passed a file name whose base 10243Return a predicate that returns true when passed a file name whose base
10255name matches @var{regexp}. 10244name matches @var{regexp}.
10256@end deffn 10245@end defun
10257 10246
10258@deffn {Scheme Procedure} find-files @var{dir} [@var{pred}] @ 10247@defun find-files dir [pred] @
10259 [#:stat lstat] [#:directories? #f] [#:fail-on-error? #f] 10248 [#:stat lstat] [#:directories? #f] [#:fail-on-error? #f]
10260Return the lexicographically sorted list of files under @var{dir} for 10249Return the lexicographically sorted list of files under @var{dir} for
10261which @var{pred} returns true. @var{pred} is passed two arguments: the 10250which @var{pred} returns true. @var{pred} is passed two arguments: the
@@ -10266,7 +10255,7 @@ case it is equivalent to @code{(file-name-predicate @var{pred})}.
10266that symlinks are not followed. If @var{directories?} is true, then 10255that symlinks are not followed. If @var{directories?} is true, then
10267directories will also be included. If @var{fail-on-error?} is true, 10256directories will also be included. If @var{fail-on-error?} is true,
10268raise an exception upon error. 10257raise an exception upon error.
10269@end deffn 10258@end defun
10270 10259
10271Here are a few examples where we assume that the current directory is 10260Here are a few examples where we assume that the current directory is
10272the root of the Guix source tree: 10261the root of the Guix source tree:
@@ -10285,13 +10274,13 @@ the root of the Guix source tree:
10285@result{} ("./libformat.a" "./libstore.a" @dots{}) 10274@result{} ("./libformat.a" "./libstore.a" @dots{})
10286@end lisp 10275@end lisp
10287 10276
10288@deffn {Scheme Procedure} which @var{program} 10277@defun which program
10289Return the complete file name for @var{program} as found in 10278Return the complete file name for @var{program} as found in
10290@code{$PATH}, or @code{#f} if @var{program} could not be found. 10279@code{$PATH}, or @code{#f} if @var{program} could not be found.
10291@end deffn 10280@end defun
10292 10281
10293@deffn {Scheme Procedure} search-input-file @var{inputs} @var{name} 10282@defun search-input-file inputs name
10294@deffnx {Scheme Procedure} search-input-directory @var{inputs} @var{name} 10283@defunx search-input-directory inputs name
10295Return the complete file name for @var{name} as found in @var{inputs}; 10284Return the complete file name for @var{name} as found in @var{inputs};
10296@code{search-input-file} searches for a regular file and 10285@code{search-input-file} searches for a regular file and
10297@code{search-input-directory} searches for a directory. If @var{name} 10286@code{search-input-directory} searches for a directory. If @var{name}
@@ -10300,7 +10289,7 @@ could not be found, an exception is raised.
10300Here, @var{inputs} must be an association list like @code{inputs} and 10289Here, @var{inputs} must be an association list like @code{inputs} and
10301@code{native-inputs} as available to build phases (@pxref{Build 10290@code{native-inputs} as available to build phases (@pxref{Build
10302Phases}). 10291Phases}).
10303@end deffn 10292@end defun
10304 10293
10305Here is a (simplified) example of how @code{search-input-file} is used 10294Here is a (simplified) example of how @code{search-input-file} is used
10306in a build phase of the @code{wireguard-tools} package: 10295in a build phase of the @code{wireguard-tools} package:
@@ -10323,7 +10312,7 @@ You'll find handy procedures to spawn processes in this module,
10323essentially convenient wrappers around Guile's @code{system*} 10312essentially convenient wrappers around Guile's @code{system*}
10324(@pxref{Processes, @code{system*},, guile, GNU Guile Reference Manual}). 10313(@pxref{Processes, @code{system*},, guile, GNU Guile Reference Manual}).
10325 10314
10326@deffn {Scheme Procedure} invoke @var{program} @var{args}@dots{} 10315@defun invoke program args@dots{}
10327Invoke @var{program} with the given @var{args}. Raise an 10316Invoke @var{program} with the given @var{args}. Raise an
10328@code{&invoke-error} exception if the exit code is non-zero; otherwise 10317@code{&invoke-error} exception if the exit code is non-zero; otherwise
10329return @code{#t}. 10318return @code{#t}.
@@ -10331,21 +10320,21 @@ return @code{#t}.
10331The advantage compared to @code{system*} is that you do not need to 10320The advantage compared to @code{system*} is that you do not need to
10332check the return value. This reduces boilerplate in shell-script-like 10321check the return value. This reduces boilerplate in shell-script-like
10333snippets for instance in package build phases. 10322snippets for instance in package build phases.
10334@end deffn 10323@end defun
10335 10324
10336@deffn {Scheme Procedure} invoke-error? @var{c} 10325@defun invoke-error? c
10337Return true if @var{c} is an @code{&invoke-error} condition. 10326Return true if @var{c} is an @code{&invoke-error} condition.
10338@end deffn 10327@end defun
10339 10328
10340@deffn {Scheme Procedure} invoke-error-program @var{c} 10329@defun invoke-error-program c
10341@deffnx {Scheme Procedure} invoke-error-arguments @var{c} 10330@defunx invoke-error-arguments c
10342@deffnx {Scheme Procedure} invoke-error-exit-status @var{c} 10331@defunx invoke-error-exit-status c
10343@deffnx {Scheme Procedure} invoke-error-term-signal @var{c} 10332@defunx invoke-error-term-signal c
10344@deffnx {Scheme Procedure} invoke-error-stop-signal @var{c} 10333@defunx invoke-error-stop-signal c
10345Access specific fields of @var{c}, an @code{&invoke-error} condition. 10334Access specific fields of @var{c}, an @code{&invoke-error} condition.
10346@end deffn 10335@end defun
10347 10336
10348@deffn {Scheme Procedure} report-invoke-error @var{c} [@var{port}] 10337@defun report-invoke-error c [port]
10349Report to @var{port} (by default the current error port) about @var{c}, 10338Report to @var{port} (by default the current error port) about @var{c},
10350an @code{&invoke-error} condition, in a human-friendly way. 10339an @code{&invoke-error} condition, in a human-friendly way.
10351 10340
@@ -10361,9 +10350,9 @@ Typical usage would look like this:
10361 10350
10362@print{} command "date" "--imaginary-option" failed with status 1 10351@print{} command "date" "--imaginary-option" failed with status 1
10363@end lisp 10352@end lisp
10364@end deffn 10353@end defun
10365 10354
10366@deffn {Scheme Procedure} invoke/quiet @var{program} @var{args}@dots{} 10355@defun invoke/quiet program args@dots{}
10367Invoke @var{program} with @var{args} and capture @var{program}'s 10356Invoke @var{program} with @var{args} and capture @var{program}'s
10368standard output and standard error. If @var{program} succeeds, print 10357standard output and standard error. If @var{program} succeeds, print
10369nothing and return the unspecified value; otherwise, raise a 10358nothing and return the unspecified value; otherwise, raise a
@@ -10387,7 +10376,7 @@ Here's an example:
10387 date: unrecognized option '--imaginary-option' 10376 date: unrecognized option '--imaginary-option'
10388 Try 'date --help' for more information. 10377 Try 'date --help' for more information.
10389@end lisp 10378@end lisp
10390@end deffn 10379@end defun
10391 10380
10392@subsection Build Phases 10381@subsection Build Phases
10393 10382
@@ -10497,8 +10486,7 @@ are always found. The wrapper would be used to set @env{PATH},
10497To ease that task, the @code{(guix build utils)} module provides a 10486To ease that task, the @code{(guix build utils)} module provides a
10498couple of helpers to wrap commands. 10487couple of helpers to wrap commands.
10499 10488
10500@deffn {Scheme Procedure} wrap-program @var{program} @ 10489@defun wrap-program program [#:sh sh] [#:rest variables]
10501 [#:sh @var{sh}] [#:rest @var{variables}]
10502Make a wrapper for @var{program}. @var{variables} should look like this: 10490Make a wrapper for @var{program}. @var{variables} should look like this:
10503 10491
10504@lisp 10492@lisp
@@ -10530,10 +10518,9 @@ exec -a $0 location/of/.foo-real "$@@"
10530If @var{program} has previously been wrapped by @code{wrap-program}, the 10518If @var{program} has previously been wrapped by @code{wrap-program}, the
10531wrapper is extended with definitions for @var{variables}. If it is not, 10519wrapper is extended with definitions for @var{variables}. If it is not,
10532@var{sh} will be used as the interpreter. 10520@var{sh} will be used as the interpreter.
10533@end deffn 10521@end defun
10534 10522
10535@deffn {Scheme Procedure} wrap-script @var{program} @ 10523@defun wrap-script program [#:guile guile] [#:rest variables]
10536 [#:guile @var{guile}] [#:rest @var{variables}]
10537Wrap the script @var{program} such that @var{variables} are set first. 10524Wrap the script @var{program} such that @var{variables} are set first.
10538The format of @var{variables} is the same as in the @code{wrap-program} 10525The format of @var{variables} is the same as in the @code{wrap-program}
10539procedure. This procedure differs from @code{wrap-program} in that it 10526procedure. This procedure differs from @code{wrap-program} in that it
@@ -10546,7 +10533,7 @@ second line.
10546 10533
10547Note that this procedure can only be used once per file as Guile scripts are 10534Note that this procedure can only be used once per file as Guile scripts are
10548not supported. 10535not supported.
10549@end deffn 10536@end defun
10550 10537
10551@node Search Paths 10538@node Search Paths
10552@section Search Paths 10539@section Search Paths
@@ -10735,13 +10722,12 @@ How do you turn search path specifications on one hand and a bunch of
10735directories on the other hand in a set of environment variable 10722directories on the other hand in a set of environment variable
10736definitions? That's the job of @code{evaluate-search-paths}. 10723definitions? That's the job of @code{evaluate-search-paths}.
10737 10724
10738@deffn {Scheme Procedure} evaluate-search-paths @var{search-paths} @ 10725@defun evaluate-search-paths search-paths directories [getenv]
10739 @var{directories} [@var{getenv}]
10740Evaluate @var{search-paths}, a list of search-path specifications, for 10726Evaluate @var{search-paths}, a list of search-path specifications, for
10741@var{directories}, a list of directory names, and return a list of 10727@var{directories}, a list of directory names, and return a list of
10742specification/value pairs. Use @var{getenv} to determine the current 10728specification/value pairs. Use @var{getenv} to determine the current
10743settings and report only settings not already effective. 10729settings and report only settings not already effective.
10744@end deffn 10730@end defun
10745 10731
10746The @code{(guix profiles)} provides a higher-level helper procedure, 10732The @code{(guix profiles)} provides a higher-level helper procedure,
10747@code{load-profile}, that sets the environment variables of a profile. 10733@code{load-profile}, that sets the environment variables of a profile.
@@ -10845,7 +10831,7 @@ share any problems or suggestions you may have (@pxref{Contributing}).
10845@end quotation 10831@end quotation
10846@end defvr 10832@end defvr
10847 10833
10848@deffn {Scheme Procedure} open-connection [@var{uri}] [#:reserve-space? #t] 10834@defun open-connection [uri] [#:reserve-space? #t]
10849Connect to the daemon over the Unix-domain socket at @var{uri} (a string). When 10835Connect to the daemon over the Unix-domain socket at @var{uri} (a string). When
10850@var{reserve-space?} is true, instruct it to reserve a little bit of 10836@var{reserve-space?} is true, instruct it to reserve a little bit of
10851extra space on the file system so that the garbage collector can still 10837extra space on the file system so that the garbage collector can still
@@ -10853,11 +10839,11 @@ operate should the disk become full. Return a server object.
10853 10839
10854@var{file} defaults to @code{%default-socket-path}, which is the normal 10840@var{file} defaults to @code{%default-socket-path}, which is the normal
10855location given the options that were passed to @command{configure}. 10841location given the options that were passed to @command{configure}.
10856@end deffn 10842@end defun
10857 10843
10858@deffn {Scheme Procedure} close-connection @var{server} 10844@defun close-connection server
10859Close the connection to @var{server}. 10845Close the connection to @var{server}.
10860@end deffn 10846@end defun
10861 10847
10862@defvar current-build-output-port 10848@defvar current-build-output-port
10863This variable is bound to a SRFI-39 parameter, which refers to the port 10849This variable is bound to a SRFI-39 parameter, which refers to the port
@@ -10867,8 +10853,8 @@ where build and error logs sent by the daemon should be written.
10867Procedures that make RPCs all take a server object as their first 10853Procedures that make RPCs all take a server object as their first
10868argument. 10854argument.
10869 10855
10870@deffn {Scheme Procedure} valid-path? @var{server} @var{path}
10871@cindex invalid store items 10856@cindex invalid store items
10857@defun valid-path? server path
10872Return @code{#t} when @var{path} designates a valid store item and 10858Return @code{#t} when @var{path} designates a valid store item and
10873@code{#f} otherwise (an invalid item may exist on disk but still be 10859@code{#f} otherwise (an invalid item may exist on disk but still be
10874invalid, for instance because it is the result of an aborted or failed 10860invalid, for instance because it is the result of an aborted or failed
@@ -10876,20 +10862,19 @@ build).
10876 10862
10877A @code{&store-protocol-error} condition is raised if @var{path} is not 10863A @code{&store-protocol-error} condition is raised if @var{path} is not
10878prefixed by the store directory (@file{/gnu/store}). 10864prefixed by the store directory (@file{/gnu/store}).
10879@end deffn 10865@end defun
10880 10866
10881@deffn {Scheme Procedure} add-text-to-store @var{server} @var{name} @var{text} [@var{references}] 10867@defun add-text-to-store server name text [references]
10882Add @var{text} under file @var{name} in the store, and return its store 10868Add @var{text} under file @var{name} in the store, and return its store
10883path. @var{references} is the list of store paths referred to by the 10869path. @var{references} is the list of store paths referred to by the
10884resulting store path. 10870resulting store path.
10885@end deffn 10871@end defun
10886 10872
10887@deffn {Scheme Procedure} build-derivations @var{store} @var{derivations} @ 10873@defun build-derivations store derivations [mode]
10888 [@var{mode}]
10889Build @var{derivations}, a list of @code{<derivation>} objects, @file{.drv} 10874Build @var{derivations}, a list of @code{<derivation>} objects, @file{.drv}
10890file names, or derivation/output pairs, using the specified 10875file names, or derivation/output pairs, using the specified
10891@var{mode}---@code{(build-mode normal)} by default. 10876@var{mode}---@code{(build-mode normal)} by default.
10892@end deffn 10877@end defun
10893 10878
10894Note that the @code{(guix monads)} module provides a monad as well as 10879Note that the @code{(guix monads)} module provides a monad as well as
10895monadic versions of the above procedures, with the goal of making it 10880monadic versions of the above procedures, with the goal of making it
@@ -10963,8 +10948,8 @@ derivations as Scheme objects, along with procedures to create and
10963otherwise manipulate derivations. The lowest-level primitive to create 10948otherwise manipulate derivations. The lowest-level primitive to create
10964a derivation is the @code{derivation} procedure: 10949a derivation is the @code{derivation} procedure:
10965 10950
10966@deffn {Scheme Procedure} derivation @var{store} @var{name} @var{builder} @ 10951@defun derivation store name builder args @
10967 @var{args} [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @ 10952 [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @
10968 [#:recursive? #f] [#:inputs '()] [#:env-vars '()] @ 10953 [#:recursive? #f] [#:inputs '()] [#:env-vars '()] @
10969 [#:system (%current-system)] [#:references-graphs #f] @ 10954 [#:system (%current-system)] [#:references-graphs #f] @
10970 [#:allowed-references #f] [#:disallowed-references #f] @ 10955 [#:allowed-references #f] [#:disallowed-references #f] @
@@ -11009,7 +10994,7 @@ host CPU instruction set.
11009 10994
11010@var{properties} must be an association list describing ``properties'' of the 10995@var{properties} must be an association list describing ``properties'' of the
11011derivation. It is kept as-is, uninterpreted, in the derivation. 10996derivation. It is kept as-is, uninterpreted, in the derivation.
11012@end deffn 10997@end defun
11013 10998
11014@noindent 10999@noindent
11015Here's an example with a shell script as its builder, assuming 11000Here's an example with a shell script as its builder, assuming
@@ -11042,8 +11027,7 @@ derivations with build code written in Scheme was achieved with
11042@code{build-expression->derivation}, documented below. This procedure 11027@code{build-expression->derivation}, documented below. This procedure
11043is now deprecated in favor of the much nicer @code{gexp->derivation}. 11028is now deprecated in favor of the much nicer @code{gexp->derivation}.
11044 11029
11045@deffn {Scheme Procedure} build-expression->derivation @var{store} @ 11030@defun build-expression->derivation store name exp @
11046 @var{name} @var{exp} @
11047 [#:system (%current-system)] [#:inputs '()] @ 11031 [#:system (%current-system)] [#:inputs '()] @
11048 [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @ 11032 [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @
11049 [#:recursive? #f] [#:env-vars '()] [#:modules '()] @ 11033 [#:recursive? #f] [#:env-vars '()] [#:modules '()] @
@@ -11075,7 +11059,7 @@ See the @code{derivation} procedure for the meaning of
11075@var{references-graphs}, @var{allowed-references}, 11059@var{references-graphs}, @var{allowed-references},
11076@var{disallowed-references}, @var{local-build?}, and 11060@var{disallowed-references}, @var{local-build?}, and
11077@var{substitutable?}. 11061@var{substitutable?}.
11078@end deffn 11062@end defun
11079 11063
11080@noindent 11064@noindent
11081Here's an example of a single-output derivation that creates a directory 11065Here's an example of a single-output derivation that creates a directory
@@ -11330,10 +11314,10 @@ Pop a value from the current state and return it as a monadic value.
11330The state is assumed to be a list. 11314The state is assumed to be a list.
11331@end deffn 11315@end deffn
11332 11316
11333@deffn {Scheme Procedure} run-with-state @var{mval} [@var{state}] 11317@defun run-with-state mval [state]
11334Run monadic value @var{mval} starting with @var{state} as the initial 11318Run monadic value @var{mval} starting with @var{state} as the initial
11335state. Return two values: the resulting value, and the resulting state. 11319state. Return two values: the resulting value, and the resulting state.
11336@end deffn 11320@end defun
11337 11321
11338The main interface to the store monad, provided by the @code{(guix 11322The main interface to the store monad, provided by the @code{(guix
11339store)} module, is as follows. 11323store)} module, is as follows.
@@ -11346,10 +11330,11 @@ effect is needed, a value of the store monad must be ``evaluated'' by
11346passing it to the @code{run-with-store} procedure (see below). 11330passing it to the @code{run-with-store} procedure (see below).
11347@end defvar 11331@end defvar
11348 11332
11349@deffn {Scheme Procedure} run-with-store @var{store} @var{mval} [#:guile-for-build] [#:system (%current-system)] 11333@defun run-with-store store mval @
11334 [#:guile-for-build] [#:system (%current-system)]
11350Run @var{mval}, a monadic value in the store monad, in @var{store}, an 11335Run @var{mval}, a monadic value in the store monad, in @var{store}, an
11351open store connection. 11336open store connection.
11352@end deffn 11337@end defun
11353 11338
11354@deffn {Monadic Procedure} text-file @var{name} @var{text} [@var{references}] 11339@deffn {Monadic Procedure} text-file @var{name} @var{text} [@var{references}]
11355Return as a monadic value the absolute file name in the store of the file 11340Return as a monadic value the absolute file name in the store of the file
@@ -11693,9 +11678,9 @@ are also added to the load path of the gexp returned by
11693@var{body}@dots{}. 11678@var{body}@dots{}.
11694@end deffn 11679@end deffn
11695 11680
11696@deffn {Scheme Procedure} gexp? @var{obj} 11681@defun gexp? obj
11697Return @code{#t} if @var{obj} is a G-expression. 11682Return @code{#t} if @var{obj} is a G-expression.
11698@end deffn 11683@end defun
11699 11684
11700G-expressions are meant to be written to disk, either as code building 11685G-expressions are meant to be written to disk, either as code building
11701some derivation, or as plain files in the store. The monadic procedures 11686some derivation, or as plain files in the store. The monadic procedures
@@ -11782,8 +11767,7 @@ does not have any effect on what the G-expression does.
11782@code{plain-file} can be used similarly; it differs in that the file 11767@code{plain-file} can be used similarly; it differs in that the file
11783content is directly passed as a string. 11768content is directly passed as a string.
11784 11769
11785@deffn {Scheme Procedure} local-file @var{file} [@var{name}] @ 11770@defun local-file file [name] [#:recursive? #f] [#:select? (const #t)]
11786 [#:recursive? #f] [#:select? (const #t)]
11787Return an object representing local file @var{file} to add to the store; 11771Return an object representing local file @var{file} to add to the store;
11788this object can be used in a gexp. If @var{file} is a literal string 11772this object can be used in a gexp. If @var{file} is a literal string
11789denoting a relative file name, it is looked up relative to the source 11773denoting a relative file name, it is looked up relative to the source
@@ -11803,24 +11787,23 @@ entries for which @var{select?} does not return true.
11803 11787
11804This is the declarative counterpart of the @code{interned-file} monadic 11788This is the declarative counterpart of the @code{interned-file} monadic
11805procedure (@pxref{The Store Monad, @code{interned-file}}). 11789procedure (@pxref{The Store Monad, @code{interned-file}}).
11806@end deffn 11790@end defun
11807 11791
11808@deffn {Scheme Procedure} plain-file @var{name} @var{content} 11792@defun plain-file name content
11809Return an object representing a text file called @var{name} with the given 11793Return an object representing a text file called @var{name} with the given
11810@var{content} (a string or a bytevector) to be added to the store. 11794@var{content} (a string or a bytevector) to be added to the store.
11811 11795
11812This is the declarative counterpart of @code{text-file}. 11796This is the declarative counterpart of @code{text-file}.
11813@end deffn 11797@end defun
11814 11798
11815@deffn {Scheme Procedure} computed-file @var{name} @var{gexp} @ 11799@defun computed-file name gexp [#:local-build? #t] [#:options '()]
11816 [#:local-build? #t] [#:options '()]
11817Return an object representing the store item @var{name}, a file or 11800Return an object representing the store item @var{name}, a file or
11818directory computed by @var{gexp}. When @var{local-build?} is true (the 11801directory computed by @var{gexp}. When @var{local-build?} is true (the
11819default), the derivation is built locally. @var{options} is a list of 11802default), the derivation is built locally. @var{options} is a list of
11820additional arguments to pass to @code{gexp->derivation}. 11803additional arguments to pass to @code{gexp->derivation}.
11821 11804
11822This is the declarative counterpart of @code{gexp->derivation}. 11805This is the declarative counterpart of @code{gexp->derivation}.
11823@end deffn 11806@end defun
11824 11807
11825@deffn {Monadic Procedure} gexp->script @var{name} @var{exp} @ 11808@deffn {Monadic Procedure} gexp->script @var{name} @var{exp} @
11826 [#:guile (default-guile)] [#:module-path %load-path] @ 11809 [#:guile (default-guile)] [#:module-path %load-path] @
@@ -11851,14 +11834,13 @@ executable file @file{/gnu/store/@dots{}-list-files} along these lines:
11851@end example 11834@end example
11852@end deffn 11835@end deffn
11853 11836
11854@deffn {Scheme Procedure} program-file @var{name} @var{exp} @ 11837@defun program-file name exp [#:guile #f] [#:module-path %load-path]
11855 [#:guile #f] [#:module-path %load-path]
11856Return an object representing the executable store item @var{name} that 11838Return an object representing the executable store item @var{name} that
11857runs @var{gexp}. @var{guile} is the Guile package used to execute that 11839runs @var{gexp}. @var{guile} is the Guile package used to execute that
11858script. Imported modules of @var{gexp} are looked up in @var{module-path}. 11840script. Imported modules of @var{gexp} are looked up in @var{module-path}.
11859 11841
11860This is the declarative counterpart of @code{gexp->script}. 11842This is the declarative counterpart of @code{gexp->script}.
11861@end deffn 11843@end defun
11862 11844
11863@deffn {Monadic Procedure} gexp->file @var{name} @var{exp} @ 11845@deffn {Monadic Procedure} gexp->file @var{name} @var{exp} @
11864 [#:set-load-path? #t] [#:module-path %load-path] @ 11846 [#:set-load-path? #t] [#:module-path %load-path] @
@@ -11877,13 +11859,12 @@ The resulting file holds references to all the dependencies of @var{exp}
11877or a subset thereof. 11859or a subset thereof.
11878@end deffn 11860@end deffn
11879 11861
11880@deffn {Scheme Procedure} scheme-file @var{name} @var{exp} @ 11862@defun scheme-file name exp [#:splice? #f] [#:set-load-path? #t]
11881 [#:splice? #f] [#:set-load-path? #t]
11882Return an object representing the Scheme file @var{name} that contains 11863Return an object representing the Scheme file @var{name} that contains
11883@var{exp}. 11864@var{exp}.
11884 11865
11885This is the declarative counterpart of @code{gexp->file}. 11866This is the declarative counterpart of @code{gexp->file}.
11886@end deffn 11867@end defun
11887 11868
11888@deffn {Monadic Procedure} text-file* @var{name} @var{text} @dots{} 11869@deffn {Monadic Procedure} text-file* @var{name} @var{text} @dots{}
11889Return as a monadic value a derivation that builds a text file 11870Return as a monadic value a derivation that builds a text file
@@ -11911,7 +11892,7 @@ will reference @var{coreutils}, @var{grep}, and @var{sed}, thereby
11911preventing them from being garbage-collected during its lifetime. 11892preventing them from being garbage-collected during its lifetime.
11912@end deffn 11893@end deffn
11913 11894
11914@deffn {Scheme Procedure} mixed-text-file @var{name} @var{text} @dots{} 11895@defun mixed-text-file name text @dots{}
11915Return an object representing store file @var{name} containing 11896Return an object representing store file @var{name} containing
11916@var{text}. @var{text} is a sequence of strings and file-like objects, 11897@var{text}. @var{text} is a sequence of strings and file-like objects,
11917as in: 11898as in:
@@ -11922,9 +11903,9 @@ as in:
11922@end lisp 11903@end lisp
11923 11904
11924This is the declarative counterpart of @code{text-file*}. 11905This is the declarative counterpart of @code{text-file*}.
11925@end deffn 11906@end defun
11926 11907
11927@deffn {Scheme Procedure} file-union @var{name} @var{files} 11908@defun file-union name files
11928Return a @code{<computed-file>} that builds a directory containing all of @var{files}. 11909Return a @code{<computed-file>} that builds a directory containing all of @var{files}.
11929Each item in @var{files} must be a two-element list where the first element is the 11910Each item in @var{files} must be a two-element list where the first element is the
11930file name to use in the new directory, and the second element is a gexp 11911file name to use in the new directory, and the second element is a gexp
@@ -11939,9 +11920,9 @@ denoting the target file. Here's an example:
11939@end lisp 11920@end lisp
11940 11921
11941This yields an @code{etc} directory containing these two files. 11922This yields an @code{etc} directory containing these two files.
11942@end deffn 11923@end defun
11943 11924
11944@deffn {Scheme Procedure} directory-union @var{name} @var{things} 11925@defun directory-union name things
11945Return a directory that is the union of @var{things}, where @var{things} is a list of 11926Return a directory that is the union of @var{things}, where @var{things} is a list of
11946file-like objects denoting directories. For example: 11927file-like objects denoting directories. For example:
11947 11928
@@ -11950,9 +11931,9 @@ file-like objects denoting directories. For example:
11950@end lisp 11931@end lisp
11951 11932
11952yields a directory that is the union of the @code{guile} and @code{emacs} packages. 11933yields a directory that is the union of the @code{guile} and @code{emacs} packages.
11953@end deffn 11934@end defun
11954 11935
11955@deffn {Scheme Procedure} file-append @var{obj} @var{suffix} @dots{} 11936@defun file-append obj suffix @dots{}
11956Return a file-like object that expands to the concatenation of @var{obj} 11937Return a file-like object that expands to the concatenation of @var{obj}
11957and @var{suffix}, where @var{obj} is a lowerable object and each 11938and @var{suffix}, where @var{obj} is a lowerable object and each
11958@var{suffix} is a string. 11939@var{suffix} is a string.
@@ -11977,7 +11958,7 @@ There is one difference though: in the @code{file-append} case, the
11977resulting script contains the absolute file name as a string, whereas in 11958resulting script contains the absolute file name as a string, whereas in
11978the second case, the resulting script contains a @code{(string-append 11959the second case, the resulting script contains a @code{(string-append
11979@dots{})} expression to construct the file name @emph{at run time}. 11960@dots{})} expression to construct the file name @emph{at run time}.
11980@end deffn 11961@end defun
11981 11962
11982@deffn {Scheme Syntax} let-system @var{system} @var{body}@dots{} 11963@deffn {Scheme Syntax} let-system @var{system} @var{body}@dots{}
11983@deffnx {Scheme Syntax} let-system (@var{system} @var{target}) @var{body}@dots{} 11964@deffnx {Scheme Syntax} let-system (@var{system} @var{target}) @var{body}@dots{}
@@ -12044,7 +12025,7 @@ corresponding to @var{obj} for @var{system}, cross-compiling for
12044has an associated gexp compiler, such as a @code{<package>}. 12025has an associated gexp compiler, such as a @code{<package>}.
12045@end deffn 12026@end deffn
12046 12027
12047@deffn {Procedure} gexp->approximate-sexp @var{gexp} 12028@defun gexp->approximate-sexp gexp
12048Sometimes, it may be useful to convert a G-exp into a S-exp. For 12029Sometimes, it may be useful to convert a G-exp into a S-exp. For
12049example, some linters (@pxref{Invoking guix lint}) peek into the build 12030example, some linters (@pxref{Invoking guix lint}) peek into the build
12050phases of a package to detect potential problems. This conversion can 12031phases of a package to detect potential problems. This conversion can
@@ -12052,7 +12033,7 @@ be achieved with this procedure. However, some information can be lost
12052in the process. More specifically, lowerable objects will be silently 12033in the process. More specifically, lowerable objects will be silently
12053replaced with some arbitrary object -- currently the list 12034replaced with some arbitrary object -- currently the list
12054@code{(*approximate*)}, but this may change. 12035@code{(*approximate*)}, but this may change.
12055@end deffn 12036@end defun
12056 12037
12057@node Invoking guix repl 12038@node Invoking guix repl
12058@section Invoking @command{guix repl} 12039@section Invoking @command{guix repl}
@@ -16868,7 +16849,7 @@ example for an encrypted partition (@pxref{Mapped Devices}).
16868@end table 16849@end table
16869@end deftp 16850@end deftp
16870 16851
16871@deffn {Scheme Procedure} file-system-label @var{str} 16852@defun file-system-label str
16872This procedure returns an opaque file system label from @var{str}, a 16853This procedure returns an opaque file system label from @var{str}, a
16873string: 16854string:
16874 16855
@@ -16879,7 +16860,7 @@ string:
16879 16860
16880File system labels are used to refer to file systems by label rather 16861File system labels are used to refer to file systems by label rather
16881than by device name. See above for examples. 16862than by device name. See above for examples.
16882@end deffn 16863@end defun
16883 16864
16884The @code{(gnu system file-systems)} exports the following useful 16865The @code{(gnu system file-systems)} exports the following useful
16885variables. 16866variables.
@@ -16930,7 +16911,7 @@ and unmount user-space FUSE file systems. This requires the
16930The @code{(gnu system uuid)} module provides tools to deal with file 16911The @code{(gnu system uuid)} module provides tools to deal with file
16931system ``unique identifiers'' (UUIDs). 16912system ``unique identifiers'' (UUIDs).
16932 16913
16933@deffn {Scheme Procedure} uuid @var{str} [@var{type}] 16914@defun uuid str [type]
16934Return an opaque UUID (unique identifier) object of the given @var{type} 16915Return an opaque UUID (unique identifier) object of the given @var{type}
16935(a symbol) by parsing @var{str} (a string): 16916(a symbol) by parsing @var{str} (a string):
16936 16917
@@ -16947,7 +16928,7 @@ Return an opaque UUID (unique identifier) object of the given @var{type}
16947 16928
16948UUIDs are another way to unambiguously refer to file systems in 16929UUIDs are another way to unambiguously refer to file systems in
16949operating system configuration. See the examples above. 16930operating system configuration. See the examples above.
16950@end deffn 16931@end defun
16951 16932
16952 16933
16953@node Btrfs file system 16934@node Btrfs file system
@@ -17610,14 +17591,13 @@ optional variant name, an optional keyboard model name, and a possibly empty
17610list of additional options. In most cases the layout name is all you care 17591list of additional options. In most cases the layout name is all you care
17611about. 17592about.
17612 17593
17613@deffn {Scheme Procedure} keyboard-layout @var{name} [@var{variant}] @ 17594@defun keyboard-layout name [variant] [#:model] [#:options '()]
17614 [#:model] [#:options '()]
17615Return a new keyboard layout with the given @var{name} and @var{variant}. 17595Return a new keyboard layout with the given @var{name} and @var{variant}.
17616 17596
17617@var{name} must be a string such as @code{"fr"}; @var{variant} must be a 17597@var{name} must be a string such as @code{"fr"}; @var{variant} must be a
17618string such as @code{"bepo"} or @code{"nodeadkeys"}. See the 17598string such as @code{"bepo"} or @code{"nodeadkeys"}. See the
17619@code{xkeyboard-config} package for valid options. 17599@code{xkeyboard-config} package for valid options.
17620@end deffn 17600@end defun
17621 17601
17622Here are a few examples: 17602Here are a few examples:
17623 17603
@@ -18009,7 +17989,7 @@ to add a special file is @i{via} the @code{extra-special-file} procedure
18009(see below). 17989(see below).
18010@end defvar 17990@end defvar
18011 17991
18012@deffn {Scheme Procedure} extra-special-file @var{file} @var{target} 17992@defun extra-special-file file target
18013Use @var{target} as the ``special file'' @var{file}. 17993Use @var{target} as the ``special file'' @var{file}.
18014 17994
18015For example, adding the following lines to the @code{services} field of 17995For example, adding the following lines to the @code{services} field of
@@ -18020,7 +18000,7 @@ symlink:
18020(extra-special-file "/usr/bin/env" 18000(extra-special-file "/usr/bin/env"
18021 (file-append coreutils "/bin/env")) 18001 (file-append coreutils "/bin/env"))
18022@end lisp 18002@end lisp
18023@end deffn 18003@end defun
18024 18004
18025@defvar host-name-service-type 18005@defvar host-name-service-type
18026Type of the service that sets the system host name, whose value 18006Type of the service that sets the system host name, whose value
@@ -22196,23 +22176,22 @@ default is @code{-nolisten tcp}.
22196@end table 22176@end table
22197@end deftp 22177@end deftp
22198 22178
22199@deffn {Scheme Procedure} set-xorg-configuration @var{config} @ 22179@defun set-xorg-configuration config [login-manager-service-type]
22200 [@var{login-manager-service-type}]
22201Tell the log-in manager (of type @var{login-manager-service-type}) to use 22180Tell the log-in manager (of type @var{login-manager-service-type}) to use
22202@var{config}, an @code{<xorg-configuration>} record. 22181@var{config}, an @code{<xorg-configuration>} record.
22203 22182
22204Since the Xorg configuration is embedded in the log-in manager's 22183Since the Xorg configuration is embedded in the log-in manager's
22205configuration---e.g., @code{gdm-configuration}---this procedure provides a 22184configuration---e.g., @code{gdm-configuration}---this procedure provides a
22206shorthand to set the Xorg configuration. 22185shorthand to set the Xorg configuration.
22207@end deffn 22186@end defun
22208 22187
22209@deffn {Scheme Procedure} xorg-start-command [@var{config}] 22188@defun xorg-start-command [config]
22210Return a @code{startx} script in which the modules, fonts, etc. specified 22189Return a @code{startx} script in which the modules, fonts, etc. specified
22211in @var{config}, are available. The result should be used in place of 22190in @var{config}, are available. The result should be used in place of
22212@code{startx}. 22191@code{startx}.
22213 22192
22214Usually the X server is started by a login manager. 22193Usually the X server is started by a login manager.
22215@end deffn 22194@end defun
22216 22195
22217 22196
22218@defvar screen-locker-service-type 22197@defvar screen-locker-service-type
@@ -23653,7 +23632,7 @@ a system which relies on @code{%desktop-services}, you may use
23653@end lisp 23632@end lisp
23654@end defvar 23633@end defvar
23655 23634
23656@deffn {Scheme Procedure} geoclue-application name [#:allowed? #t] [#:system? #f] [#:users '()] 23635@defun geoclue-application name [#:allowed? #t] [#:system? #f] [#:users '()]
23657Return a configuration allowing an application to access GeoClue 23636Return a configuration allowing an application to access GeoClue
23658location data. @var{name} is the Desktop ID of the application, without 23637location data. @var{name} is the Desktop ID of the application, without
23659the @code{.desktop} part. If @var{allowed?} is true, the application 23638the @code{.desktop} part. If @var{allowed?} is true, the application
@@ -23662,7 +23641,7 @@ will have access to location information by default. The boolean
23662or not. Finally @var{users} is a list of UIDs of all users for which 23641or not. Finally @var{users} is a list of UIDs of all users for which
23663this application is allowed location info access. An empty users list 23642this application is allowed location info access. An empty users list
23664means that all users are allowed. 23643means that all users are allowed.
23665@end deffn 23644@end defun
23666 23645
23667@defvar %standard-geoclue-applications 23646@defvar %standard-geoclue-applications
23668The standard list of well-known GeoClue application configurations, 23647The standard list of well-known GeoClue application configurations,
@@ -27624,7 +27603,7 @@ client is already being used. Otherwise, the
27624procedures provided by this module can be used to obtain a suitable hash 27603procedures provided by this module can be used to obtain a suitable hash
27625value. 27604value.
27626 27605
27627@deffn {Scheme Procedure} transmission-password-hash @var{password} @var{salt} 27606@defun transmission-password-hash password salt
27628Returns a string containing the result of hashing @var{password} 27607Returns a string containing the result of hashing @var{password}
27629together with @var{salt}, in the format recognized by Transmission 27608together with @var{salt}, in the format recognized by Transmission
27630clients for their @code{rpc-password} configuration setting. 27609clients for their @code{rpc-password} configuration setting.
@@ -27632,13 +27611,13 @@ clients for their @code{rpc-password} configuration setting.
27632@var{salt} must be an eight-character string. The 27611@var{salt} must be an eight-character string. The
27633@code{transmission-random-salt} procedure can be used to generate a 27612@code{transmission-random-salt} procedure can be used to generate a
27634suitable salt value at random. 27613suitable salt value at random.
27635@end deffn 27614@end defun
27636 27615
27637@deffn {Scheme Procedure} transmission-random-salt 27616@defun transmission-random-salt
27638Returns a string containing a random, eight-character salt value of the 27617Returns a string containing a random, eight-character salt value of the
27639type generated and used by Transmission clients, suitable for passing to 27618type generated and used by Transmission clients, suitable for passing to
27640the @code{transmission-password-hash} procedure. 27619the @code{transmission-password-hash} procedure.
27641@end deffn 27620@end defun
27642 27621
27643These procedures are accessible from within a Guile REPL started with 27622These procedures are accessible from within a Guile REPL started with
27644the @command{guix repl} command (@pxref{Invoking guix repl}). This is 27623the @command{guix repl} command (@pxref{Invoking guix repl}). This is
@@ -30535,13 +30514,11 @@ The time in seconds after which a process with no requests is killed.
30535@end deftp 30514@end deftp
30536 30515
30537 30516
30538@deffn {Scheme Procedure} nginx-php-location @ 30517@defun nginx-php-location [#:nginx-package nginx] @
30539 [#:nginx-package nginx] @ 30518 [socket (string-append "/var/run/php" @
30540 [socket (string-append "/var/run/php" @ 30519 (version-major (package-version php)) "-fpm.sock")]
30541 (version-major (package-version php)) @
30542 "-fpm.sock")]
30543A helper function to quickly add php to an @code{nginx-server-configuration}. 30520A helper function to quickly add php to an @code{nginx-server-configuration}.
30544@end deffn 30521@end defun
30545 30522
30546A simple services setup for nginx with php can look like this: 30523A simple services setup for nginx with php can look like this:
30547@lisp 30524@lisp
@@ -30564,7 +30541,7 @@ The cat avatar generator is a simple service to demonstrate the use of php-fpm
30564in @code{Nginx}. It is used to generate cat avatar from a seed, for instance 30541in @code{Nginx}. It is used to generate cat avatar from a seed, for instance
30565the hash of a user's email address. 30542the hash of a user's email address.
30566 30543
30567@deffn {Scheme Procedure} cat-avatar-generator-service @ 30544@defun cat-avatar-generator-service @
30568 [#:cache-dir "/var/cache/cat-avatar-generator"] @ 30545 [#:cache-dir "/var/cache/cat-avatar-generator"] @
30569 [#:package cat-avatar-generator] @ 30546 [#:package cat-avatar-generator] @
30570 [#:configuration (nginx-server-configuration)] 30547 [#:configuration (nginx-server-configuration)]
@@ -30572,7 +30549,7 @@ Returns an nginx-server-configuration that inherits @code{configuration}. It
30572extends the nginx configuration to add a server block that serves @code{package}, 30549extends the nginx configuration to add a server block that serves @code{package},
30573a version of cat-avatar-generator. During execution, cat-avatar-generator will 30550a version of cat-avatar-generator. During execution, cat-avatar-generator will
30574be able to use @code{cache-dir} as its cache directory. 30551be able to use @code{cache-dir} as its cache directory.
30575@end deffn 30552@end defun
30576 30553
30577A simple setup for cat-avatar-generator can look like this: 30554A simple setup for cat-avatar-generator can look like this:
30578@lisp 30555@lisp
@@ -34579,20 +34556,20 @@ The QEMU package to use.
34579@end table 34556@end table
34580@end deftp 34557@end deftp
34581 34558
34582@deffn {Scheme Procedure} lookup-qemu-platforms @var{platforms}@dots{} 34559@defun lookup-qemu-platforms platforms@dots{}
34583Return the list of QEMU platform objects corresponding to 34560Return the list of QEMU platform objects corresponding to
34584@var{platforms}@dots{}. @var{platforms} must be a list of strings 34561@var{platforms}@dots{}. @var{platforms} must be a list of strings
34585corresponding to platform names, such as @code{"arm"}, @code{"sparc"}, 34562corresponding to platform names, such as @code{"arm"}, @code{"sparc"},
34586@code{"mips64el"}, and so on. 34563@code{"mips64el"}, and so on.
34587@end deffn 34564@end defun
34588 34565
34589@deffn {Scheme Procedure} qemu-platform? @var{obj} 34566@defun qemu-platform? obj
34590Return true if @var{obj} is a platform object. 34567Return true if @var{obj} is a platform object.
34591@end deffn 34568@end defun
34592 34569
34593@deffn {Scheme Procedure} qemu-platform-name @var{platform} 34570@defun qemu-platform-name platform
34594Return the name of @var{platform}---a string such as @code{"arm"}. 34571Return the name of @var{platform}---a string such as @code{"arm"}.
34595@end deffn 34572@end defun
34596 34573
34597 34574
34598@subsubheading QEMU Guest Agent 34575@subsubheading QEMU Guest Agent
@@ -35088,27 +35065,27 @@ Alignment of the partition in sectors.
35088@end table 35065@end table
35089@end deftp 35066@end deftp
35090 35067
35091@deffn {Scheme Procedure} debootstrap-variant @var{name} @var{configuration} 35068@defun debootstrap-variant name configuration
35092This is a helper procedure that creates a @code{ganeti-os-variant} record. It 35069This is a helper procedure that creates a @code{ganeti-os-variant} record. It
35093takes two parameters: a name and a @code{debootstrap-configuration} object. 35070takes two parameters: a name and a @code{debootstrap-configuration} object.
35094@end deffn 35071@end defun
35095 35072
35096@deffn {Scheme Procedure} debootstrap-os @var{variants}@dots{} 35073@defun debootstrap-os variants@dots{}
35097This is a helper procedure that creates a @code{ganeti-os} record. It takes 35074This is a helper procedure that creates a @code{ganeti-os} record. It takes
35098a list of variants created with @code{debootstrap-variant}. 35075a list of variants created with @code{debootstrap-variant}.
35099@end deffn 35076@end defun
35100 35077
35101@deffn {Scheme Procedure} guix-variant @var{name} @var{configuration} 35078@defun guix-variant name configuration
35102This is a helper procedure that creates a @code{ganeti-os-variant} record for 35079This is a helper procedure that creates a @code{ganeti-os-variant} record for
35103use with the Guix OS provider. It takes a name and a G-expression that returns 35080use with the Guix OS provider. It takes a name and a G-expression that returns
35104a ``file-like'' (@pxref{G-Expressions, file-like objects}) object containing a 35081a ``file-like'' (@pxref{G-Expressions, file-like objects}) object containing a
35105Guix System configuration. 35082Guix System configuration.
35106@end deffn 35083@end defun
35107 35084
35108@deffn {Scheme Procedure} guix-os @var{variants}@dots{} 35085@defun guix-os variants@dots{}
35109This is a helper procedure that creates a @code{ganeti-os} record. It 35086This is a helper procedure that creates a @code{ganeti-os} record. It
35110takes a list of variants produced by @code{guix-variant}. 35087takes a list of variants produced by @code{guix-variant}.
35111@end deffn 35088@end defun
35112 35089
35113@defvar %default-debootstrap-variants 35090@defvar %default-debootstrap-variants
35114This is a convenience variable to make the debootstrap provider work 35091This is a convenience variable to make the debootstrap provider work
@@ -35606,7 +35583,7 @@ create an @code{nginx-location-configuration} from a
35606@code{git-http-configuration} and then add that location to a web 35583@code{git-http-configuration} and then add that location to a web
35607server. 35584server.
35608 35585
35609@deffn {Scheme Procedure} git-http-nginx-location-configuration @ 35586@defun git-http-nginx-location-configuration @
35610 [config=(git-http-configuration)] 35587 [config=(git-http-configuration)]
35611Compute an @code{nginx-location-configuration} that corresponds to the 35588Compute an @code{nginx-location-configuration} that corresponds to the
35612given Git http configuration. An example nginx service definition to 35589given Git http configuration. An example nginx service definition to
@@ -35635,7 +35612,7 @@ certificate. @xref{Certificate Services}. The default @code{certbot}
35635service will redirect all HTTP traffic on @code{git.my-host.org} to 35612service will redirect all HTTP traffic on @code{git.my-host.org} to
35636HTTPS@. You will also need to add an @code{fcgiwrap} proxy to your 35613HTTPS@. You will also need to add an @code{fcgiwrap} proxy to your
35637system services. @xref{Web Services}. 35614system services. @xref{Web Services}.
35638@end deffn 35615@end defun
35639 35616
35640@subsubheading Cgit Service 35617@subsubheading Cgit Service
35641 35618
@@ -38252,7 +38229,7 @@ is an example of a basic, explicit configuration:
38252@end lisp 38229@end lisp
38253@end defvar 38230@end defvar
38254 38231
38255@deffn {Scheme Procedure} fail2ban-jail-service @var{svc-type} @var{jail} 38232@defun fail2ban-jail-service svc-type jail
38256Extend @var{svc-type}, a @code{<service-type>} object with @var{jail}, a 38233Extend @var{svc-type}, a @code{<service-type>} object with @var{jail}, a
38257@code{fail2ban-jail-configuration} object. 38234@code{fail2ban-jail-configuration} object.
38258 38235
@@ -38272,7 +38249,7 @@ For example:
38272 (enabled? #t))) 38249 (enabled? #t)))
38273 (openssh-configuration ...)))) 38250 (openssh-configuration ...))))
38274@end lisp 38251@end lisp
38275@end deffn 38252@end defun
38276 38253
38277Below is the reference for the different @code{jail-service-type} 38254Below is the reference for the different @code{jail-service-type}
38278configuration records. 38255configuration records.
@@ -38879,7 +38856,7 @@ here is how to use it and customize it further.
38879 38856
38880@cindex initrd 38857@cindex initrd
38881@cindex initial RAM disk 38858@cindex initial RAM disk
38882@deffn {Scheme Procedure} raw-initrd @var{file-systems} @ 38859@defun raw-initrd file-systems @
38883 [#:linux-modules '()] [#:pre-mount #t] [#:mapped-devices '()] @ 38860 [#:linux-modules '()] [#:pre-mount #t] [#:mapped-devices '()] @
38884 [#:keyboard-layout #f] [#:helper-packages '()] @ 38861 [#:keyboard-layout #f] [#:helper-packages '()] @
38885 [#:qemu-networking? #f] [#:volatile-root? #f] 38862 [#:qemu-networking? #f] [#:volatile-root? #f]
@@ -38908,9 +38885,9 @@ initrd can be used as a QEMU guest with para-virtualized I/O drivers.
38908 38885
38909When @var{volatile-root?} is true, the root file system is writable but any changes 38886When @var{volatile-root?} is true, the root file system is writable but any changes
38910to it are lost. 38887to it are lost.
38911@end deffn 38888@end defun
38912 38889
38913@deffn {Scheme Procedure} base-initrd @var{file-systems} @ 38890@defun base-initrd file-systems @
38914 [#:mapped-devices '()] [#:keyboard-layout #f] @ 38891 [#:mapped-devices '()] [#:keyboard-layout #f] @
38915 [#:qemu-networking? #f] [#:volatile-root? #f] @ 38892 [#:qemu-networking? #f] [#:volatile-root? #f] @
38916 [#:linux-modules '()] 38893 [#:linux-modules '()]
@@ -38932,7 +38909,7 @@ The initrd is automatically populated with all the kernel modules necessary
38932for @var{file-systems} and for the given options. Additional kernel 38909for @var{file-systems} and for the given options. Additional kernel
38933modules can be listed in @var{linux-modules}. They will be added to the initrd, and 38910modules can be listed in @var{linux-modules}. They will be added to the initrd, and
38934loaded at boot time in the order in which they appear. 38911loaded at boot time in the order in which they appear.
38935@end deffn 38912@end defun
38936 38913
38937Needless to say, the initrds we produce and use embed a 38914Needless to say, the initrds we produce and use embed a
38938statically-linked Guile, and the initialization program is a Guile 38915statically-linked Guile, and the initialization program is a Guile
@@ -38940,13 +38917,13 @@ program. That gives a lot of flexibility. The
38940@code{expression->initrd} procedure builds such an initrd, given the 38917@code{expression->initrd} procedure builds such an initrd, given the
38941program to run in that initrd. 38918program to run in that initrd.
38942 38919
38943@deffn {Scheme Procedure} expression->initrd @var{exp} @ 38920@defun expression->initrd exp @
38944 [#:guile %guile-static-stripped] [#:name "guile-initrd"] 38921 [#:guile %guile-static-stripped] [#:name "guile-initrd"]
38945Return as a file-like object a Linux initrd (a gzipped cpio archive) 38922Return as a file-like object a Linux initrd (a gzipped cpio archive)
38946containing @var{guile} and that evaluates @var{exp}, a G-expression, 38923containing @var{guile} and that evaluates @var{exp}, a G-expression,
38947upon booting. All the derivations referenced by @var{exp} are 38924upon booting. All the derivations referenced by @var{exp} are
38948automatically copied to the initrd. 38925automatically copied to the initrd.
38949@end deffn 38926@end defun
38950 38927
38951@node Bootloader Configuration 38928@node Bootloader Configuration
38952@section Bootloader Configuration 38929@section Bootloader Configuration
@@ -39292,14 +39269,14 @@ The GRUB @code{gfxmode} to set (a list of screen resolution strings,
39292@end table 39269@end table
39293@end deftp 39270@end deftp
39294 39271
39295@deffn {Scheme Procedure} grub-theme 39272@defun grub-theme
39296Return the default GRUB theme used by the operating system if no 39273Return the default GRUB theme used by the operating system if no
39297@code{theme} field is specified in @code{bootloader-configuration} 39274@code{theme} field is specified in @code{bootloader-configuration}
39298record. 39275record.
39299 39276
39300It comes with a fancy background image displaying the GNU and Guix 39277It comes with a fancy background image displaying the GNU and Guix
39301logos. 39278logos.
39302@end deffn 39279@end defun
39303 39280
39304For example, to override the default resolution, you may use something 39281For example, to override the default resolution, you may use something
39305like 39282like
@@ -40551,7 +40528,7 @@ Services}). This section provides a reference on how to manipulate
40551services and service types. This interface is provided by the 40528services and service types. This interface is provided by the
40552@code{(gnu services)} module. 40529@code{(gnu services)} module.
40553 40530
40554@deffn {Scheme Procedure} service @var{type} [@var{value}] 40531@defun service type [value]
40555Return a new service of @var{type}, a @code{<service-type>} object (see 40532Return a new service of @var{type}, a @code{<service-type>} object (see
40556below). @var{value} can be any object; it represents the parameters of 40533below). @var{value} can be any object; it represents the parameters of
40557this particular service instance. 40534this particular service instance.
@@ -40576,20 +40553,20 @@ is equivalent to this:
40576 40553
40577In both cases the result is an instance of @code{openssh-service-type} 40554In both cases the result is an instance of @code{openssh-service-type}
40578with the default configuration. 40555with the default configuration.
40579@end deffn 40556@end defun
40580 40557
40581@deffn {Scheme Procedure} service? @var{obj} 40558@defun service? obj
40582Return true if @var{obj} is a service. 40559Return true if @var{obj} is a service.
40583@end deffn 40560@end defun
40584 40561
40585@deffn {Scheme Procedure} service-kind @var{service} 40562@defun service-kind service
40586Return the type of @var{service}---i.e., a @code{<service-type>} object. 40563Return the type of @var{service}---i.e., a @code{<service-type>} object.
40587@end deffn 40564@end defun
40588 40565
40589@deffn {Scheme Procedure} service-value @var{service} 40566@defun service-value service
40590Return the value associated with @var{service}. It represents its 40567Return the value associated with @var{service}. It represents its
40591parameters. 40568parameters.
40592@end deffn 40569@end defun
40593 40570
40594Here is an example of how a service is created and manipulated: 40571Here is an example of how a service is created and manipulated:
40595 40572
@@ -40710,24 +40687,23 @@ The returned service in this case has the default value specified by
40710@xref{Service Types and Services}, for examples. 40687@xref{Service Types and Services}, for examples.
40711@end deftp 40688@end deftp
40712 40689
40713@deffn {Scheme Procedure} service-extension @var{target-type} @ 40690@defun service-extension target-type compute
40714 @var{compute}
40715Return a new extension for services of type @var{target-type}. 40691Return a new extension for services of type @var{target-type}.
40716@var{compute} must be a one-argument procedure: @code{fold-services} 40692@var{compute} must be a one-argument procedure: @code{fold-services}
40717calls it, passing it the value associated with the service that provides 40693calls it, passing it the value associated with the service that provides
40718the extension; it must return a valid value for the target service. 40694the extension; it must return a valid value for the target service.
40719@end deffn 40695@end defun
40720 40696
40721@deffn {Scheme Procedure} service-extension? @var{obj} 40697@defun service-extension? obj
40722Return true if @var{obj} is a service extension. 40698Return true if @var{obj} is a service extension.
40723@end deffn 40699@end defun
40724 40700
40725Occasionally, you might want to simply extend an existing service. This 40701Occasionally, you might want to simply extend an existing service. This
40726involves creating a new service type and specifying the extension of 40702involves creating a new service type and specifying the extension of
40727interest, which can be verbose; the @code{simple-service} procedure 40703interest, which can be verbose; the @code{simple-service} procedure
40728provides a shorthand for this. 40704provides a shorthand for this.
40729 40705
40730@deffn {Scheme Procedure} simple-service @var{name} @var{target} @var{value} 40706@defun simple-service name target value
40731Return a service that extends @var{target} with @var{value}. This works 40707Return a service that extends @var{target} with @var{value}. This works
40732by creating a singleton service type @var{name}, of which the returned 40708by creating a singleton service type @var{name}, of which the returned
40733service is an instance. 40709service is an instance.
@@ -40739,7 +40715,7 @@ an additional job:
40739(simple-service 'my-mcron-job mcron-service-type 40715(simple-service 'my-mcron-job mcron-service-type
40740 #~(job '(next-hour (3)) "guix gc -F 2G")) 40716 #~(job '(next-hour (3)) "guix gc -F 2G"))
40741@end lisp 40717@end lisp
40742@end deffn 40718@end defun
40743 40719
40744At the core of the service abstraction lies the @code{fold-services} 40720At the core of the service abstraction lies the @code{fold-services}
40745procedure, which is responsible for ``compiling'' a list of services 40721procedure, which is responsible for ``compiling'' a list of services
@@ -40749,11 +40725,10 @@ command (@pxref{Invoking guix system}). In essence, it propagates
40749service extensions down the service graph, updating each node parameters 40725service extensions down the service graph, updating each node parameters
40750on the way, until it reaches the root node. 40726on the way, until it reaches the root node.
40751 40727
40752@deffn {Scheme Procedure} fold-services @var{services} @ 40728@defun fold-services services [#:target-type system-service-type]
40753 [#:target-type @var{system-service-type}]
40754Fold @var{services} by propagating their extensions down to the root of 40729Fold @var{services} by propagating their extensions down to the root of
40755type @var{target-type}; return the root service adjusted accordingly. 40730type @var{target-type}; return the root service adjusted accordingly.
40756@end deffn 40731@end defun
40757 40732
40758Lastly, the @code{(gnu services)} module also defines several essential 40733Lastly, the @code{(gnu services)} module also defines several essential
40759service types, some of which are listed below. 40734service types, some of which are listed below.
@@ -41036,7 +41011,7 @@ info on actions.
41036@end deftp 41011@end deftp
41037 41012
41038@cindex configuration file, of Shepherd services 41013@cindex configuration file, of Shepherd services
41039@deffn {Scheme Procedure} shepherd-configuration-action 41014@defun shepherd-configuration-action
41040Return a @code{configuration} action to display @var{file}, which should 41015Return a @code{configuration} action to display @var{file}, which should
41041be the name of the service's configuration file. 41016be the name of the service's configuration file.
41042 41017
@@ -41066,7 +41041,7 @@ cat $(herd configuration tor)
41066@end example 41041@end example
41067 41042
41068This can come in as a handy debugging tool! 41043This can come in as a handy debugging tool!
41069@end deffn 41044@end defun
41070 41045
41071@defvar shepherd-root-service-type 41046@defvar shepherd-root-service-type
41072The service type for the Shepherd ``root service''---i.e., PID@tie{}1. 41047The service type for the Shepherd ``root service''---i.e., PID@tie{}1.
@@ -41297,30 +41272,28 @@ whether its value is set or not.
41297@end lisp 41272@end lisp
41298@end deffn 41273@end deffn
41299 41274
41300@deffn (Scheme Procedure) maybe-value-set? @var{value} 41275@defun maybe-value-set? value
41301Predicate to check whether a user explicitly specified the value of a 41276Predicate to check whether a user explicitly specified the value of a
41302maybe field. 41277maybe field.
41303@end deffn 41278@end defun
41304 41279
41305@deffn {Scheme Procedure} serialize-configuration @var{configuration} @ 41280@defun serialize-configuration configuration fields
41306@var{fields}
41307Return a G-expression that contains the values corresponding to the 41281Return a G-expression that contains the values corresponding to the
41308@var{fields} of @var{configuration}, a record that has been generated by 41282@var{fields} of @var{configuration}, a record that has been generated by
41309@code{define-configuration}. The G-expression can then be serialized to 41283@code{define-configuration}. The G-expression can then be serialized to
41310disk by using something like @code{mixed-text-file}. 41284disk by using something like @code{mixed-text-file}.
41311@end deffn 41285@end defun
41312 41286
41313@deffn {Scheme Procedure} empty-serializer @var{field-name} @var{value} 41287@defun empty-serializer field-name value
41314A serializer that just returns an empty string. The 41288A serializer that just returns an empty string. The
41315@code{serialize-package} procedure is an alias for this. 41289@code{serialize-package} procedure is an alias for this.
41316@end deffn 41290@end defun
41317 41291
41318Once you have defined a configuration record, you will most likely also 41292Once you have defined a configuration record, you will most likely also
41319want to document it so that other people know to use it. To help with 41293want to document it so that other people know to use it. To help with
41320that, there are two procedures, both of which are documented below. 41294that, there are two procedures, both of which are documented below.
41321 41295
41322@deffn {Scheme Procedure} generate-documentation @var{documentation} @ 41296@defun generate-documentation documentation documentation-name
41323@var{documentation-name}
41324Generate a Texinfo fragment from the docstrings in @var{documentation}, 41297Generate a Texinfo fragment from the docstrings in @var{documentation},
41325a list of @code{(@var{label} @var{fields} @var{sub-documentation} ...)}. 41298a list of @code{(@var{label} @var{fields} @var{sub-documentation} ...)}.
41326@var{label} should be a symbol and should be the name of the 41299@var{label} should be a symbol and should be the name of the
@@ -41350,16 +41323,15 @@ record in one of its @code{rcfile} field, therefore documentation for
41350@var{documentation-name} should be a symbol and should be the name of 41323@var{documentation-name} should be a symbol and should be the name of
41351the configuration record. 41324the configuration record.
41352 41325
41353@end deffn 41326@end defun
41354 41327
41355@deffn {Scheme Procedure} configuration->documentation 41328@defun configuration->documentation configuration-symbol
41356@var{configuration-symbol}
41357Take @var{configuration-symbol}, the symbol corresponding to the name 41329Take @var{configuration-symbol}, the symbol corresponding to the name
41358used when defining a configuration record with 41330used when defining a configuration record with
41359@code{define-configuration}, and print the Texinfo documentation of its 41331@code{define-configuration}, and print the Texinfo documentation of its
41360fields. This is useful if there aren’t any nested configuration records 41332fields. This is useful if there aren’t any nested configuration records
41361since it only prints the documentation for the top-level fields. 41333since it only prints the documentation for the top-level fields.
41362@end deffn 41334@end defun
41363 41335
41364As of right now, there is no automated way to generate documentation for 41336As of right now, there is no automated way to generate documentation for
41365configuration records and put them in the manual. Instead, every 41337configuration records and put them in the manual. Instead, every