diff options
| author | Bruno Victal <mirai@makinata.eu> | 2023-03-08 01:22:08 +0000 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2023-03-13 15:08:35 +0100 |
| commit | 3c40dfe2851dd4ef48d2711f9f3531c06afbe1f2 (patch) | |
| tree | e13c152b7b3262a35c9eb8232da2877ab5c6c7be /doc | |
| parent | dbfaca42a0377c65b96e11ef292275cb0113108f (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.texi | 504 |
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. | |||
| 4958 | The @code{(guix inferior)} module provides the following procedures to open an | 4958 | The @code{(guix inferior)} module provides the following procedures to open an |
| 4959 | inferior: | 4959 | inferior: |
| 4960 | 4960 | ||
| 4961 | @deffn {Scheme Procedure} inferior-for-channels @var{channels} @ | 4961 | @defun inferior-for-channels channels [#:cache-directory] [#:ttl] |
| 4962 | [#:cache-directory] [#:ttl] | ||
| 4963 | Return an inferior for @var{channels}, a list of channels. Use the cache at | 4962 | Return 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. |
| 4965 | This procedure opens a new connection to the build daemon. | 4964 | This procedure opens a new connection to the build daemon. |
| 4966 | 4965 | ||
| 4967 | As a side effect, this procedure may build or substitute binaries for | 4966 | As 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"] | ||
| 4973 | Open the inferior Guix in @var{directory}, running | 4971 | Open 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 |
| 4975 | the inferior could not be launched. | 4973 | the inferior could not be launched. |
| 4976 | @end deffn | 4974 | @end defun |
| 4977 | 4975 | ||
| 4978 | @cindex inferior packages | 4976 | @cindex inferior packages |
| 4979 | The procedures listed below allow you to obtain and manipulate inferior | 4977 | The procedures listed below allow you to obtain and manipulate inferior |
| 4980 | packages. | 4978 | packages. |
| 4981 | 4979 | ||
| 4982 | @deffn {Scheme Procedure} inferior-packages @var{inferior} | 4980 | @defun inferior-packages inferior |
| 4983 | Return the list of packages known to @var{inferior}. | 4981 | Return 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}] | ||
| 4988 | Return the sorted list of inferior packages matching @var{name} in | 4985 | Return 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, |
| 4990 | return only packages with a version number prefixed by @var{version}. | 4987 | return 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 |
| 4994 | Return true if @var{obj} is an inferior package. | 4991 | Return 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 |
| 5010 | These procedures are the counterpart of package record accessors | 5007 | These 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 |
| 5013 | these procedures. | 5010 | these procedures. |
| 5014 | @end deffn | 5011 | @end defun |
| 5015 | 5012 | ||
| 5016 | Inferior packages can be used transparently like any other package or | 5013 | Inferior packages can be used transparently like any other package or |
| 5017 | file-like object in G-expressions (@pxref{G-Expressions}). They are also | 5014 | file-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}. | |||
| 7575 | The build actions it prescribes may then be realized by using the | 7572 | The 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] |
| 7579 | Return the @code{<derivation>} object of @var{package} for @var{system} | 7576 | Return 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} |
| 7585 | must be a connection to the daemon, which operates on the store | 7582 | must 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 |
| 7591 | Similarly, it is possible to compute a derivation that cross-builds a | 7588 | Similarly, it is possible to compute a derivation that cross-builds a |
| 7592 | package for some other system: | 7589 | package 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}] | ||
| 7596 | Return the @code{<derivation>} object of @var{package} cross-built from | 7592 | Return 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 |
| 7600 | and operating system, such as @code{"aarch64-linux-gnu"} | 7596 | and 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 | ||
| 7604 | Once you have package definitions, you can easily define @emph{variants} | 7600 | Once you have package definitions, you can easily define @emph{variants} |
| 7605 | of those packages. @xref{Defining Package Variants}, for more on that. | 7601 | of 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. | |||
| 7810 | The following helper procedures are provided to help deal with package | 7806 | The following helper procedures are provided to help deal with package |
| 7811 | inputs. | 7807 | inputs. |
| 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 |
| 7817 | Look up @var{name} among @var{package}'s inputs (or native, propagated, | 7813 | Look up @var{name} among @var{package}'s inputs (or native, propagated, |
| 7818 | or direct inputs). Return it if found, @code{#f} otherwise. | 7814 | or direct inputs). Return it if found, @code{#f} otherwise. |
| 7819 | 7815 | ||
| @@ -7829,7 +7825,7 @@ use it: | |||
| 7829 | 7825 | ||
| 7830 | In this example we obtain the @code{gmp} package that is among the | 7826 | In this example we obtain the @code{gmp} package that is among the |
| 7831 | direct inputs of @code{coreutils}. | 7827 | direct 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 | |||
| 7838 | package is compiled. This is what the @code{package-development-inputs} | 7834 | package is compiled. This is what the @code{package-development-inputs} |
| 7839 | procedure returns. | 7835 | procedure 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] | ||
| 7843 | Return the list of inputs required by @var{package} for development | 7838 | Return the list of inputs required by @var{package} for development |
| 7844 | purposes on @var{system}. When @var{target} is true, return the inputs | 7839 | purposes on @var{system}. When @var{target} is true, return the inputs |
| 7845 | needed to cross-compile @var{package} from @var{system} to | 7840 | needed to cross-compile @var{package} from @var{system} to |
| @@ -7870,7 +7865,7 @@ because @code{hello} has zero explicit dependencies. Conversely, | |||
| 7870 | gzip, GCC, libc, Bash, and more. To visualize it, @command{guix graph | 7865 | gzip, GCC, libc, Bash, and more. To visualize it, @command{guix graph |
| 7871 | hello} would show you explicit inputs, whereas @command{guix graph -t | 7866 | hello} would show you explicit inputs, whereas @command{guix graph -t |
| 7872 | bag hello} would include implicit inputs (@pxref{Invoking guix graph}). | 7867 | bag hello} would include implicit inputs (@pxref{Invoking guix graph}). |
| 7873 | @end deffn | 7868 | @end defun |
| 7874 | 7869 | ||
| 7875 | Because packages are regular Scheme objects that capture a complete | 7870 | Because packages are regular Scheme objects that capture a complete |
| 7876 | dependency graph and associated build procedures, it is often useful to | 7871 | dependency 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 | |||
| 7878 | thereof according to some parameters. Below are a few examples. | 7873 | thereof 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 |
| 7882 | Return a variant of @var{package} that uses @var{toolchain} instead of | 7877 | Return a variant of @var{package} that uses @var{toolchain} instead of |
| 7883 | the default GNU C/C++ toolchain. @var{toolchain} must be a list of | 7878 | the default GNU C/C++ toolchain. @var{toolchain} must be a list of |
| 7884 | inputs (label/package tuples) providing equivalent functionality, such | 7879 | inputs (label/package tuples) providing equivalent functionality, such |
| @@ -7899,7 +7894,7 @@ fields and is instead pulled in by the build system. Consequently, this | |||
| 7899 | procedure works by changing the build system of @var{package} so that it | 7894 | procedure works by changing the build system of @var{package} so that it |
| 7900 | pulls in @var{toolchain} instead of the defaults. @ref{Build Systems}, | 7895 | pulls in @var{toolchain} instead of the defaults. @ref{Build Systems}, |
| 7901 | for more on build systems. | 7896 | for 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 | |||
| 8016 | download)} module provides the most common method, @code{url-fetch}, | 8011 | download)} module provides the most common method, @code{url-fetch}, |
| 8017 | described below. | 8012 | described 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] | ||
| 8021 | Return a fixed-output derivation that fetches data from @var{url} (a | 8015 | Return a fixed-output derivation that fetches data from @var{url} (a |
| 8022 | string, or a list of strings denoting alternate URLs), which is expected | 8016 | string, or a list of strings denoting alternate URLs), which is expected |
| 8023 | to have hash @var{hash} of type @var{hash-algo} (a symbol). By default, | 8017 | to 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 | ||
| 8031 | Alternatively, when URL starts with @code{file://}, return the | 8025 | Alternatively, when URL starts with @code{file://}, return the |
| 8032 | corresponding file name in the store. | 8026 | corresponding file name in the store. |
| 8033 | @end deffn | 8027 | @end defun |
| 8034 | 8028 | ||
| 8035 | Likewise, the @code{(guix git-download)} module defines the | 8029 | Likewise, 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 |
| 8037 | control repository, and the @code{git-reference} data type to describe | 8031 | control repository, and the @code{git-reference} data type to describe |
| 8038 | the repository and revision to fetch. | 8032 | the 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 |
| 8041 | Return a fixed-output derivation that fetches @var{ref}, a | 8035 | Return 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 |
| 8043 | hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as | 8037 | hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as |
| 8044 | the file name, or a generic name if @code{#f}. | 8038 | the 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 |
| 8048 | This data type represents a Git reference for @code{git-fetch} to | 8042 | This 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 | |||
| 8085 | the @code{hg-fetch} origin method and @code{hg-reference} data type for | 8079 | the @code{hg-fetch} origin method and @code{hg-reference} data type for |
| 8086 | support of the Mercurial version control system. | 8080 | support 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] | ||
| 8090 | Return a fixed-output derivation that fetches @var{ref}, a | 8083 | Return 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 |
| 8092 | hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as | 8085 | hash @var{hash} of type @var{hash-algo} (a symbol). Use @var{name} as |
| 8093 | the file name, or a generic name if @code{#false}. | 8086 | the 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 | |||
| 8242 | that directly maps to the more sophisticated package transformation | 8235 | that directly maps to the more sophisticated package transformation |
| 8243 | options (@pxref{Package Transformation Options}): | 8236 | options (@pxref{Package Transformation Options}): |
| 8244 | 8237 | ||
| 8245 | @deffn {Scheme Procedure} options->transformation @var{opts} | 8238 | @defun options->transformation opts |
| 8246 | Return a procedure that, when passed an object to build (package, | 8239 | Return a procedure that, when passed an object to build (package, |
| 8247 | derivation, etc.), applies the transformations specified by @var{opts} and returns | 8240 | derivation, etc.), applies the transformations specified by @var{opts} and returns |
| 8248 | the resulting objects. @var{opts} must be a list of symbol/string pairs such as: | 8241 | the 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 | ||
| 8255 | Each symbol names a transformation and the corresponding string is an argument | 8248 | Each symbol names a transformation and the corresponding string is an argument |
| 8256 | to that transformation. | 8249 | to that transformation. |
| 8257 | @end deffn | 8250 | @end defun |
| 8258 | 8251 | ||
| 8259 | For instance, a manifest equivalent to this command: | 8252 | For instance, a manifest equivalent to this command: |
| 8260 | 8253 | ||
| @@ -8293,8 +8286,7 @@ Dependency graph rewriting, for the purposes of swapping packages in the | |||
| 8293 | graph, is what the @code{package-input-rewriting} procedure in | 8286 | graph, 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] | ||
| 8298 | Return a procedure that, when passed a package, replaces its direct and | 8290 | Return a procedure that, when passed a package, replaces its direct and |
| 8299 | indirect dependencies, including implicit inputs when @var{deep?} is | 8291 | indirect dependencies, including implicit inputs when @var{deep?} is |
| 8300 | true, according to @var{replacements}. @var{replacements} is a list of | 8292 | true, according to @var{replacements}. @var{replacements} is a list of |
| @@ -8303,7 +8295,7 @@ and the second one is the replacement. | |||
| 8303 | 8295 | ||
| 8304 | Optionally, @var{rewrite-name} is a one-argument procedure that takes | 8296 | Optionally, @var{rewrite-name} is a one-argument procedure that takes |
| 8305 | the name of a package and returns its new name after rewrite. | 8297 | the name of a package and returns its new name after rewrite. |
| 8306 | @end deffn | 8298 | @end defun |
| 8307 | 8299 | ||
| 8308 | @noindent | 8300 | @noindent |
| 8309 | Consider this example: | 8301 | Consider 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 |
| 8357 | graph. | 8349 | graph. |
| 8358 | 8350 | ||
| 8359 | @deffn {Scheme Procedure} package-mapping @var{proc} [@var{cut?}] [#:deep? #f] | 8351 | @defun package-mapping proc [cut?] [#:deep? #f] |
| 8360 | Return a procedure that, given a package, applies @var{proc} to all the packages | 8352 | Return a procedure that, given a package, applies @var{proc} to all the packages |
| 8361 | depended on and returns the resulting package. The procedure stops recursion | 8353 | depended on and returns the resulting package. The procedure stops recursion |
| 8362 | when @var{cut?} returns true for a given package. When @var{deep?} is true, @var{proc} is | 8354 | when @var{cut?} returns true for a given package. When @var{deep?} is true, @var{proc} is |
| 8363 | applied to implicit inputs as well. | 8355 | applied 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 |
| 8570 | Concatenate the manifests listed in @var{lst} and return the resulting | 8562 | Concatenate the manifests listed in @var{lst} and return the resulting |
| 8571 | manifest. | 8563 | manifest. |
| 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] | ||
| 8578 | Return a manifest entry for the @var{output} of package @var{package}, | 8569 | Return a manifest entry for the @var{output} of package @var{package}, |
| 8579 | where @var{output} defaults to @code{"out"}, and with the given | 8570 | where @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 |
| 8598 | Return a list of manifest entries, one for each item listed in | 8589 | Return 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 |
| 8600 | objects or package/string tuples denoting a specific output of a | 8591 | objects 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] | ||
| 8616 | Return a manifest for the @dfn{development inputs} of @var{package} for | 8606 | Return 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}. |
| 8618 | Development inputs include both explicit and implicit inputs of | 8608 | Development 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 |
| 8641 | couple of additional development tools---these are the dependencies | 8631 | couple 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 | |||
| 8648 | to build manifests. In particular, it lets you look up packages by | 8638 | to build manifests. In particular, it lets you look up packages by |
| 8649 | name---see below. | 8639 | name---see below. |
| 8650 | 8640 | ||
| 8651 | @deffn {Scheme Procedure} specifications->manifest @var{specs} | 8641 | @defun specifications->manifest specs |
| 8652 | Given @var{specs}, a list of specifications such as @code{"emacs@@25.2"} | 8642 | Given @var{specs}, a list of specifications such as @code{"emacs@@25.2"} |
| 8653 | or @code{"guile:debug"}, return a manifest. Specs have the format that | 8643 | or @code{"guile:debug"}, return a manifest. Specs have the format that |
| 8654 | command-line tools such as @command{guix install} and @command{guix | 8644 | command-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 | |||
| 8665 | the right set of modules, and referring to the right variables. | 8655 | the right set of modules, and referring to the right variables. |
| 8666 | Instead, we directly refer to packages in the same way as on the command | 8656 | Instead, we directly refer to packages in the same way as on the command |
| 8667 | line, which can often be more convenient. | 8657 | line, 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 | ||
| 10118 | This section documents procedures that deal with store file names. | 10108 | This section documents procedures that deal with store file names. |
| 10119 | 10109 | ||
| 10120 | @deffn {Scheme Procedure} %store-directory | 10110 | @defun %store-directory |
| 10121 | Return the directory name of the store. | 10111 | Return 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 |
| 10125 | Return true if @var{file} is in the store. | 10115 | Return 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 |
| 10129 | Strip the @file{/gnu/store} and hash from @var{file}, a store file name. | 10119 | Strip the @file{/gnu/store} and hash from @var{file}, a store file name. |
| 10130 | The result is typically a @code{"@var{package}-@var{version}"} string. | 10120 | The 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 |
| 10134 | Given @var{name}, a package name like @code{"foo-0.9.1b"}, return two | 10124 | Given @var{name}, a package name like @code{"foo-0.9.1b"}, return two |
| 10135 | values: @code{"foo"} and @code{"0.9.1b"}. When the version part is | 10125 | values: @code{"foo"} and @code{"0.9.1b"}. When the version part is |
| 10136 | unavailable, @var{name} and @code{#f} are returned. The first hyphen | 10126 | unavailable, @var{name} and @code{#f} are returned. The first hyphen |
| 10137 | followed by a digit is considered to introduce the version part. | 10127 | followed 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 | ||
| 10142 | The procedures below deal with files and file types. | 10132 | The procedures below deal with files and file types. |
| 10143 | 10133 | ||
| 10144 | @deffn {Scheme Procedure} directory-exists? @var{dir} | 10134 | @defun directory-exists? dir |
| 10145 | Return @code{#t} if @var{dir} exists and is a directory. | 10135 | Return @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 |
| 10149 | Return @code{#t} if @var{file} exists and is executable. | 10139 | Return @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 |
| 10153 | Return @code{#t} if @var{file} is a symbolic link (aka. a ``symlink''). | 10143 | Return @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 |
| 10159 | Return @code{#t} if @var{file} is, respectively, an ELF file, an | 10149 | Return @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] |
| 10164 | If @var{file} is a gzip file, reset its embedded timestamp (as with | 10154 | If @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}. |
| 10166 | When @var{keep-mtime?} is true, preserve @var{file}'s modification time. | 10156 | When @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 | |||
| 10185 | exception. | 10175 | exception. |
| 10186 | @end deffn | 10176 | @end deffn |
| 10187 | 10177 | ||
| 10188 | @deffn {Scheme Procedure} mkdir-p @var{dir} | 10178 | @defun mkdir-p dir |
| 10189 | Create directory @var{dir} and all its ancestors. | 10179 | Create 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 |
| 10193 | Create @var{directory} if it does not exist and copy @var{file} in there | 10183 | Create @var{directory} if it does not exist and copy @var{file} in there |
| 10194 | under the same name. | 10184 | under 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 |
| 10198 | Make @var{file} writable for its owner. | 10188 | Make @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] |
| 10204 | Copy @var{source} directory to @var{destination}. Follow symlinks if | 10194 | Copy @var{source} directory to @var{destination}. Follow symlinks if |
| @@ -10207,14 +10197,13 @@ Copy @var{source} directory to @var{destination}. Follow symlinks if | |||
| 10207 | keep the modification time of the files in @var{source} on those of | 10197 | keep 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 |
| 10209 | permissions. Write verbose output to the @var{log} port. | 10199 | permissions. 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] | ||
| 10214 | Delete @var{dir} recursively, like @command{rm -rf}, without following | 10203 | Delete @var{dir} recursively, like @command{rm -rf}, without following |
| 10215 | symlinks. Don't follow mount points either, unless @var{follow-mounts?} | 10204 | symlinks. Don't follow mount points either, unless @var{follow-mounts?} |
| 10216 | is true. Report but ignore errors. | 10205 | is 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 |
| 10251 | This section documents procedures to search and filter files. | 10240 | This 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 |
| 10254 | Return a predicate that returns true when passed a file name whose base | 10243 | Return a predicate that returns true when passed a file name whose base |
| 10255 | name matches @var{regexp}. | 10244 | name 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] |
| 10260 | Return the lexicographically sorted list of files under @var{dir} for | 10249 | Return the lexicographically sorted list of files under @var{dir} for |
| 10261 | which @var{pred} returns true. @var{pred} is passed two arguments: the | 10250 | which @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})}. | |||
| 10266 | that symlinks are not followed. If @var{directories?} is true, then | 10255 | that symlinks are not followed. If @var{directories?} is true, then |
| 10267 | directories will also be included. If @var{fail-on-error?} is true, | 10256 | directories will also be included. If @var{fail-on-error?} is true, |
| 10268 | raise an exception upon error. | 10257 | raise an exception upon error. |
| 10269 | @end deffn | 10258 | @end defun |
| 10270 | 10259 | ||
| 10271 | Here are a few examples where we assume that the current directory is | 10260 | Here are a few examples where we assume that the current directory is |
| 10272 | the root of the Guix source tree: | 10261 | the 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 |
| 10289 | Return the complete file name for @var{program} as found in | 10278 | Return 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 |
| 10295 | Return the complete file name for @var{name} as found in @var{inputs}; | 10284 | Return 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. | |||
| 10300 | Here, @var{inputs} must be an association list like @code{inputs} and | 10289 | Here, @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 |
| 10302 | Phases}). | 10291 | Phases}). |
| 10303 | @end deffn | 10292 | @end defun |
| 10304 | 10293 | ||
| 10305 | Here is a (simplified) example of how @code{search-input-file} is used | 10294 | Here is a (simplified) example of how @code{search-input-file} is used |
| 10306 | in a build phase of the @code{wireguard-tools} package: | 10295 | in a build phase of the @code{wireguard-tools} package: |
| @@ -10323,7 +10312,7 @@ You'll find handy procedures to spawn processes in this module, | |||
| 10323 | essentially convenient wrappers around Guile's @code{system*} | 10312 | essentially 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{} |
| 10327 | Invoke @var{program} with the given @var{args}. Raise an | 10316 | Invoke @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 |
| 10329 | return @code{#t}. | 10318 | return @code{#t}. |
| @@ -10331,21 +10320,21 @@ return @code{#t}. | |||
| 10331 | The advantage compared to @code{system*} is that you do not need to | 10320 | The advantage compared to @code{system*} is that you do not need to |
| 10332 | check the return value. This reduces boilerplate in shell-script-like | 10321 | check the return value. This reduces boilerplate in shell-script-like |
| 10333 | snippets for instance in package build phases. | 10322 | snippets 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 |
| 10337 | Return true if @var{c} is an @code{&invoke-error} condition. | 10326 | Return 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 |
| 10345 | Access specific fields of @var{c}, an @code{&invoke-error} condition. | 10334 | Access 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] |
| 10349 | Report to @var{port} (by default the current error port) about @var{c}, | 10338 | Report to @var{port} (by default the current error port) about @var{c}, |
| 10350 | an @code{&invoke-error} condition, in a human-friendly way. | 10339 | an @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{} |
| 10367 | Invoke @var{program} with @var{args} and capture @var{program}'s | 10356 | Invoke @var{program} with @var{args} and capture @var{program}'s |
| 10368 | standard output and standard error. If @var{program} succeeds, print | 10357 | standard output and standard error. If @var{program} succeeds, print |
| 10369 | nothing and return the unspecified value; otherwise, raise a | 10358 | nothing 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}, | |||
| 10497 | To ease that task, the @code{(guix build utils)} module provides a | 10486 | To ease that task, the @code{(guix build utils)} module provides a |
| 10498 | couple of helpers to wrap commands. | 10487 | couple 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}] | ||
| 10502 | Make a wrapper for @var{program}. @var{variables} should look like this: | 10490 | Make 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 "$@@" | |||
| 10530 | If @var{program} has previously been wrapped by @code{wrap-program}, the | 10518 | If @var{program} has previously been wrapped by @code{wrap-program}, the |
| 10531 | wrapper is extended with definitions for @var{variables}. If it is not, | 10519 | wrapper 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}] | ||
| 10537 | Wrap the script @var{program} such that @var{variables} are set first. | 10524 | Wrap the script @var{program} such that @var{variables} are set first. |
| 10538 | The format of @var{variables} is the same as in the @code{wrap-program} | 10525 | The format of @var{variables} is the same as in the @code{wrap-program} |
| 10539 | procedure. This procedure differs from @code{wrap-program} in that it | 10526 | procedure. This procedure differs from @code{wrap-program} in that it |
| @@ -10546,7 +10533,7 @@ second line. | |||
| 10546 | 10533 | ||
| 10547 | Note that this procedure can only be used once per file as Guile scripts are | 10534 | Note that this procedure can only be used once per file as Guile scripts are |
| 10548 | not supported. | 10535 | not 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 | |||
| 10735 | directories on the other hand in a set of environment variable | 10722 | directories on the other hand in a set of environment variable |
| 10736 | definitions? That's the job of @code{evaluate-search-paths}. | 10723 | definitions? 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}] | ||
| 10740 | Evaluate @var{search-paths}, a list of search-path specifications, for | 10726 | Evaluate @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 |
| 10742 | specification/value pairs. Use @var{getenv} to determine the current | 10728 | specification/value pairs. Use @var{getenv} to determine the current |
| 10743 | settings and report only settings not already effective. | 10729 | settings and report only settings not already effective. |
| 10744 | @end deffn | 10730 | @end defun |
| 10745 | 10731 | ||
| 10746 | The @code{(guix profiles)} provides a higher-level helper procedure, | 10732 | The @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] |
| 10849 | Connect to the daemon over the Unix-domain socket at @var{uri} (a string). When | 10835 | Connect 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 |
| 10851 | extra space on the file system so that the garbage collector can still | 10837 | extra 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 |
| 10855 | location given the options that were passed to @command{configure}. | 10841 | location 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 |
| 10859 | Close the connection to @var{server}. | 10845 | Close 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 |
| 10863 | This variable is bound to a SRFI-39 parameter, which refers to the port | 10849 | This 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. | |||
| 10867 | Procedures that make RPCs all take a server object as their first | 10853 | Procedures that make RPCs all take a server object as their first |
| 10868 | argument. | 10854 | argument. |
| 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 | ||
| 10872 | Return @code{#t} when @var{path} designates a valid store item and | 10858 | Return @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 |
| 10874 | invalid, for instance because it is the result of an aborted or failed | 10860 | invalid, for instance because it is the result of an aborted or failed |
| @@ -10876,20 +10862,19 @@ build). | |||
| 10876 | 10862 | ||
| 10877 | A @code{&store-protocol-error} condition is raised if @var{path} is not | 10863 | A @code{&store-protocol-error} condition is raised if @var{path} is not |
| 10878 | prefixed by the store directory (@file{/gnu/store}). | 10864 | prefixed 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] |
| 10882 | Add @var{text} under file @var{name} in the store, and return its store | 10868 | Add @var{text} under file @var{name} in the store, and return its store |
| 10883 | path. @var{references} is the list of store paths referred to by the | 10869 | path. @var{references} is the list of store paths referred to by the |
| 10884 | resulting store path. | 10870 | resulting 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}] | ||
| 10889 | Build @var{derivations}, a list of @code{<derivation>} objects, @file{.drv} | 10874 | Build @var{derivations}, a list of @code{<derivation>} objects, @file{.drv} |
| 10890 | file names, or derivation/output pairs, using the specified | 10875 | file 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 | ||
| 10894 | Note that the @code{(guix monads)} module provides a monad as well as | 10879 | Note that the @code{(guix monads)} module provides a monad as well as |
| 10895 | monadic versions of the above procedures, with the goal of making it | 10880 | monadic 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 | |||
| 10963 | otherwise manipulate derivations. The lowest-level primitive to create | 10948 | otherwise manipulate derivations. The lowest-level primitive to create |
| 10964 | a derivation is the @code{derivation} procedure: | 10949 | a 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 |
| 11011 | derivation. It is kept as-is, uninterpreted, in the derivation. | 10996 | derivation. It is kept as-is, uninterpreted, in the derivation. |
| 11012 | @end deffn | 10997 | @end defun |
| 11013 | 10998 | ||
| 11014 | @noindent | 10999 | @noindent |
| 11015 | Here's an example with a shell script as its builder, assuming | 11000 | Here'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 |
| 11043 | is now deprecated in favor of the much nicer @code{gexp->derivation}. | 11028 | is 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 |
| 11081 | Here's an example of a single-output derivation that creates a directory | 11065 | Here'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. | |||
| 11330 | The state is assumed to be a list. | 11314 | The 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] |
| 11334 | Run monadic value @var{mval} starting with @var{state} as the initial | 11318 | Run monadic value @var{mval} starting with @var{state} as the initial |
| 11335 | state. Return two values: the resulting value, and the resulting state. | 11319 | state. Return two values: the resulting value, and the resulting state. |
| 11336 | @end deffn | 11320 | @end defun |
| 11337 | 11321 | ||
| 11338 | The main interface to the store monad, provided by the @code{(guix | 11322 | The main interface to the store monad, provided by the @code{(guix |
| 11339 | store)} module, is as follows. | 11323 | store)} module, is as follows. |
| @@ -11346,10 +11330,11 @@ effect is needed, a value of the store monad must be ``evaluated'' by | |||
| 11346 | passing it to the @code{run-with-store} procedure (see below). | 11330 | passing 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)] | ||
| 11350 | Run @var{mval}, a monadic value in the store monad, in @var{store}, an | 11335 | Run @var{mval}, a monadic value in the store monad, in @var{store}, an |
| 11351 | open store connection. | 11336 | open 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}] |
| 11355 | Return as a monadic value the absolute file name in the store of the file | 11340 | Return 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 |
| 11697 | Return @code{#t} if @var{obj} is a G-expression. | 11682 | Return @code{#t} if @var{obj} is a G-expression. |
| 11698 | @end deffn | 11683 | @end defun |
| 11699 | 11684 | ||
| 11700 | G-expressions are meant to be written to disk, either as code building | 11685 | G-expressions are meant to be written to disk, either as code building |
| 11701 | some derivation, or as plain files in the store. The monadic procedures | 11686 | some 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 |
| 11783 | content is directly passed as a string. | 11768 | content 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)] | ||
| 11787 | Return an object representing local file @var{file} to add to the store; | 11771 | Return an object representing local file @var{file} to add to the store; |
| 11788 | this object can be used in a gexp. If @var{file} is a literal string | 11772 | this object can be used in a gexp. If @var{file} is a literal string |
| 11789 | denoting a relative file name, it is looked up relative to the source | 11773 | denoting 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 | ||
| 11804 | This is the declarative counterpart of the @code{interned-file} monadic | 11788 | This is the declarative counterpart of the @code{interned-file} monadic |
| 11805 | procedure (@pxref{The Store Monad, @code{interned-file}}). | 11789 | procedure (@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 |
| 11809 | Return an object representing a text file called @var{name} with the given | 11793 | Return 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 | ||
| 11812 | This is the declarative counterpart of @code{text-file}. | 11796 | This 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 '()] | ||
| 11817 | Return an object representing the store item @var{name}, a file or | 11800 | Return an object representing the store item @var{name}, a file or |
| 11818 | directory computed by @var{gexp}. When @var{local-build?} is true (the | 11801 | directory computed by @var{gexp}. When @var{local-build?} is true (the |
| 11819 | default), the derivation is built locally. @var{options} is a list of | 11802 | default), the derivation is built locally. @var{options} is a list of |
| 11820 | additional arguments to pass to @code{gexp->derivation}. | 11803 | additional arguments to pass to @code{gexp->derivation}. |
| 11821 | 11804 | ||
| 11822 | This is the declarative counterpart of @code{gexp->derivation}. | 11805 | This 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] | ||
| 11856 | Return an object representing the executable store item @var{name} that | 11838 | Return an object representing the executable store item @var{name} that |
| 11857 | runs @var{gexp}. @var{guile} is the Guile package used to execute that | 11839 | runs @var{gexp}. @var{guile} is the Guile package used to execute that |
| 11858 | script. Imported modules of @var{gexp} are looked up in @var{module-path}. | 11840 | script. Imported modules of @var{gexp} are looked up in @var{module-path}. |
| 11859 | 11841 | ||
| 11860 | This is the declarative counterpart of @code{gexp->script}. | 11842 | This 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} | |||
| 11877 | or a subset thereof. | 11859 | or 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] | ||
| 11882 | Return an object representing the Scheme file @var{name} that contains | 11863 | Return an object representing the Scheme file @var{name} that contains |
| 11883 | @var{exp}. | 11864 | @var{exp}. |
| 11884 | 11865 | ||
| 11885 | This is the declarative counterpart of @code{gexp->file}. | 11866 | This 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{} |
| 11889 | Return as a monadic value a derivation that builds a text file | 11870 | Return 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 | |||
| 11911 | preventing them from being garbage-collected during its lifetime. | 11892 | preventing 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{} |
| 11915 | Return an object representing store file @var{name} containing | 11896 | Return 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, |
| 11917 | as in: | 11898 | as in: |
| @@ -11922,9 +11903,9 @@ as in: | |||
| 11922 | @end lisp | 11903 | @end lisp |
| 11923 | 11904 | ||
| 11924 | This is the declarative counterpart of @code{text-file*}. | 11905 | This 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 |
| 11928 | Return a @code{<computed-file>} that builds a directory containing all of @var{files}. | 11909 | Return a @code{<computed-file>} that builds a directory containing all of @var{files}. |
| 11929 | Each item in @var{files} must be a two-element list where the first element is the | 11910 | Each item in @var{files} must be a two-element list where the first element is the |
| 11930 | file name to use in the new directory, and the second element is a gexp | 11911 | file 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 | ||
| 11941 | This yields an @code{etc} directory containing these two files. | 11922 | This 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 |
| 11945 | Return a directory that is the union of @var{things}, where @var{things} is a list of | 11926 | Return a directory that is the union of @var{things}, where @var{things} is a list of |
| 11946 | file-like objects denoting directories. For example: | 11927 | file-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 | ||
| 11952 | yields a directory that is the union of the @code{guile} and @code{emacs} packages. | 11933 | yields 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{} |
| 11956 | Return a file-like object that expands to the concatenation of @var{obj} | 11937 | Return a file-like object that expands to the concatenation of @var{obj} |
| 11957 | and @var{suffix}, where @var{obj} is a lowerable object and each | 11938 | and @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 | |||
| 11977 | resulting script contains the absolute file name as a string, whereas in | 11958 | resulting script contains the absolute file name as a string, whereas in |
| 11978 | the second case, the resulting script contains a @code{(string-append | 11959 | the 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 | |||
| 12044 | has an associated gexp compiler, such as a @code{<package>}. | 12025 | has 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 |
| 12048 | Sometimes, it may be useful to convert a G-exp into a S-exp. For | 12029 | Sometimes, it may be useful to convert a G-exp into a S-exp. For |
| 12049 | example, some linters (@pxref{Invoking guix lint}) peek into the build | 12030 | example, some linters (@pxref{Invoking guix lint}) peek into the build |
| 12050 | phases of a package to detect potential problems. This conversion can | 12031 | phases 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 | |||
| 12052 | in the process. More specifically, lowerable objects will be silently | 12033 | in the process. More specifically, lowerable objects will be silently |
| 12053 | replaced with some arbitrary object -- currently the list | 12034 | replaced 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 |
| 16872 | This procedure returns an opaque file system label from @var{str}, a | 16853 | This procedure returns an opaque file system label from @var{str}, a |
| 16873 | string: | 16854 | string: |
| 16874 | 16855 | ||
| @@ -16879,7 +16860,7 @@ string: | |||
| 16879 | 16860 | ||
| 16880 | File system labels are used to refer to file systems by label rather | 16861 | File system labels are used to refer to file systems by label rather |
| 16881 | than by device name. See above for examples. | 16862 | than by device name. See above for examples. |
| 16882 | @end deffn | 16863 | @end defun |
| 16883 | 16864 | ||
| 16884 | The @code{(gnu system file-systems)} exports the following useful | 16865 | The @code{(gnu system file-systems)} exports the following useful |
| 16885 | variables. | 16866 | variables. |
| @@ -16930,7 +16911,7 @@ and unmount user-space FUSE file systems. This requires the | |||
| 16930 | The @code{(gnu system uuid)} module provides tools to deal with file | 16911 | The @code{(gnu system uuid)} module provides tools to deal with file |
| 16931 | system ``unique identifiers'' (UUIDs). | 16912 | system ``unique identifiers'' (UUIDs). |
| 16932 | 16913 | ||
| 16933 | @deffn {Scheme Procedure} uuid @var{str} [@var{type}] | 16914 | @defun uuid str [type] |
| 16934 | Return an opaque UUID (unique identifier) object of the given @var{type} | 16915 | Return 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 | ||
| 16948 | UUIDs are another way to unambiguously refer to file systems in | 16929 | UUIDs are another way to unambiguously refer to file systems in |
| 16949 | operating system configuration. See the examples above. | 16930 | operating 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 | |||
| 17610 | list of additional options. In most cases the layout name is all you care | 17591 | list of additional options. In most cases the layout name is all you care |
| 17611 | about. | 17592 | about. |
| 17612 | 17593 | ||
| 17613 | @deffn {Scheme Procedure} keyboard-layout @var{name} [@var{variant}] @ | 17594 | @defun keyboard-layout name [variant] [#:model] [#:options '()] |
| 17614 | [#:model] [#:options '()] | ||
| 17615 | Return a new keyboard layout with the given @var{name} and @var{variant}. | 17595 | Return 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 |
| 17618 | string such as @code{"bepo"} or @code{"nodeadkeys"}. See the | 17598 | string 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 | ||
| 17622 | Here are a few examples: | 17602 | Here 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 |
| 18013 | Use @var{target} as the ``special file'' @var{file}. | 17993 | Use @var{target} as the ``special file'' @var{file}. |
| 18014 | 17994 | ||
| 18015 | For example, adding the following lines to the @code{services} field of | 17995 | For 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 |
| 18026 | Type of the service that sets the system host name, whose value | 18006 | Type 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}] | ||
| 22201 | Tell the log-in manager (of type @var{login-manager-service-type}) to use | 22180 | Tell 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 | ||
| 22204 | Since the Xorg configuration is embedded in the log-in manager's | 22183 | Since the Xorg configuration is embedded in the log-in manager's |
| 22205 | configuration---e.g., @code{gdm-configuration}---this procedure provides a | 22184 | configuration---e.g., @code{gdm-configuration}---this procedure provides a |
| 22206 | shorthand to set the Xorg configuration. | 22185 | shorthand 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] |
| 22210 | Return a @code{startx} script in which the modules, fonts, etc. specified | 22189 | Return a @code{startx} script in which the modules, fonts, etc. specified |
| 22211 | in @var{config}, are available. The result should be used in place of | 22190 | in @var{config}, are available. The result should be used in place of |
| 22212 | @code{startx}. | 22191 | @code{startx}. |
| 22213 | 22192 | ||
| 22214 | Usually the X server is started by a login manager. | 22193 | Usually 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 '()] |
| 23657 | Return a configuration allowing an application to access GeoClue | 23636 | Return a configuration allowing an application to access GeoClue |
| 23658 | location data. @var{name} is the Desktop ID of the application, without | 23637 | location data. @var{name} is the Desktop ID of the application, without |
| 23659 | the @code{.desktop} part. If @var{allowed?} is true, the application | 23638 | the @code{.desktop} part. If @var{allowed?} is true, the application |
| @@ -23662,7 +23641,7 @@ will have access to location information by default. The boolean | |||
| 23662 | or not. Finally @var{users} is a list of UIDs of all users for which | 23641 | or not. Finally @var{users} is a list of UIDs of all users for which |
| 23663 | this application is allowed location info access. An empty users list | 23642 | this application is allowed location info access. An empty users list |
| 23664 | means that all users are allowed. | 23643 | means that all users are allowed. |
| 23665 | @end deffn | 23644 | @end defun |
| 23666 | 23645 | ||
| 23667 | @defvar %standard-geoclue-applications | 23646 | @defvar %standard-geoclue-applications |
| 23668 | The standard list of well-known GeoClue application configurations, | 23647 | The standard list of well-known GeoClue application configurations, |
| @@ -27624,7 +27603,7 @@ client is already being used. Otherwise, the | |||
| 27624 | procedures provided by this module can be used to obtain a suitable hash | 27603 | procedures provided by this module can be used to obtain a suitable hash |
| 27625 | value. | 27604 | value. |
| 27626 | 27605 | ||
| 27627 | @deffn {Scheme Procedure} transmission-password-hash @var{password} @var{salt} | 27606 | @defun transmission-password-hash password salt |
| 27628 | Returns a string containing the result of hashing @var{password} | 27607 | Returns a string containing the result of hashing @var{password} |
| 27629 | together with @var{salt}, in the format recognized by Transmission | 27608 | together with @var{salt}, in the format recognized by Transmission |
| 27630 | clients for their @code{rpc-password} configuration setting. | 27609 | clients 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 |
| 27634 | suitable salt value at random. | 27613 | suitable salt value at random. |
| 27635 | @end deffn | 27614 | @end defun |
| 27636 | 27615 | ||
| 27637 | @deffn {Scheme Procedure} transmission-random-salt | 27616 | @defun transmission-random-salt |
| 27638 | Returns a string containing a random, eight-character salt value of the | 27617 | Returns a string containing a random, eight-character salt value of the |
| 27639 | type generated and used by Transmission clients, suitable for passing to | 27618 | type generated and used by Transmission clients, suitable for passing to |
| 27640 | the @code{transmission-password-hash} procedure. | 27619 | the @code{transmission-password-hash} procedure. |
| 27641 | @end deffn | 27620 | @end defun |
| 27642 | 27621 | ||
| 27643 | These procedures are accessible from within a Guile REPL started with | 27622 | These procedures are accessible from within a Guile REPL started with |
| 27644 | the @command{guix repl} command (@pxref{Invoking guix repl}). This is | 27623 | the @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")] | ||
| 30543 | A helper function to quickly add php to an @code{nginx-server-configuration}. | 30520 | A helper function to quickly add php to an @code{nginx-server-configuration}. |
| 30544 | @end deffn | 30521 | @end defun |
| 30545 | 30522 | ||
| 30546 | A simple services setup for nginx with php can look like this: | 30523 | A 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 | |||
| 30564 | in @code{Nginx}. It is used to generate cat avatar from a seed, for instance | 30541 | in @code{Nginx}. It is used to generate cat avatar from a seed, for instance |
| 30565 | the hash of a user's email address. | 30542 | the 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 | |||
| 30572 | extends the nginx configuration to add a server block that serves @code{package}, | 30549 | extends the nginx configuration to add a server block that serves @code{package}, |
| 30573 | a version of cat-avatar-generator. During execution, cat-avatar-generator will | 30550 | a version of cat-avatar-generator. During execution, cat-avatar-generator will |
| 30574 | be able to use @code{cache-dir} as its cache directory. | 30551 | be able to use @code{cache-dir} as its cache directory. |
| 30575 | @end deffn | 30552 | @end defun |
| 30576 | 30553 | ||
| 30577 | A simple setup for cat-avatar-generator can look like this: | 30554 | A 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{} |
| 34583 | Return the list of QEMU platform objects corresponding to | 34560 | Return 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 |
| 34585 | corresponding to platform names, such as @code{"arm"}, @code{"sparc"}, | 34562 | corresponding 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 |
| 34590 | Return true if @var{obj} is a platform object. | 34567 | Return 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 |
| 34594 | Return the name of @var{platform}---a string such as @code{"arm"}. | 34571 | Return 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 |
| 35092 | This is a helper procedure that creates a @code{ganeti-os-variant} record. It | 35069 | This is a helper procedure that creates a @code{ganeti-os-variant} record. It |
| 35093 | takes two parameters: a name and a @code{debootstrap-configuration} object. | 35070 | takes 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{} |
| 35097 | This is a helper procedure that creates a @code{ganeti-os} record. It takes | 35074 | This is a helper procedure that creates a @code{ganeti-os} record. It takes |
| 35098 | a list of variants created with @code{debootstrap-variant}. | 35075 | a 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 |
| 35102 | This is a helper procedure that creates a @code{ganeti-os-variant} record for | 35079 | This is a helper procedure that creates a @code{ganeti-os-variant} record for |
| 35103 | use with the Guix OS provider. It takes a name and a G-expression that returns | 35080 | use with the Guix OS provider. It takes a name and a G-expression that returns |
| 35104 | a ``file-like'' (@pxref{G-Expressions, file-like objects}) object containing a | 35081 | a ``file-like'' (@pxref{G-Expressions, file-like objects}) object containing a |
| 35105 | Guix System configuration. | 35082 | Guix 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{} |
| 35109 | This is a helper procedure that creates a @code{ganeti-os} record. It | 35086 | This is a helper procedure that creates a @code{ganeti-os} record. It |
| 35110 | takes a list of variants produced by @code{guix-variant}. | 35087 | takes 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 |
| 35114 | This is a convenience variable to make the debootstrap provider work | 35091 | This 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 |
| 35607 | server. | 35584 | server. |
| 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)] |
| 35611 | Compute an @code{nginx-location-configuration} that corresponds to the | 35588 | Compute an @code{nginx-location-configuration} that corresponds to the |
| 35612 | given Git http configuration. An example nginx service definition to | 35589 | given Git http configuration. An example nginx service definition to |
| @@ -35635,7 +35612,7 @@ certificate. @xref{Certificate Services}. The default @code{certbot} | |||
| 35635 | service will redirect all HTTP traffic on @code{git.my-host.org} to | 35612 | service will redirect all HTTP traffic on @code{git.my-host.org} to |
| 35636 | HTTPS@. You will also need to add an @code{fcgiwrap} proxy to your | 35613 | HTTPS@. You will also need to add an @code{fcgiwrap} proxy to your |
| 35637 | system services. @xref{Web Services}. | 35614 | system 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 |
| 38256 | Extend @var{svc-type}, a @code{<service-type>} object with @var{jail}, a | 38233 | Extend @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 | ||
| 38277 | Below is the reference for the different @code{jail-service-type} | 38254 | Below is the reference for the different @code{jail-service-type} |
| 38278 | configuration records. | 38255 | configuration 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 | ||
| 38909 | When @var{volatile-root?} is true, the root file system is writable but any changes | 38886 | When @var{volatile-root?} is true, the root file system is writable but any changes |
| 38910 | to it are lost. | 38887 | to 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 | |||
| 38932 | for @var{file-systems} and for the given options. Additional kernel | 38909 | for @var{file-systems} and for the given options. Additional kernel |
| 38933 | modules can be listed in @var{linux-modules}. They will be added to the initrd, and | 38910 | modules can be listed in @var{linux-modules}. They will be added to the initrd, and |
| 38934 | loaded at boot time in the order in which they appear. | 38911 | loaded at boot time in the order in which they appear. |
| 38935 | @end deffn | 38912 | @end defun |
| 38936 | 38913 | ||
| 38937 | Needless to say, the initrds we produce and use embed a | 38914 | Needless to say, the initrds we produce and use embed a |
| 38938 | statically-linked Guile, and the initialization program is a Guile | 38915 | statically-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 |
| 38941 | program to run in that initrd. | 38918 | program 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"] |
| 38945 | Return as a file-like object a Linux initrd (a gzipped cpio archive) | 38922 | Return as a file-like object a Linux initrd (a gzipped cpio archive) |
| 38946 | containing @var{guile} and that evaluates @var{exp}, a G-expression, | 38923 | containing @var{guile} and that evaluates @var{exp}, a G-expression, |
| 38947 | upon booting. All the derivations referenced by @var{exp} are | 38924 | upon booting. All the derivations referenced by @var{exp} are |
| 38948 | automatically copied to the initrd. | 38925 | automatically 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 |
| 39296 | Return the default GRUB theme used by the operating system if no | 39273 | Return 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} |
| 39298 | record. | 39275 | record. |
| 39299 | 39276 | ||
| 39300 | It comes with a fancy background image displaying the GNU and Guix | 39277 | It comes with a fancy background image displaying the GNU and Guix |
| 39301 | logos. | 39278 | logos. |
| 39302 | @end deffn | 39279 | @end defun |
| 39303 | 39280 | ||
| 39304 | For example, to override the default resolution, you may use something | 39281 | For example, to override the default resolution, you may use something |
| 39305 | like | 39282 | like |
| @@ -40551,7 +40528,7 @@ Services}). This section provides a reference on how to manipulate | |||
| 40551 | services and service types. This interface is provided by the | 40528 | services 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] |
| 40555 | Return a new service of @var{type}, a @code{<service-type>} object (see | 40532 | Return a new service of @var{type}, a @code{<service-type>} object (see |
| 40556 | below). @var{value} can be any object; it represents the parameters of | 40533 | below). @var{value} can be any object; it represents the parameters of |
| 40557 | this particular service instance. | 40534 | this particular service instance. |
| @@ -40576,20 +40553,20 @@ is equivalent to this: | |||
| 40576 | 40553 | ||
| 40577 | In both cases the result is an instance of @code{openssh-service-type} | 40554 | In both cases the result is an instance of @code{openssh-service-type} |
| 40578 | with the default configuration. | 40555 | with the default configuration. |
| 40579 | @end deffn | 40556 | @end defun |
| 40580 | 40557 | ||
| 40581 | @deffn {Scheme Procedure} service? @var{obj} | 40558 | @defun service? obj |
| 40582 | Return true if @var{obj} is a service. | 40559 | Return 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 |
| 40586 | Return the type of @var{service}---i.e., a @code{<service-type>} object. | 40563 | Return 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 |
| 40590 | Return the value associated with @var{service}. It represents its | 40567 | Return the value associated with @var{service}. It represents its |
| 40591 | parameters. | 40568 | parameters. |
| 40592 | @end deffn | 40569 | @end defun |
| 40593 | 40570 | ||
| 40594 | Here is an example of how a service is created and manipulated: | 40571 | Here 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} | ||
| 40715 | Return a new extension for services of type @var{target-type}. | 40691 | Return 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} |
| 40717 | calls it, passing it the value associated with the service that provides | 40693 | calls it, passing it the value associated with the service that provides |
| 40718 | the extension; it must return a valid value for the target service. | 40694 | the 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 |
| 40722 | Return true if @var{obj} is a service extension. | 40698 | Return true if @var{obj} is a service extension. |
| 40723 | @end deffn | 40699 | @end defun |
| 40724 | 40700 | ||
| 40725 | Occasionally, you might want to simply extend an existing service. This | 40701 | Occasionally, you might want to simply extend an existing service. This |
| 40726 | involves creating a new service type and specifying the extension of | 40702 | involves creating a new service type and specifying the extension of |
| 40727 | interest, which can be verbose; the @code{simple-service} procedure | 40703 | interest, which can be verbose; the @code{simple-service} procedure |
| 40728 | provides a shorthand for this. | 40704 | provides 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 |
| 40731 | Return a service that extends @var{target} with @var{value}. This works | 40707 | Return a service that extends @var{target} with @var{value}. This works |
| 40732 | by creating a singleton service type @var{name}, of which the returned | 40708 | by creating a singleton service type @var{name}, of which the returned |
| 40733 | service is an instance. | 40709 | service 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 | ||
| 40744 | At the core of the service abstraction lies the @code{fold-services} | 40720 | At the core of the service abstraction lies the @code{fold-services} |
| 40745 | procedure, which is responsible for ``compiling'' a list of services | 40721 | procedure, which is responsible for ``compiling'' a list of services |
| @@ -40749,11 +40725,10 @@ command (@pxref{Invoking guix system}). In essence, it propagates | |||
| 40749 | service extensions down the service graph, updating each node parameters | 40725 | service extensions down the service graph, updating each node parameters |
| 40750 | on the way, until it reaches the root node. | 40726 | on 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}] | ||
| 40754 | Fold @var{services} by propagating their extensions down to the root of | 40729 | Fold @var{services} by propagating their extensions down to the root of |
| 40755 | type @var{target-type}; return the root service adjusted accordingly. | 40730 | type @var{target-type}; return the root service adjusted accordingly. |
| 40756 | @end deffn | 40731 | @end defun |
| 40757 | 40732 | ||
| 40758 | Lastly, the @code{(gnu services)} module also defines several essential | 40733 | Lastly, the @code{(gnu services)} module also defines several essential |
| 40759 | service types, some of which are listed below. | 40734 | service 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 |
| 41040 | Return a @code{configuration} action to display @var{file}, which should | 41015 | Return a @code{configuration} action to display @var{file}, which should |
| 41041 | be the name of the service's configuration file. | 41016 | be 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 | ||
| 41068 | This can come in as a handy debugging tool! | 41043 | This 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 |
| 41072 | The service type for the Shepherd ``root service''---i.e., PID@tie{}1. | 41047 | The 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 |
| 41301 | Predicate to check whether a user explicitly specified the value of a | 41276 | Predicate to check whether a user explicitly specified the value of a |
| 41302 | maybe field. | 41277 | maybe 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} | ||
| 41307 | Return a G-expression that contains the values corresponding to the | 41281 | Return 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 |
| 41310 | disk by using something like @code{mixed-text-file}. | 41284 | disk 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 |
| 41314 | A serializer that just returns an empty string. The | 41288 | A 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 | ||
| 41318 | Once you have defined a configuration record, you will most likely also | 41292 | Once you have defined a configuration record, you will most likely also |
| 41319 | want to document it so that other people know to use it. To help with | 41293 | want to document it so that other people know to use it. To help with |
| 41320 | that, there are two procedures, both of which are documented below. | 41294 | that, 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} | ||
| 41324 | Generate a Texinfo fragment from the docstrings in @var{documentation}, | 41297 | Generate a Texinfo fragment from the docstrings in @var{documentation}, |
| 41325 | a list of @code{(@var{label} @var{fields} @var{sub-documentation} ...)}. | 41298 | a 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 |
| 41351 | the configuration record. | 41324 | the 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} | ||
| 41357 | Take @var{configuration-symbol}, the symbol corresponding to the name | 41329 | Take @var{configuration-symbol}, the symbol corresponding to the name |
| 41358 | used when defining a configuration record with | 41330 | used 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 |
| 41360 | fields. This is useful if there aren’t any nested configuration records | 41332 | fields. This is useful if there aren’t any nested configuration records |
| 41361 | since it only prints the documentation for the top-level fields. | 41333 | since it only prints the documentation for the top-level fields. |
| 41362 | @end deffn | 41334 | @end defun |
| 41363 | 41335 | ||
| 41364 | As of right now, there is no automated way to generate documentation for | 41336 | As of right now, there is no automated way to generate documentation for |
| 41365 | configuration records and put them in the manual. Instead, every | 41337 | configuration records and put them in the manual. Instead, every |
