summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2026-05-06 12:51:27 +0200
committerLudovic Courtès <ludo@gnu.org>2026-05-11 17:49:11 +0200
commit2cbe77f480fa74f74ef4bd6c7a1606e3f08bb142 (patch)
tree4a8254c8c614d97544d8489bdddce2a004c08b25 /doc
parent1ddcd976a0eb0f9de1409b6d7d87f6ef982dd01b (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')
-rw-r--r--doc/guix-cookbook.texi37
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
1118Unlike the @code{url-fetch} method, @code{git-fetch} expects a @code{git-reference} which takes 1120Unlike the @code{url-fetch} method, @code{git-fetch} expects a @code{git-reference} which takes
1119a Git repository and a commit. The commit can be any Git reference such as 1121a Git repository and a commit (@pxref{origin Reference,,, guix, GNU Guix
1122Reference Manual}). The commit can be any Git reference such as
1120tags, so if the @code{version} is tagged, then it can be used directly. Sometimes 1123tags, so if the @code{version} is tagged, then it can be used directly. Sometimes
1121the tag is prefixed with a @code{v}, in which case you'd use @code{(commit (string-append 1124the 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
1163There are 3 different input types. In short: 1166There are 3 different input types. In short:
1164 1167
1165@table @asis 1168@table @code
1166@item native-inputs 1169@item native-inputs
1167Required for building but not runtime -- installing a package 1170Required for building but not runtime -- installing a package
1168through a substitute won't install these inputs. 1171through 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
1230output size is significant (compare with @code{guix size}) or in case the package is 1233output size is significant (compare with @code{guix size}) or in case the package is
1231modular. 1234modular.
1232 1235
1236@xref{Packages with Multiple Outputs,,, guix, GNU Guix Reference
1237Manual}, for more info.
1238
1233@subsubsection Build system arguments 1239@subsubsection Build system arguments
1234 1240
1235The @code{arguments} is a keyword-value list used to configure the build process. 1241The @code{arguments} is a keyword-value list used to configure the build
1242process; these arguments are passed to the @dfn{build system}
1243(@pxref{Build Systems,,, guix, GNU Guix Reference Manual}).
1236 1244
1237The simplest argument @code{#:tests?} can be used to disable the test suite when 1245The simplest argument @code{#:tests?} can be used to disable the test suite when
1238building the package. This is mostly useful when the package does not feature 1246building 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
1251translate into 1259translate 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:
1268The @code{%build-inputs} variable is also generated in scope. It's an association 1276The @code{%build-inputs} variable is also generated in scope. It's an association
1269table that maps the input names to their store directories. 1277table that maps the input names to their store directories.
1270 1278
1271The @code{phases} keyword lists the sequential steps of the build system. Typically 1279The @code{phases} keyword lists the sequential steps of the build
1280system. @xref{Build Phases,,, guix, GNU Guix Reference Manual}, for
1281details; in a nutshell,
1272phases include @code{unpack}, @code{configure}, @code{build}, @code{install} and @code{check}. To know 1282phases include @code{unpack}, @code{configure}, @code{build}, @code{install} and @code{check}. To know
1273more about those phases, you need to work out the appropriate build system 1283more about those phases, you need to work out the appropriate build system
1274definition in @samp{$GUIX_CHECKOUT/guix/build/gnu-build-system.scm}: 1284definition 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
1386The astute reader may have noticed the quasi-quote and comma syntax in the 1396The astute reader may have noticed the hash-tilde and hash-dollar syntax in the
1387argument field. Indeed, the build code in the package declaration should not be 1397argument field. Indeed, the build code in the package declaration should not be
1388evaluated on the client side, but only when passed to the Guix daemon. This 1398evaluated on the client side, but only when passed to the Guix daemon. This
1389mechanism of passing code around two running processes is called @uref{https://arxiv.org/abs/1709.00833, code staging}. 1399mechanism 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
1401this 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
1395regular ``Unix-style'' installations. 1407regular ``Unix-style'' installations.
1396 1408
1397Some like @code{chmod} are native to Guile. 1409Some 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
1400Guix provides additional helper functions which prove especially handy in the 1412Guix provides additional helper functions which prove especially handy in the
1401context of package management. 1413context of package management.
@@ -1575,7 +1587,9 @@ noticed that a significant number of them have a @code{inherit} field:
1575 1587
1576All unspecified fields are inherited from the parent package. This is very 1588All unspecified fields are inherited from the parent package. This is very
1577convenient to create alternative packages, for instance with different source, 1589convenient to create alternative packages, for instance with different source,
1578version or compilation options. 1590version or compilation options. @xref{Defining Package Variant,,, guix,
1591GNU Guix Reference Manual}, for a discussion of inheritance and of other
1592ways 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
1619The @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}