diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2026-05-06 12:51:27 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-05-11 17:49:11 +0200 |
| commit | 2cbe77f480fa74f74ef4bd6c7a1606e3f08bb142 (patch) | |
| tree | 4a8254c8c614d97544d8489bdddce2a004c08b25 /doc/guix-cookbook.texi | |
| parent | 1ddcd976a0eb0f9de1409b6d7d87f6ef982dd01b (diff) | |
doc: cookbook: Add links from “Packaging Tutorial” to the manual.
* doc/guix-cookbook.texi (A ``Hello World'' package): Add link to “origin
Reference” and adjust markup.
(Extended example): Link to “origin Reference”. Fix markup. Link to
“Packages with Multiple Outputs”, “Build Systems”, “Build Phases”, and
“G-Expressions”. Adjust reference to the Guile manual.
(Inheritance): Link to “Defining Package Variants”.
(References): Use @xref to reference the manual.
Change-Id: Ifa605adc1c91f2735b66005c8a7412f60cdb4484
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Merges: #8392
Diffstat (limited to 'doc/guix-cookbook.texi')
| -rw-r--r-- | doc/guix-cookbook.texi | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 4b4a5a0f2a7..0277ba01035 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi | |||
| @@ -646,9 +646,11 @@ This field contains a description of the source code origin. The | |||
| 646 | 646 | ||
| 647 | @enumerate | 647 | @enumerate |
| 648 | @item The method, here @code{url-fetch} to download via HTTP/FTP, but other methods | 648 | @item The method, here @code{url-fetch} to download via HTTP/FTP, but other methods |
| 649 | exist, such as @code{git-fetch} for Git repositories. | 649 | exist, such as @code{git-fetch} for Git repositories. @xref{origin |
| 650 | Reference,,, guix, GNU Guix Reference Manual}, for more info on the | ||
| 651 | available download methods. | ||
| 650 | @item The URI, which is typically some @code{https://} location for @code{url-fetch}. Here | 652 | @item The URI, which is typically some @code{https://} location for @code{url-fetch}. Here |
| 651 | the special `mirror://gnu` refers to a set of well known locations, all of | 653 | the special @code{mirror://gnu} refers to a set of well known locations, all of |
| 652 | which can be used by Guix to fetch the source, should some of them fail. | 654 | which can be used by Guix to fetch the source, should some of them fail. |
| 653 | @item The @code{sha256} checksum of the requested file. This is essential to ensure | 655 | @item The @code{sha256} checksum of the requested file. This is essential to ensure |
| 654 | the source is not corrupted. Note that Guix works with base32 strings, | 656 | the source is not corrupted. Note that Guix works with base32 strings, |
| @@ -1116,7 +1118,8 @@ Let's discuss those fields in depth. | |||
| 1116 | @subsubsection @code{git-fetch} method | 1118 | @subsubsection @code{git-fetch} method |
| 1117 | 1119 | ||
| 1118 | Unlike the @code{url-fetch} method, @code{git-fetch} expects a @code{git-reference} which takes | 1120 | Unlike the @code{url-fetch} method, @code{git-fetch} expects a @code{git-reference} which takes |
| 1119 | a Git repository and a commit. The commit can be any Git reference such as | 1121 | a Git repository and a commit (@pxref{origin Reference,,, guix, GNU Guix |
| 1122 | Reference Manual}). The commit can be any Git reference such as | ||
| 1120 | tags, so if the @code{version} is tagged, then it can be used directly. Sometimes | 1123 | tags, so if the @code{version} is tagged, then it can be used directly. Sometimes |
| 1121 | the tag is prefixed with a @code{v}, in which case you'd use @code{(commit (string-append | 1124 | the tag is prefixed with a @code{v}, in which case you'd use @code{(commit (string-append |
| 1122 | "v" version))}. | 1125 | "v" version))}. |
| @@ -1162,7 +1165,7 @@ Snippets might need additional Guile modules which can be imported from the | |||
| 1162 | 1165 | ||
| 1163 | There are 3 different input types. In short: | 1166 | There are 3 different input types. In short: |
| 1164 | 1167 | ||
| 1165 | @table @asis | 1168 | @table @code |
| 1166 | @item native-inputs | 1169 | @item native-inputs |
| 1167 | Required for building but not runtime -- installing a package | 1170 | Required for building but not runtime -- installing a package |
| 1168 | through a substitute won't install these inputs. | 1171 | through a substitute won't install these inputs. |
| @@ -1230,9 +1233,14 @@ It's advised to separate outputs only when you've shown it's worth it: if the | |||
| 1230 | output size is significant (compare with @code{guix size}) or in case the package is | 1233 | output size is significant (compare with @code{guix size}) or in case the package is |
| 1231 | modular. | 1234 | modular. |
| 1232 | 1235 | ||
| 1236 | @xref{Packages with Multiple Outputs,,, guix, GNU Guix Reference | ||
| 1237 | Manual}, for more info. | ||
| 1238 | |||
| 1233 | @subsubsection Build system arguments | 1239 | @subsubsection Build system arguments |
| 1234 | 1240 | ||
| 1235 | The @code{arguments} is a keyword-value list used to configure the build process. | 1241 | The @code{arguments} is a keyword-value list used to configure the build |
| 1242 | process; these arguments are passed to the @dfn{build system} | ||
| 1243 | (@pxref{Build Systems,,, guix, GNU Guix Reference Manual}). | ||
| 1236 | 1244 | ||
| 1237 | The simplest argument @code{#:tests?} can be used to disable the test suite when | 1245 | The simplest argument @code{#:tests?} can be used to disable the test suite when |
| 1238 | building the package. This is mostly useful when the package does not feature | 1246 | building the package. This is mostly useful when the package does not feature |
| @@ -1248,7 +1256,7 @@ following flags | |||
| 1248 | "CC=gcc") | 1256 | "CC=gcc") |
| 1249 | @end lisp | 1257 | @end lisp |
| 1250 | 1258 | ||
| 1251 | translate into | 1259 | translate into: |
| 1252 | 1260 | ||
| 1253 | @example | 1261 | @example |
| 1254 | $ make CC=gcc prefix=/gnu/store/...-<out> | 1262 | $ make CC=gcc prefix=/gnu/store/...-<out> |
| @@ -1268,7 +1276,9 @@ Similarly, it's possible to set the configure flags: | |||
| 1268 | The @code{%build-inputs} variable is also generated in scope. It's an association | 1276 | The @code{%build-inputs} variable is also generated in scope. It's an association |
| 1269 | table that maps the input names to their store directories. | 1277 | table that maps the input names to their store directories. |
| 1270 | 1278 | ||
| 1271 | The @code{phases} keyword lists the sequential steps of the build system. Typically | 1279 | The @code{phases} keyword lists the sequential steps of the build |
| 1280 | system. @xref{Build Phases,,, guix, GNU Guix Reference Manual}, for | ||
| 1281 | details; in a nutshell, | ||
| 1272 | phases include @code{unpack}, @code{configure}, @code{build}, @code{install} and @code{check}. To know | 1282 | phases include @code{unpack}, @code{configure}, @code{build}, @code{install} and @code{check}. To know |
| 1273 | more about those phases, you need to work out the appropriate build system | 1283 | more about those phases, you need to work out the appropriate build system |
| 1274 | definition in @samp{$GUIX_CHECKOUT/guix/build/gnu-build-system.scm}: | 1284 | definition in @samp{$GUIX_CHECKOUT/guix/build/gnu-build-system.scm}: |
| @@ -1383,10 +1393,12 @@ Its return value is ignored. | |||
| 1383 | 1393 | ||
| 1384 | @subsubsection Code staging | 1394 | @subsubsection Code staging |
| 1385 | 1395 | ||
| 1386 | The astute reader may have noticed the quasi-quote and comma syntax in the | 1396 | The astute reader may have noticed the hash-tilde and hash-dollar syntax in the |
| 1387 | argument field. Indeed, the build code in the package declaration should not be | 1397 | argument field. Indeed, the build code in the package declaration should not be |
| 1388 | evaluated on the client side, but only when passed to the Guix daemon. This | 1398 | evaluated on the client side, but only when passed to the Guix daemon. This |
| 1389 | mechanism of passing code around two running processes is called @uref{https://arxiv.org/abs/1709.00833, code staging}. | 1399 | mechanism of passing code around two running processes is called @uref{https://arxiv.org/abs/1709.00833, code staging}. |
| 1400 | @xref{G-Expressions,,, guix, GNU Guix Reference Manual}, for info on the | ||
| 1401 | this mechanism, which is called @dfn{g-expressions}. | ||
| 1390 | 1402 | ||
| 1391 | @subsubsection Utility functions | 1403 | @subsubsection Utility functions |
| 1392 | 1404 | ||
| @@ -1395,7 +1407,7 @@ equivalent system invocations (@code{make}, @code{mkdir}, @code{cp}, etc.)@: com | |||
| 1395 | regular ``Unix-style'' installations. | 1407 | regular ``Unix-style'' installations. |
| 1396 | 1408 | ||
| 1397 | Some like @code{chmod} are native to Guile. | 1409 | Some like @code{chmod} are native to Guile. |
| 1398 | @xref{,,, guile, Guile reference manual} for a complete list. | 1410 | @xref{File System,,, guile, Guile reference manual} for a complete list. |
| 1399 | 1411 | ||
| 1400 | Guix provides additional helper functions which prove especially handy in the | 1412 | Guix provides additional helper functions which prove especially handy in the |
| 1401 | context of package management. | 1413 | context of package management. |
| @@ -1575,7 +1587,9 @@ noticed that a significant number of them have a @code{inherit} field: | |||
| 1575 | 1587 | ||
| 1576 | All unspecified fields are inherited from the parent package. This is very | 1588 | All unspecified fields are inherited from the parent package. This is very |
| 1577 | convenient to create alternative packages, for instance with different source, | 1589 | convenient to create alternative packages, for instance with different source, |
| 1578 | version or compilation options. | 1590 | version or compilation options. @xref{Defining Package Variant,,, guix, |
| 1591 | GNU Guix Reference Manual}, for a discussion of inheritance and of other | ||
| 1592 | ways to create package variants. | ||
| 1579 | 1593 | ||
| 1580 | @node Getting help | 1594 | @node Getting help |
| 1581 | @subsection Getting help | 1595 | @subsection Getting help |
| @@ -1616,7 +1630,8 @@ hopefully we will see your contributions soon! | |||
| 1616 | 1630 | ||
| 1617 | @itemize | 1631 | @itemize |
| 1618 | @item | 1632 | @item |
| 1619 | The @uref{https://guix.gnu.org/manual/en/html_node/Defining-Packages.html, package reference in the manual} | 1633 | @xref{Defining Packages,,, guix, GNU Guix Reference Manual}, for the |
| 1634 | @code{package} reference in the manual. | ||
| 1620 | 1635 | ||
| 1621 | @item | 1636 | @item |
| 1622 | @uref{https://gitlab.com/pjotrp/guix-notes/blob/master/HACKING.org, Pjotr’s hacking guide to GNU Guix} | 1637 | @uref{https://gitlab.com/pjotrp/guix-notes/blob/master/HACKING.org, Pjotr’s hacking guide to GNU Guix} |
