1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR the authors of Guix (msgids) and the following authors (msgstr)
3 # This file is distributed under the same license as the guix manual package.
4 # Reynaldo Cordero <reynaldo.cordero@gmail.com>, 2021.
5 # Emilio Herrera <ehespinosa57@gmail.com>, 2021.
8 "Project-Id-Version: guix manual checkout\n"
9 "Report-Msgid-Bugs-To: bug-guix@gnu.org\n"
10 "POT-Creation-Date: 2021-12-31 15:18+0000\n"
11 "PO-Revision-Date: 2021-10-31 16:05+0000\n"
12 "Last-Translator: Emilio Herrera <ehespinosa57@gmail.com>\n"
13 "Language-Team: Spanish <https://translate.fedoraproject.org/projects/guix/documentation-cookbook/es/>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18 "Plural-Forms: nplurals=2; plural=n != 1;\n"
19 "X-Generator: Weblate 4.8\n"
22 #: guix-git/doc/guix-cookbook.texi:7
23 msgid "@documentencoding UTF-8"
24 msgstr "@documentencoding UTF-8"
27 #: guix-git/doc/guix-cookbook.texi:7 guix-git/doc/guix-cookbook.texi:36
28 #: guix-git/doc/guix-cookbook.texi:50
30 msgid "GNU Guix Cookbook"
31 msgstr "Libro de cocina GNU Guix"
34 #: guix-git/doc/guix-cookbook.texi:21
35 msgid "Copyright @copyright{} 2019 Ricardo Wurmus@* Copyright @copyright{} 2019 Efraim Flashner@* Copyright @copyright{} 2019 Pierre Neidhardt@* Copyright @copyright{} 2020 Oleg Pykhalov@* Copyright @copyright{} 2020 Matthew Brooks@* Copyright @copyright{} 2020 Marcin Karpezo@* Copyright @copyright{} 2020 Brice Waegeneire@* Copyright @copyright{} 2020 André Batista@* Copyright @copyright{} 2020 Christine Lemmer-Webber@* Copyright @copyright{} 2021 Joshua Branson@*"
39 #: guix-git/doc/guix-cookbook.texi:28
40 msgid "Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled ``GNU Free Documentation License''."
44 #: guix-git/doc/guix-cookbook.texi:30
46 msgid "System administration"
50 #: guix-git/doc/guix-cookbook.texi:33
51 msgid "Guix cookbook: (guix-cookbook)"
55 #: guix-git/doc/guix-cookbook.texi:33
56 msgid "Tutorials and examples for GNU Guix."
57 msgstr "Tutoriales y ejemplos para GNU Guix."
60 #: guix-git/doc/guix-cookbook.texi:37
62 msgid "Tutorials and examples for using the GNU Guix Functional Package Manager"
63 msgstr "Tutoriales y ejemplos para usar el Gestor Funcional de Paquetes de GNU Guix"
66 #: guix-git/doc/guix-cookbook.texi:38
68 msgid "The GNU Guix Developers"
69 msgstr "Los desarrolladores de GNU Guix"
72 #: guix-git/doc/guix-cookbook.texi:49
78 #: guix-git/doc/guix-cookbook.texi:56
79 msgid "This document presents tutorials and detailed examples for GNU@tie{}Guix, a functional package management tool written for the GNU system. Please @pxref{Top,,, guix, GNU Guix reference manual} for details about the system, its API, and related concepts."
80 msgstr "Este documento presenta tutoriales y ejemplos detallados para GNU@tie{}Guix, una herramienta funcional de paquetes para el sistema GNU. Por favor @pxref{Arriba,,, guix, Manual de referencia de GNU Guix} para detalles acerca del sistema, su API, y conceptos relacionados."
83 #: guix-git/doc/guix-cookbook.texi:66
84 msgid "This manual is also available in French (@pxref{Top,,, guix-cookbook.fr, Livre de recettes de GNU Guix}) and German (@pxref{Top,,, guix-cookbook.de, GNU-Guix-Kochbuch}). If you would like to translate this document in your native language, consider joining @uref{https://translate.fedoraproject.org/projects/guix/documentation-cookbook, Weblate} (@pxref{Translating Guix,,, guix, GNU Guix reference manual})."
88 #: guix-git/doc/guix-cookbook.texi:73 guix-git/doc/guix-cookbook.texi:82
89 #: guix-git/doc/guix-cookbook.texi:98 guix-git/doc/guix-cookbook.texi:99
91 msgid "Scheme tutorials"
95 #: guix-git/doc/guix-cookbook.texi:73
96 msgid "Meet your new favorite language!"
100 #: guix-git/doc/guix-cookbook.texi:73 guix-git/doc/guix-cookbook.texi:86
101 #: guix-git/doc/guix-cookbook.texi:305 guix-git/doc/guix-cookbook.texi:306
107 #: guix-git/doc/guix-cookbook.texi:73
108 msgid "Packaging tutorials"
112 #: guix-git/doc/guix-cookbook.texi:73 guix-git/doc/guix-cookbook.texi:90
113 #: guix-git/doc/guix-cookbook.texi:1340 guix-git/doc/guix-cookbook.texi:1341
115 msgid "System Configuration"
119 #: guix-git/doc/guix-cookbook.texi:73
120 msgid "Customizing the GNU System"
124 #: guix-git/doc/guix-cookbook.texi:73 guix-git/doc/guix-cookbook.texi:2436
125 #: guix-git/doc/guix-cookbook.texi:2437
127 msgid "Advanced package management"
131 #: guix-git/doc/guix-cookbook.texi:73
132 msgid "Power to the users!"
136 #: guix-git/doc/guix-cookbook.texi:73 guix-git/doc/guix-cookbook.texi:2834
137 #: guix-git/doc/guix-cookbook.texi:2835
139 msgid "Environment management"
143 #: guix-git/doc/guix-cookbook.texi:73
144 msgid "Control environment"
148 #: guix-git/doc/guix-cookbook.texi:77 guix-git/doc/guix-cookbook.texi:2958
149 #: guix-git/doc/guix-cookbook.texi:2959
151 msgid "Acknowledgments"
155 #: guix-git/doc/guix-cookbook.texi:77
160 #: guix-git/doc/guix-cookbook.texi:77 guix-git/doc/guix-cookbook.texi:2983
161 #: guix-git/doc/guix-cookbook.texi:2984
163 msgid "GNU Free Documentation License"
167 #: guix-git/doc/guix-cookbook.texi:77
168 msgid "The license of this document."
172 #: guix-git/doc/guix-cookbook.texi:77 guix-git/doc/guix-cookbook.texi:2989
173 #: guix-git/doc/guix-cookbook.texi:2990
175 msgid "Concept Index"
179 #: guix-git/doc/guix-cookbook.texi:77
184 #: guix-git/doc/guix-cookbook.texi:80
185 msgid "--- The Detailed Node Listing ---"
189 #: guix-git/doc/guix-cookbook.texi:84 guix-git/doc/guix-cookbook.texi:112
190 #: guix-git/doc/guix-cookbook.texi:113
192 msgid "A Scheme Crash Course"
196 #: guix-git/doc/guix-cookbook.texi:84
197 msgid "Learn the basics of Scheme"
201 #: guix-git/doc/guix-cookbook.texi:88 guix-git/doc/guix-cookbook.texi:317
202 #: guix-git/doc/guix-cookbook.texi:319 guix-git/doc/guix-cookbook.texi:320
204 msgid "Packaging Tutorial"
208 #: guix-git/doc/guix-cookbook.texi:88
209 msgid "Let's add a package to Guix!"
213 #: guix-git/doc/guix-cookbook.texi:93 guix-git/doc/guix-cookbook.texi:1360
214 #: guix-git/doc/guix-cookbook.texi:1362 guix-git/doc/guix-cookbook.texi:1363
216 msgid "Auto-Login to a Specific TTY"
220 #: guix-git/doc/guix-cookbook.texi:93 guix-git/doc/guix-cookbook.texi:1360
221 msgid "Automatically Login a User to a Specific TTY"
225 #: guix-git/doc/guix-cookbook.texi:93 guix-git/doc/guix-cookbook.texi:1360
226 #: guix-git/doc/guix-cookbook.texi:1407 guix-git/doc/guix-cookbook.texi:1408
228 msgid "Customizing the Kernel"
232 #: guix-git/doc/guix-cookbook.texi:93 guix-git/doc/guix-cookbook.texi:1360
233 msgid "Creating and using a custom Linux kernel on Guix System."
237 #: guix-git/doc/guix-cookbook.texi:105
238 msgid "GNU@tie{}Guix is written in the general purpose programming language Scheme, and many of its features can be accessed and manipulated programmatically. You can use Scheme to generate package definitions, to modify them, to build them, to deploy whole operating systems, etc."
242 #: guix-git/doc/guix-cookbook.texi:109
243 msgid "Knowing the basics of how to program in Scheme will unlock many of the advanced features Guix provides --- and you don't even need to be an experienced programmer to use them!"
247 #: guix-git/doc/guix-cookbook.texi:111
248 msgid "Let's get started!"
252 #: guix-git/doc/guix-cookbook.texi:115
254 msgid "Scheme, crash course"
258 #: guix-git/doc/guix-cookbook.texi:121
259 msgid "Guix uses the Guile implementation of Scheme. To start playing with the language, install it with @code{guix install guile} and start a @dfn{REPL}---short for @uref{https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop, @dfn{read-eval-print loop}}---by running @code{guile} from the command line."
263 #: guix-git/doc/guix-cookbook.texi:124
264 msgid "Alternatively you can also run @code{guix environment --ad-hoc guile -- guile} if you'd rather not have Guile installed in your user profile."
268 #: guix-git/doc/guix-cookbook.texi:130
269 msgid "In the following examples, lines show what you would type at the REPL; lines starting with ``@result{}'' show evaluation results, while lines starting with ``@print{}'' show things that get printed. @xref{Using Guile Interactively,,, guile, GNU Guile Reference Manual}, for more details on the REPL."
273 #: guix-git/doc/guix-cookbook.texi:138
274 msgid "Scheme syntax boils down to a tree of expressions (or @emph{s-expression} in Lisp lingo). An expression can be a literal such as numbers and strings, or a compound which is a parenthesized list of compounds and literals. @code{#true} and @code{#false} (abbreviated @code{#t} and @code{#f}) stand for the Booleans ``true'' and ``false'', respectively."
278 #: guix-git/doc/guix-cookbook.texi:140
279 msgid "Examples of valid expressions:"
283 #: guix-git/doc/guix-cookbook.texi:144
287 "@result{} \"Hello World!\"\n"
292 #: guix-git/doc/guix-cookbook.texi:147
301 #: guix-git/doc/guix-cookbook.texi:151
304 "(display (string-append \"Hello \" \"Guix\" \"\\n\"))\n"
305 "@print{} Hello Guix!\n"
306 "@result{} #<unspecified>\n"
310 #: guix-git/doc/guix-cookbook.texi:158
311 msgid "This last example is a function call nested in another function call. When a parenthesized expression is evaluated, the first term is the function and the rest are the arguments passed to the function. Every function returns the last evaluated expression as its return value."
315 #: guix-git/doc/guix-cookbook.texi:161
316 msgid "Anonymous functions are declared with the @code{lambda} term:"
320 #: guix-git/doc/guix-cookbook.texi:165
323 "(lambda (x) (* x x))\n"
324 "@result{} #<procedure 120e348 at <unknown port>:24:0 (x)>\n"
328 #: guix-git/doc/guix-cookbook.texi:170
329 msgid "The above procedure returns the square of its argument. Since everything is an expression, the @code{lambda} expression returns an anonymous procedure, which can in turn be applied to an argument:"
333 #: guix-git/doc/guix-cookbook.texi:174
336 "((lambda (x) (* x x)) 3)\n"
341 #: guix-git/doc/guix-cookbook.texi:178
342 msgid "Anything can be assigned a global name with @code{define}:"
346 #: guix-git/doc/guix-cookbook.texi:184
350 "(define square (lambda (x) (* x x)))\n"
356 #: guix-git/doc/guix-cookbook.texi:188
357 msgid "Procedures can be defined more concisely with the following syntax:"
361 #: guix-git/doc/guix-cookbook.texi:191
363 msgid "(define (square x) (* x x))\n"
367 #: guix-git/doc/guix-cookbook.texi:195
368 msgid "A list structure can be created with the @code{list} procedure:"
372 #: guix-git/doc/guix-cookbook.texi:199
376 "@result{} (2 3 5 7)\n"
380 #: guix-git/doc/guix-cookbook.texi:206
381 msgid "The @dfn{quote} disables evaluation of a parenthesized expression: the first term is not called over the other terms (@pxref{Expression Syntax, quote,, guile, GNU Guile Reference Manual}). Thus it effectively returns a list of terms."
385 #: guix-git/doc/guix-cookbook.texi:210
388 "'(display (string-append \"Hello \" \"Guix\" \"\\n\"))\n"
389 "@result{} (display (string-append \"Hello \" \"Guix\" \"\\n\"))\n"
394 #: guix-git/doc/guix-cookbook.texi:213
398 "@result{} (2 a 5 7)\n"
402 #: guix-git/doc/guix-cookbook.texi:219
403 msgid "The @dfn{quasiquote} disables evaluation of a parenthesized expression until @dfn{unquote} (a comma) re-enables it. Thus it provides us with fine-grained control over what is evaluated and what is not."
407 #: guix-git/doc/guix-cookbook.texi:223
410 "`(2 a 5 7 (2 ,a 5 ,(+ a 4)))\n"
411 "@result{} (2 a 5 7 (2 3 5 7))\n"
415 #: guix-git/doc/guix-cookbook.texi:227
416 msgid "Note that the above result is a list of mixed elements: numbers, symbols (here @code{a}) and the last element is a list itself."
420 #: guix-git/doc/guix-cookbook.texi:231
421 msgid "Multiple variables can be named locally with @code{let} (@pxref{Local Bindings,,, guile, GNU Guile Reference Manual}):"
425 #: guix-git/doc/guix-cookbook.texi:238
437 #: guix-git/doc/guix-cookbook.texi:241
446 #: guix-git/doc/guix-cookbook.texi:244
450 "@error{} In procedure module-lookup: Unbound variable: y\n"
454 #: guix-git/doc/guix-cookbook.texi:248
455 msgid "Use @code{let*} to allow later variable declarations to refer to earlier definitions."
459 #: guix-git/doc/guix-cookbook.texi:254
469 #: guix-git/doc/guix-cookbook.texi:261
470 msgid "@dfn{Keywords} are typically used to identify the named parameters of a procedure. They are prefixed by @code{#:} (hash, colon) followed by alphanumeric characters: @code{#:like-this}. @xref{Keywords,,, guile, GNU Guile Reference Manual}."
474 #: guix-git/doc/guix-cookbook.texi:266
475 msgid "The percentage @code{%} is typically used for read-only global variables in the build stage. Note that it is merely a convention, like @code{_} in C. Scheme treats @code{%} exactly the same as any other letter."
479 #: guix-git/doc/guix-cookbook.texi:270
480 msgid "Modules are created with @code{define-module} (@pxref{Creating Guile Modules,,, guile, GNU Guile Reference Manual}). For instance"
484 #: guix-git/doc/guix-cookbook.texi:276
487 "(define-module (guix build-system ruby)\n"
488 " #:use-module (guix store)\n"
489 " #:export (ruby-build\n"
490 " ruby-build-system))\n"
494 #: guix-git/doc/guix-cookbook.texi:282
495 msgid "defines the module @code{guix build-system ruby} which must be located in @file{guix/build-system/ruby.scm} somewhere in the Guile load path. It depends on the @code{(guix store)} module and it exports two variables, @code{ruby-build} and @code{ruby-build-system}."
499 #: guix-git/doc/guix-cookbook.texi:287
500 msgid "For a more detailed introduction, check out @uref{http://www.troubleshooters.com/codecorn/scheme_guile/hello.htm, Scheme at a Glance}, by Steve Litt."
504 #: guix-git/doc/guix-cookbook.texi:299
505 msgid "One of the reference Scheme books is the seminal ``Structure and Interpretation of Computer Programs'', by Harold Abelson and Gerald Jay Sussman, with Julie Sussman. You'll find a @uref{https://mitpress.mit.edu/sites/default/files/sicp/index.html, free copy online}, together with @uref{https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-001-structure-and-interpretation-of-computer-programs-spring-2005/video-lectures/, videos of the lectures by the authors}. The book is available in Texinfo format as the @code{sicp} Guix package. Go ahead, run @code{guix install sicp} and start reading with @code{info sicp} (@pxref{,,, sicp, Structure and Interpretation of Computer Programs}). An @uref{https://sarabander.github.io/sicp/, unofficial ebook is also available}."
509 #: guix-git/doc/guix-cookbook.texi:302
510 msgid "You'll find more books, tutorials and other resources at @url{https://schemers.org/}."
514 #: guix-git/doc/guix-cookbook.texi:308
520 #: guix-git/doc/guix-cookbook.texi:314
521 msgid "This chapter is dedicated to teaching you how to add packages to the collection of packages that come with GNU Guix. This involves writing package definitions in Guile Scheme, organizing them in package modules, and building them."
525 #: guix-git/doc/guix-cookbook.texi:317
526 msgid "A tutorial on how to add packages to Guix."
530 #: guix-git/doc/guix-cookbook.texi:328
531 msgid "GNU Guix stands out as the @emph{hackable} package manager, mostly because it uses @uref{https://www.gnu.org/software/guile/, GNU Guile}, a powerful high-level programming language, one of the @uref{https://en.wikipedia.org/wiki/Scheme_%28programming_language%29, Scheme} dialects from the @uref{https://en.wikipedia.org/wiki/Lisp_%28programming_language%29, Lisp family}."
535 #: guix-git/doc/guix-cookbook.texi:332
536 msgid "Package definitions are also written in Scheme, which empowers Guix in some very unique ways, unlike most other package managers that use shell scripts or simple languages."
540 #: guix-git/doc/guix-cookbook.texi:337
541 msgid "Use functions, structures, macros and all of Scheme expressiveness for your package definitions."
545 #: guix-git/doc/guix-cookbook.texi:341
546 msgid "Inheritance makes it easy to customize a package by inheriting from it and modifying only what is needed."
550 #: guix-git/doc/guix-cookbook.texi:351
551 msgid "Batch processing: the whole package collection can be parsed, filtered and processed. Building a headless server with all graphical interfaces stripped out? It's possible. Want to rebuild everything from source using specific compiler optimization flags? Pass the @code{#:make-flags \"...\"} argument to the list of packages. It wouldn't be a stretch to think @uref{https://wiki.gentoo.org/wiki/USE_flag, Gentoo USE flags} here, but this goes even further: the changes don't have to be thought out beforehand by the packager, they can be @emph{programmed} by the user!"
555 #: guix-git/doc/guix-cookbook.texi:357
556 msgid "The following tutorial covers all the basics around package creation with Guix. It does not assume much knowledge of the Guix system nor of the Lisp language. The reader is only expected to be familiar with the command line and to have some basic programming knowledge."
560 #: guix-git/doc/guix-cookbook.texi:358 guix-git/doc/guix-cookbook.texi:359
562 msgid "A ``Hello World'' package"
566 #: guix-git/doc/guix-cookbook.texi:364
567 msgid "The ``Defining Packages'' section of the manual introduces the basics of Guix packaging (@pxref{Defining Packages,,, guix, GNU Guix Reference Manual}). In the following section, we will partly go over those basics again."
571 #: guix-git/doc/guix-cookbook.texi:370
572 msgid "GNU@tie{}Hello is a dummy project that serves as an idiomatic example for packaging. It uses the GNU build system (@code{./configure && make && make install}). Guix already provides a package definition which is a perfect example to start with. You can look up its declaration with @code{guix edit hello} from the command line. Let's see how it looks:"
576 #: guix-git/doc/guix-cookbook.texi:391
579 "(define-public hello\n"
581 " (name \"hello\")\n"
582 " (version \"2.10\")\n"
584 " (method url-fetch)\n"
585 " (uri (string-append \"mirror://gnu/hello/hello-\" version\n"
589 " \"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i\"))))\n"
590 " (build-system gnu-build-system)\n"
591 " (synopsis \"Hello, GNU world: An example GNU package\")\n"
593 " \"GNU Hello prints the message \\\"Hello, world!\\\" and then exits. It\n"
594 "serves as an example of standard GNU coding practices. As such, it supports\n"
595 "command-line arguments, multiple languages, and so on.\")\n"
596 " (home-page \"https://www.gnu.org/software/hello/\")\n"
597 " (license gpl3+)))\n"
601 #: guix-git/doc/guix-cookbook.texi:395
602 msgid "As you can see, most of it is rather straightforward. But let's review the fields together:"
606 #: guix-git/doc/guix-cookbook.texi:397
612 #: guix-git/doc/guix-cookbook.texi:400
613 msgid "The project name. Using Scheme conventions, we prefer to keep it lower case, without underscore and using dash-separated words."
617 #: guix-git/doc/guix-cookbook.texi:401
623 #: guix-git/doc/guix-cookbook.texi:404
624 msgid "This field contains a description of the source code origin. The @code{origin} record contains these fields:"
628 #: guix-git/doc/guix-cookbook.texi:406
630 msgid "The method, here @code{url-fetch} to download via HTTP/FTP, but other methods"
634 #: guix-git/doc/guix-cookbook.texi:408
635 msgid "exist, such as @code{git-fetch} for Git repositories."
639 #: guix-git/doc/guix-cookbook.texi:408
641 msgid "The URI, which is typically some @code{https://} location for @code{url-fetch}. Here"
645 #: guix-git/doc/guix-cookbook.texi:411
646 msgid "the special `mirror://gnu` refers to a set of well known locations, all of which can be used by Guix to fetch the source, should some of them fail."
650 #: guix-git/doc/guix-cookbook.texi:411
652 msgid "The @code{sha256} checksum of the requested file. This is essential to ensure"
656 #: guix-git/doc/guix-cookbook.texi:414
657 msgid "the source is not corrupted. Note that Guix works with base32 strings, hence the call to the @code{base32} function."
661 #: guix-git/doc/guix-cookbook.texi:416
667 #: guix-git/doc/guix-cookbook.texi:425
668 msgid "This is where the power of abstraction provided by the Scheme language really shines: in this case, the @code{gnu-build-system} abstracts away the famous @code{./configure && make && make install} shell invocations. Other build systems include the @code{trivial-build-system} which does not do anything and requires from the packager to program all the build steps, the @code{python-build-system}, the @code{emacs-build-system}, and many more (@pxref{Build Systems,,, guix, GNU Guix Reference Manual})."
672 #: guix-git/doc/guix-cookbook.texi:426
678 #: guix-git/doc/guix-cookbook.texi:429
679 msgid "It should be a concise summary of what the package does. For many packages a tagline from the project's home page can be used as the synopsis."
683 #: guix-git/doc/guix-cookbook.texi:430
689 #: guix-git/doc/guix-cookbook.texi:433
690 msgid "Same as for the synopsis, it's fine to re-use the project description from the homepage. Note that Guix uses Texinfo syntax."
694 #: guix-git/doc/guix-cookbook.texi:434
700 #: guix-git/doc/guix-cookbook.texi:436
701 msgid "Use HTTPS if available."
705 #: guix-git/doc/guix-cookbook.texi:437
711 #: guix-git/doc/guix-cookbook.texi:440
712 msgid "See @code{guix/licenses.scm} in the project source for a full list of available licenses."
716 #: guix-git/doc/guix-cookbook.texi:444
717 msgid "Time to build our first package! Nothing fancy here for now: we will stick to a dummy @code{my-hello}, a copy of the above declaration."
721 #: guix-git/doc/guix-cookbook.texi:448
722 msgid "As with the ritualistic ``Hello World'' taught with most programming languages, this will possibly be the most ``manual'' approach. We will work out an ideal setup later; for now we will go the simplest route."
726 #: guix-git/doc/guix-cookbook.texi:450
727 msgid "Save the following to a file @file{my-hello.scm}."
731 #: guix-git/doc/guix-cookbook.texi:456
734 "(use-modules (guix packages)\n"
736 " (guix build-system gnu)\n"
737 " (guix licenses))\n"
742 #: guix-git/doc/guix-cookbook.texi:475
746 " (name \"my-hello\")\n"
747 " (version \"2.10\")\n"
749 " (method url-fetch)\n"
750 " (uri (string-append \"mirror://gnu/hello/hello-\" version\n"
754 " \"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i\"))))\n"
755 " (build-system gnu-build-system)\n"
756 " (synopsis \"Hello, Guix world: An example custom Guix package\")\n"
758 " \"GNU Hello prints the message \\\"Hello, world!\\\" and then exits. It\n"
759 "serves as an example of standard GNU coding practices. As such, it supports\n"
760 "command-line arguments, multiple languages, and so on.\")\n"
761 " (home-page \"https://www.gnu.org/software/hello/\")\n"
762 " (license gpl3+))\n"
766 #: guix-git/doc/guix-cookbook.texi:478
767 msgid "We will explain the extra code in a moment."
771 #: guix-git/doc/guix-cookbook.texi:485
772 msgid "Feel free to play with the different values of the various fields. If you change the source, you'll need to update the checksum. Indeed, Guix refuses to build anything if the given checksum does not match the computed checksum of the source code. To obtain the correct checksum of the package declaration, we need to download the source, compute the sha256 checksum and convert it to base32."
776 #: guix-git/doc/guix-cookbook.texi:488
777 msgid "Thankfully, Guix can automate this task for us; all we need is to provide the URI:"
781 #: guix-git/doc/guix-cookbook.texi:492
784 "$ guix download mirror://gnu/hello/hello-2.10.tar.gz\n"
789 #: guix-git/doc/guix-cookbook.texi:499
792 "Starting download of /tmp/guix-file.JLYgL7\n"
793 "From https://ftpmirror.gnu.org/gnu/hello/hello-2.10.tar.gz...\n"
794 "following redirection to `https://mirror.ibcp.fr/pub/gnu/hello/hello-2.10.tar.gz'...\n"
795 " …10.tar.gz 709KiB 2.5MiB/s 00:00 [##################] 100.0%\n"
796 "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz\n"
797 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i\n"
801 #: guix-git/doc/guix-cookbook.texi:504
802 msgid "In this specific case the output tells us which mirror was chosen. If the result of the above command is not the same as in the above snippet, update your @code{my-hello} declaration accordingly."
806 #: guix-git/doc/guix-cookbook.texi:508
807 msgid "Note that GNU package tarballs come with an OpenPGP signature, so you should definitely check the signature of this tarball with `gpg` to authenticate it before going further:"
811 #: guix-git/doc/guix-cookbook.texi:512
814 "$ guix download mirror://gnu/hello/hello-2.10.tar.gz.sig\n"
819 #: guix-git/doc/guix-cookbook.texi:527
822 "Starting download of /tmp/guix-file.03tFfb\n"
823 "From https://ftpmirror.gnu.org/gnu/hello/hello-2.10.tar.gz.sig...\n"
824 "following redirection to `https://ftp.igh.cnrs.fr/pub/gnu/hello/hello-2.10.tar.gz.sig'...\n"
825 " ….tar.gz.sig 819B 1.2MiB/s 00:00 [##################] 100.0%\n"
826 "/gnu/store/rzs8wba9ka7grrmgcpfyxvs58mly0sx6-hello-2.10.tar.gz.sig\n"
827 "0q0v86n3y38z17rl146gdakw9xc4mcscpk8dscs412j22glrv9jf\n"
828 "$ gpg --verify /gnu/store/rzs8wba9ka7grrmgcpfyxvs58mly0sx6-hello-2.10.tar.gz.sig /gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz\n"
829 "gpg: Signature made Sun 16 Nov 2014 01:08:37 PM CET\n"
830 "gpg: using RSA key A9553245FDE9B739\n"
831 "gpg: Good signature from \"Sami Kerola <kerolasa@@iki.fi>\" [unknown]\n"
832 "gpg: aka \"Sami Kerola (http://www.iki.fi/kerolasa/) <kerolasa@@iki.fi>\" [unknown]\n"
833 "gpg: WARNING: This key is not certified with a trusted signature!\n"
834 "gpg: There is no indication that the signature belongs to the owner.\n"
835 "Primary key fingerprint: 8ED3 96E3 7E38 D471 A005 30D3 A955 3245 FDE9 B739\n"
839 #: guix-git/doc/guix-cookbook.texi:530
840 msgid "You can then happily run"
844 #: guix-git/doc/guix-cookbook.texi:534
846 msgid "$ guix package --install-from-file=my-hello.scm\n"
850 #: guix-git/doc/guix-cookbook.texi:537
851 msgid "You should now have @code{my-hello} in your profile!"
855 #: guix-git/doc/guix-cookbook.texi:543
858 "$ guix package --list-installed=my-hello\n"
859 "my-hello\t2.10\tout\n"
860 "/gnu/store/f1db2mfm8syb8qvc357c53slbvf1g9m9-my-hello-2.10\n"
864 #: guix-git/doc/guix-cookbook.texi:548
865 msgid "We've gone as far as we could without any knowledge of Scheme. Before moving on to more complex packages, now is the right time to brush up on your Scheme knowledge. @pxref{A Scheme Crash Course} to get up to speed."
869 #: guix-git/doc/guix-cookbook.texi:549 guix-git/doc/guix-cookbook.texi:550
875 #: guix-git/doc/guix-cookbook.texi:555
876 msgid "In the rest of this chapter we will rely on some basic Scheme programming knowledge. Now let's detail the different possible setups for working on Guix packages."
880 #: guix-git/doc/guix-cookbook.texi:557
881 msgid "There are several ways to set up a Guix packaging environment."
885 #: guix-git/doc/guix-cookbook.texi:560
886 msgid "We recommend you work directly on the Guix source checkout since it makes it easier for everyone to contribute to the project."
890 #: guix-git/doc/guix-cookbook.texi:562
891 msgid "But first, let's look at other possibilities."
894 #. type: subsubsection
895 #: guix-git/doc/guix-cookbook.texi:563 guix-git/doc/guix-cookbook.texi:564
901 #: guix-git/doc/guix-cookbook.texi:569
902 msgid "This is what we previously did with @samp{my-hello}. With the Scheme basics we've covered, we are now able to explain the leading chunks. As stated in @code{guix package --help}:"
906 #: guix-git/doc/guix-cookbook.texi:574
909 " -f, --install-from-file=FILE\n"
910 " install the package that the code within FILE\n"
915 #: guix-git/doc/guix-cookbook.texi:578
916 msgid "Thus the last expression @emph{must} return a package, which is the case in our earlier example."
920 #: guix-git/doc/guix-cookbook.texi:582
921 msgid "The @code{use-modules} expression tells which of the modules we need in the file. Modules are a collection of values and procedures. They are commonly called ``libraries'' or ``packages'' in other programming languages."
925 #: guix-git/doc/guix-cookbook.texi:583
927 msgid "@samp{GUIX_PACKAGE_PATH}"
931 #: guix-git/doc/guix-cookbook.texi:584
933 msgid "GUIX_PACKAGE_PATH"
937 #: guix-git/doc/guix-cookbook.texi:588
938 msgid "Note: Starting from Guix 0.16, the more flexible Guix @dfn{channels} are the preferred way and supersede @samp{GUIX_PACKAGE_PATH}. See next section."
942 #: guix-git/doc/guix-cookbook.texi:592
943 msgid "It can be tedious to specify the file from the command line instead of simply calling @code{guix package --install my-hello} as you would do with the official packages."
947 #: guix-git/doc/guix-cookbook.texi:595
948 msgid "Guix makes it possible to streamline the process by adding as many ``package declaration directories'' as you want."
952 #: guix-git/doc/guix-cookbook.texi:598
953 msgid "Create a directory, say @file{~/guix-packages} and add it to the @samp{GUIX_PACKAGE_PATH} environment variable:"
957 #: guix-git/doc/guix-cookbook.texi:602
960 "$ mkdir ~/guix-packages\n"
961 "$ export GUIX_PACKAGE_PATH=~/guix-packages\n"
965 #: guix-git/doc/guix-cookbook.texi:605
966 msgid "To add several directories, separate them with a colon (@code{:})."
970 #: guix-git/doc/guix-cookbook.texi:607
971 msgid "Our previous @samp{my-hello} needs some adjustments though:"
975 #: guix-git/doc/guix-cookbook.texi:614
978 "(define-module (my-hello)\n"
979 " #:use-module (guix licenses)\n"
980 " #:use-module (guix packages)\n"
981 " #:use-module (guix build-system gnu)\n"
982 " #:use-module (guix download))\n"
987 #: guix-git/doc/guix-cookbook.texi:634
990 "(define-public my-hello\n"
992 " (name \"my-hello\")\n"
993 " (version \"2.10\")\n"
995 " (method url-fetch)\n"
996 " (uri (string-append \"mirror://gnu/hello/hello-\" version\n"
1000 " \"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i\"))))\n"
1001 " (build-system gnu-build-system)\n"
1002 " (synopsis \"Hello, Guix world: An example custom Guix package\")\n"
1004 " \"GNU Hello prints the message \\\"Hello, world!\\\" and then exits. It\n"
1005 "serves as an example of standard GNU coding practices. As such, it supports\n"
1006 "command-line arguments, multiple languages, and so on.\")\n"
1007 " (home-page \"https://www.gnu.org/software/hello/\")\n"
1008 " (license gpl3+)))\n"
1012 #: guix-git/doc/guix-cookbook.texi:640
1013 msgid "Note that we have assigned the package value to an exported variable name with @code{define-public}. This is effectively assigning the package to the @code{my-hello} variable so that it can be referenced, among other as dependency of other packages."
1017 #: guix-git/doc/guix-cookbook.texi:645
1018 msgid "If you use @code{guix package --install-from-file=my-hello.scm} on the above file, it will fail because the last expression, @code{define-public}, does not return a package. If you want to use @code{define-public} in this use-case nonetheless, make sure the file ends with an evaluation of @code{my-hello}:"
1022 #: guix-git/doc/guix-cookbook.texi:651
1026 "(define-public my-hello\n"
1033 #: guix-git/doc/guix-cookbook.texi:653
1039 #: guix-git/doc/guix-cookbook.texi:656
1040 msgid "This last example is not very typical."
1044 #: guix-git/doc/guix-cookbook.texi:659
1045 msgid "Now @samp{my-hello} should be part of the package collection like all other official packages. You can verify this with:"
1049 #: guix-git/doc/guix-cookbook.texi:662
1051 msgid "$ guix package --show=my-hello\n"
1054 #. type: subsubsection
1055 #: guix-git/doc/guix-cookbook.texi:664 guix-git/doc/guix-cookbook.texi:665
1057 msgid "Guix channels"
1061 #: guix-git/doc/guix-cookbook.texi:671
1062 msgid "Guix 0.16 features channels, which is very similar to @samp{GUIX_PACKAGE_PATH} but provides better integration and provenance tracking. Channels are not necessarily local, they can be maintained as a public Git repository for instance. Of course, several channels can be used at the same time."
1066 #: guix-git/doc/guix-cookbook.texi:673
1067 msgid "@xref{Channels,,, guix, GNU Guix Reference Manual} for setup details."
1070 #. type: subsubsection
1071 #: guix-git/doc/guix-cookbook.texi:674 guix-git/doc/guix-cookbook.texi:675
1073 msgid "Direct checkout hacking"
1077 #: guix-git/doc/guix-cookbook.texi:680
1078 msgid "Working directly on the Guix project is recommended: it reduces the friction when the time comes to submit your changes upstream to let the community benefit from your hard work!"
1082 #: guix-git/doc/guix-cookbook.texi:686
1083 msgid "Unlike most software distributions, the Guix repository holds in one place both the tooling (including the package manager) and the package definitions. This choice was made so that it would give developers the flexibility to modify the API without breakage by updating all packages at the same time. This reduces development inertia."
1087 #: guix-git/doc/guix-cookbook.texi:688
1088 msgid "Check out the official @uref{https://git-scm.com/, Git} repository:"
1092 #: guix-git/doc/guix-cookbook.texi:691
1094 msgid "$ git clone https://git.savannah.gnu.org/git/guix.git\n"
1098 #: guix-git/doc/guix-cookbook.texi:695
1099 msgid "In the rest of this article, we use @samp{$GUIX_CHECKOUT} to refer to the location of the checkout."
1103 #: guix-git/doc/guix-cookbook.texi:699
1104 msgid "Follow the instructions in the manual (@pxref{Contributing,,, guix, GNU Guix Reference Manual}) to set up the repository environment."
1108 #: guix-git/doc/guix-cookbook.texi:702
1109 msgid "Once ready, you should be able to use the package definitions from the repository environment."
1113 #: guix-git/doc/guix-cookbook.texi:704
1114 msgid "Feel free to edit package definitions found in @samp{$GUIX_CHECKOUT/gnu/packages}."
1118 #: guix-git/doc/guix-cookbook.texi:708
1119 msgid "The @samp{$GUIX_CHECKOUT/pre-inst-env} script lets you use @samp{guix} over the package collection of the repository (@pxref{Running Guix Before It Is Installed,,, guix, GNU Guix Reference Manual})."
1123 #: guix-git/doc/guix-cookbook.texi:712
1124 msgid "Search packages, such as Ruby:"
1128 #: guix-git/doc/guix-cookbook.texi:719
1131 " $ cd $GUIX_CHECKOUT\n"
1132 " $ ./pre-inst-env guix package --list-available=ruby\n"
1133 " ruby 1.8.7-p374 out gnu/packages/ruby.scm:119:2\n"
1134 " ruby 2.1.6 out gnu/packages/ruby.scm:91:2\n"
1135 " ruby 2.2.2 out gnu/packages/ruby.scm:39:2\n"
1139 #: guix-git/doc/guix-cookbook.texi:723
1140 msgid "Build a package, here Ruby version 2.1:"
1144 #: guix-git/doc/guix-cookbook.texi:727
1147 " $ ./pre-inst-env guix build --keep-failed ruby@@2.1\n"
1148 " /gnu/store/c13v73jxmj2nir2xjqaz5259zywsa9zi-ruby-2.1.6\n"
1152 #: guix-git/doc/guix-cookbook.texi:731
1153 msgid "Install it to your user profile:"
1157 #: guix-git/doc/guix-cookbook.texi:734
1159 msgid " $ ./pre-inst-env guix package --install ruby@@2.1\n"
1163 #: guix-git/doc/guix-cookbook.texi:738
1164 msgid "Check for common mistakes:"
1168 #: guix-git/doc/guix-cookbook.texi:741
1170 msgid " $ ./pre-inst-env guix lint ruby@@2.1\n"
1174 #: guix-git/doc/guix-cookbook.texi:746
1175 msgid "Guix strives at maintaining a high packaging standard; when contributing to the Guix project, remember to"
1179 #: guix-git/doc/guix-cookbook.texi:750
1180 msgid "follow the coding style (@pxref{Coding Style,,, guix, GNU Guix Reference Manual}),"
1184 #: guix-git/doc/guix-cookbook.texi:752
1185 msgid "and review the check list from the manual (@pxref{Submitting Patches,,, guix, GNU Guix Reference Manual})."
1189 #: guix-git/doc/guix-cookbook.texi:756
1190 msgid "Once you are happy with the result, you are welcome to send your contribution to make it part of Guix. This process is also detailed in the manual. (@pxref{Contributing,,, guix, GNU Guix Reference Manual})"
1194 #: guix-git/doc/guix-cookbook.texi:759
1195 msgid "It's a community effort so the more join in, the better Guix becomes!"
1199 #: guix-git/doc/guix-cookbook.texi:760 guix-git/doc/guix-cookbook.texi:761
1201 msgid "Extended example"
1205 #: guix-git/doc/guix-cookbook.texi:766
1206 msgid "The above ``Hello World'' example is as simple as it goes. Packages can be more complex than that and Guix can handle more advanced scenarios. Let's look at another, more sophisticated package (slightly modified from the source):"
1210 #: guix-git/doc/guix-cookbook.texi:780
1213 "(define-module (gnu packages version-control)\n"
1214 " #:use-module ((guix licenses) #:prefix license:)\n"
1215 " #:use-module (guix utils)\n"
1216 " #:use-module (guix packages)\n"
1217 " #:use-module (guix git-download)\n"
1218 " #:use-module (guix build-system cmake)\n"
1219 " #:use-module (gnu packages ssh)\n"
1220 " #:use-module (gnu packages web)\n"
1221 " #:use-module (gnu packages pkg-config)\n"
1222 " #:use-module (gnu packages python)\n"
1223 " #:use-module (gnu packages compression)\n"
1224 " #:use-module (gnu packages tls))\n"
1229 #: guix-git/doc/guix-cookbook.texi:834
1232 "(define-public my-libgit2\n"
1233 " (let ((commit \"e98d0a37c93574d2c6107bf7f31140b548c6a7bf\")\n"
1234 " (revision \"1\"))\n"
1236 " (name \"my-libgit2\")\n"
1237 " (version (git-version \"0.26.6\" revision commit))\n"
1238 " (source (origin\n"
1239 " (method git-fetch)\n"
1240 " (uri (git-reference\n"
1241 " (url \"https://github.com/libgit2/libgit2/\")\n"
1242 " (commit commit)))\n"
1243 " (file-name (git-file-name name version))\n"
1246 " \"17pjvprmdrx4h6bb1hhc98w9qi6ki7yl57f090n9kbhswxqfs7s3\"))\n"
1247 " (patches (search-patches \"libgit2-mtime-0.patch\"))\n"
1248 " (modules '((guix build utils)))\n"
1249 " ;; Remove bundled software.\n"
1250 " (snippet '(delete-file-recursively \"deps\"))))\n"
1251 " (build-system cmake-build-system)\n"
1252 " (outputs '(\"out\" \"debug\"))\n"
1254 " `(#:tests? #true ; Run the test suite (this is the default)\n"
1255 " #:configure-flags '(\"-DUSE_SHA1DC=ON\") ; SHA-1 collision detection\n"
1257 " (modify-phases %standard-phases\n"
1258 " (add-after 'unpack 'fix-hardcoded-paths\n"
1260 " (substitute* \"tests/repo/init.c\"\n"
1261 " ((\"#!/bin/sh\") (string-append \"#!\" (which \"sh\"))))\n"
1262 " (substitute* \"tests/clar/fs.h\"\n"
1263 " ((\"/bin/cp\") (which \"cp\"))\n"
1264 " ((\"/bin/rm\") (which \"rm\")))))\n"
1265 " ;; Run checks more verbosely.\n"
1266 " (replace 'check\n"
1267 " (lambda _ (invoke \"./libgit2_clar\" \"-v\" \"-Q\")))\n"
1268 " (add-after 'unpack 'make-files-writable-for-tests\n"
1269 " (lambda _ (for-each make-file-writable (find-files \".\" \".*\")))))))\n"
1271 " (list libssh2 http-parser python-wrapper))\n"
1273 " (list pkg-config))\n"
1274 " (propagated-inputs\n"
1275 " ;; These two libraries are in 'Requires.private' in libgit2.pc.\n"
1276 " (list openssl zlib))\n"
1277 " (home-page \"https://libgit2.github.com/\")\n"
1278 " (synopsis \"Library providing Git core methods\")\n"
1280 " \"Libgit2 is a portable, pure C implementation of the Git core methods\n"
1281 "provided as a re-entrant linkable library with a solid API, allowing you to\n"
1282 "write native speed custom Git applications in any language with bindings.\")\n"
1283 " ;; GPLv2 with linking exception\n"
1284 " (license license:gpl2))))\n"
1288 #: guix-git/doc/guix-cookbook.texi:839
1289 msgid "(In those cases were you only want to tweak a few fields from a package definition, you should rely on inheritance instead of copy-pasting everything. See below.)"
1293 #: guix-git/doc/guix-cookbook.texi:841
1294 msgid "Let's discuss those fields in depth."
1297 #. type: subsubsection
1298 #: guix-git/doc/guix-cookbook.texi:842
1300 msgid "@code{git-fetch} method"
1304 #: guix-git/doc/guix-cookbook.texi:849
1305 msgid "Unlike the @code{url-fetch} method, @code{git-fetch} expects a @code{git-reference} which takes a Git repository and a commit. The commit can be any Git reference such as tags, so if the @code{version} is tagged, then it can be used directly. Sometimes the tag is prefixed with a @code{v}, in which case you'd use @code{(commit (string-append \"v\" version))}."
1309 #: guix-git/doc/guix-cookbook.texi:853
1310 msgid "To ensure that the source code from the Git repository is stored in a directory with a descriptive name, we use @code{(file-name (git-file-name name version))}."
1314 #: guix-git/doc/guix-cookbook.texi:858
1315 msgid "The @code{git-version} procedure can be used to derive the version when packaging programs for a specific commit, following the Guix contributor guidelines (@pxref{Version Numbers,,, guix, GNU Guix Reference Manual})."
1319 #: guix-git/doc/guix-cookbook.texi:862
1320 msgid "How does one obtain the @code{sha256} hash that's in there, you ask? By invoking @command{guix hash} on a checkout of the desired commit, along these lines:"
1324 #: guix-git/doc/guix-cookbook.texi:868
1327 "git clone https://github.com/libgit2/libgit2/\n"
1329 "git checkout v0.26.6\n"
1334 #: guix-git/doc/guix-cookbook.texi:873
1335 msgid "@command{guix hash -rx} computes a SHA256 hash over the whole directory, excluding the @file{.git} sub-directory (@pxref{Invoking guix hash,,, guix, GNU Guix Reference Manual})."
1339 #: guix-git/doc/guix-cookbook.texi:876
1340 msgid "In the future, @command{guix download} will hopefully be able to do these steps for you, just like it does for regular downloads."
1343 #. type: subsubsection
1344 #: guix-git/doc/guix-cookbook.texi:877
1350 #: guix-git/doc/guix-cookbook.texi:883
1351 msgid "Snippets are quoted (i.e. non-evaluated) Scheme code that are a means of patching the source. They are a Guix-y alternative to the traditional @file{.patch} files. Because of the quote, the code in only evaluated when passed to the Guix daemon for building. There can be as many snippets as needed."
1355 #: guix-git/doc/guix-cookbook.texi:886
1356 msgid "Snippets might need additional Guile modules which can be imported from the @code{modules} field."
1359 #. type: subsubsection
1360 #: guix-git/doc/guix-cookbook.texi:887
1366 #: guix-git/doc/guix-cookbook.texi:890
1367 msgid "There are 3 different input types. In short:"
1371 #: guix-git/doc/guix-cookbook.texi:892
1373 msgid "native-inputs"
1377 #: guix-git/doc/guix-cookbook.texi:895
1378 msgid "Required for building but not runtime -- installing a package through a substitute won't install these inputs."
1382 #: guix-git/doc/guix-cookbook.texi:895
1388 #: guix-git/doc/guix-cookbook.texi:898
1389 msgid "Installed in the store but not in the profile, as well as being present at build time."
1393 #: guix-git/doc/guix-cookbook.texi:898
1395 msgid "propagated-inputs"
1399 #: guix-git/doc/guix-cookbook.texi:901
1400 msgid "Installed in the store and in the profile, as well as being present at build time."
1404 #: guix-git/doc/guix-cookbook.texi:904
1405 msgid "@xref{Package Reference,,, guix, GNU Guix Reference Manual} for more details."
1409 #: guix-git/doc/guix-cookbook.texi:908
1410 msgid "The distinction between the various inputs is important: if a dependency can be handled as an @emph{input} instead of a @emph{propagated input}, it should be done so, or else it ``pollutes'' the user profile for no good reason."
1414 #: guix-git/doc/guix-cookbook.texi:915
1415 msgid "For instance, a user installing a graphical program that depends on a command line tool might only be interested in the graphical part, so there is no need to force the command line tool into the user profile. The dependency is a concern to the package, not to the user. @emph{Inputs} make it possible to handle dependencies without bugging the user by adding undesired executable files (or libraries) to their profile."
1419 #: guix-git/doc/guix-cookbook.texi:921
1420 msgid "Same goes for @emph{native-inputs}: once the program is installed, build-time dependencies can be safely garbage-collected. It also matters when a substitute is available, in which case only the @emph{inputs} and @emph{propagated inputs} will be fetched: the @emph{native inputs} are not required to install a package from a substitute."
1424 #: guix-git/doc/guix-cookbook.texi:922 guix-git/doc/guix-cookbook.texi:1892
1430 #: guix-git/doc/guix-cookbook.texi:925
1431 msgid "You may see here and there snippets where package inputs are written quite differently, like so:"
1435 #: guix-git/doc/guix-cookbook.texi:932
1438 ";; The \"old style\" for inputs.\n"
1440 " `((\"libssh2\" ,libssh2)\n"
1441 " (\"http-parser\" ,http-parser)\n"
1442 " (\"python\" ,python-wrapper)))\n"
1446 #: guix-git/doc/guix-cookbook.texi:938
1447 msgid "This is the ``old style'', where each input in the list is explicitly given a label (a string). It is still supported but we recommend using the style above instead. @xref{package Reference,,, guix, GNU Guix Reference Manual}, for more info."
1450 #. type: subsubsection
1451 #: guix-git/doc/guix-cookbook.texi:940
1457 #: guix-git/doc/guix-cookbook.texi:944
1458 msgid "Just like how a package can have multiple inputs, it can also produce multiple outputs."
1462 #: guix-git/doc/guix-cookbook.texi:946
1463 msgid "Each output corresponds to a separate directory in the store."
1467 #: guix-git/doc/guix-cookbook.texi:949
1468 msgid "The user can choose which output to install; this is useful to save space or to avoid polluting the user profile with unwanted executables or libraries."
1472 #: guix-git/doc/guix-cookbook.texi:952
1473 msgid "Output separation is optional. When the @code{outputs} field is left out, the default and only output (the complete package) is referred to as @code{\"out\"}."
1477 #: guix-git/doc/guix-cookbook.texi:954
1478 msgid "Typical separate output names include @code{debug} and @code{doc}."
1482 #: guix-git/doc/guix-cookbook.texi:958
1483 msgid "It's advised to separate outputs only when you've shown it's worth it: if the output size is significant (compare with @code{guix size}) or in case the package is modular."
1486 #. type: subsubsection
1487 #: guix-git/doc/guix-cookbook.texi:959
1489 msgid "Build system arguments"
1493 #: guix-git/doc/guix-cookbook.texi:962
1494 msgid "The @code{arguments} is a keyword-value list used to configure the build process."
1498 #: guix-git/doc/guix-cookbook.texi:967
1499 msgid "The simplest argument @code{#:tests?} can be used to disable the test suite when building the package. This is mostly useful when the package does not feature any test suite. It's strongly recommended to keep the test suite on if there is one."
1503 #: guix-git/doc/guix-cookbook.texi:971
1504 msgid "Another common argument is @code{:make-flags}, which specifies a list of flags to append when running make, as you would from the command line. For instance, the following flags"
1508 #: guix-git/doc/guix-cookbook.texi:975
1511 "#:make-flags (list (string-append \"prefix=\" (assoc-ref %outputs \"out\"))\n"
1516 #: guix-git/doc/guix-cookbook.texi:978
1517 msgid "translate into"
1521 #: guix-git/doc/guix-cookbook.texi:981
1523 msgid "$ make CC=gcc prefix=/gnu/store/...-<out>\n"
1527 #: guix-git/doc/guix-cookbook.texi:987
1528 msgid "This sets the C compiler to @code{gcc} and the @code{prefix} variable (the installation directory in Make parlance) to @code{(assoc-ref %outputs \"out\")}, which is a build-stage global variable pointing to the destination directory in the store (something like @file{/gnu/store/...-my-libgit2-20180408})."
1532 #: guix-git/doc/guix-cookbook.texi:989
1533 msgid "Similarly, it's possible to set the configure flags:"
1537 #: guix-git/doc/guix-cookbook.texi:992
1539 msgid "#:configure-flags '(\"-DUSE_SHA1DC=ON\")\n"
1543 #: guix-git/doc/guix-cookbook.texi:996
1544 msgid "The @code{%build-inputs} variable is also generated in scope. It's an association table that maps the input names to their store directories."
1548 #: guix-git/doc/guix-cookbook.texi:1001
1549 msgid "The @code{phases} keyword lists the sequential steps of the build system. Typically phases include @code{unpack}, @code{configure}, @code{build}, @code{install} and @code{check}. To know more about those phases, you need to work out the appropriate build system definition in @samp{$GUIX_CHECKOUT/guix/build/gnu-build-system.scm}:"
1553 #: guix-git/doc/guix-cookbook.texi:1020
1556 "(define %standard-phases\n"
1557 " ;; Standard build phases, as a list of symbol/procedure pairs.\n"
1558 " (let-syntax ((phases (syntax-rules ()\n"
1559 " ((_ p ...) `((p . ,p) ...)))))\n"
1560 " (phases set-SOURCE-DATE-EPOCH set-paths install-locale unpack\n"
1562 " patch-usr-bin-file\n"
1563 " patch-source-shebangs configure patch-generated-file-shebangs\n"
1564 " build check install\n"
1565 " patch-shebangs strip\n"
1566 " validate-runpath\n"
1567 " validate-documentation-location\n"
1568 " delete-info-dir-file\n"
1569 " patch-dot-desktop-files\n"
1570 " install-license-files\n"
1571 " reset-gzip-timestamps\n"
1572 " compress-documentation)))\n"
1576 #: guix-git/doc/guix-cookbook.texi:1023
1577 msgid "Or from the REPL:"
1581 #: guix-git/doc/guix-cookbook.texi:1029
1584 "(add-to-load-path \"/path/to/guix/checkout\")\n"
1585 ",use (guix build gnu-build-system)\n"
1586 "(map first %standard-phases)\n"
1587 "@result{} (set-SOURCE-DATE-EPOCH set-paths install-locale unpack bootstrap patch-usr-bin-file patch-source-shebangs configure patch-generated-file-shebangs build check install patch-shebangs strip validate-runpath validate-documentation-location delete-info-dir-file patch-dot-desktop-files install-license-files reset-gzip-timestamps compress-documentation)\n"
1591 #: guix-git/doc/guix-cookbook.texi:1033
1592 msgid "If you want to know more about what happens during those phases, consult the associated procedures."
1596 #: guix-git/doc/guix-cookbook.texi:1036
1597 msgid "For instance, as of this writing the definition of @code{unpack} for the GNU build system is:"
1601 #: guix-git/doc/guix-cookbook.texi:1046
1604 "(define* (unpack #:key source #:allow-other-keys)\n"
1605 " \"Unpack SOURCE in the working directory, and change directory within the\n"
1606 "source. When SOURCE is a directory, copy it in a sub-directory of the current\n"
1607 "working directory.\"\n"
1608 " (if (file-is-directory? source)\n"
1610 " (mkdir \"source\")\n"
1611 " (chdir \"source\")\n"
1616 #: guix-git/doc/guix-cookbook.texi:1057
1619 " ;; Preserve timestamps (set to the Epoch) on the copied tree so that\n"
1620 " ;; things work deterministically.\n"
1621 " (copy-recursively source \".\"\n"
1622 " #:keep-mtime? #true))\n"
1624 " (if (string-suffix? \".zip\" source)\n"
1625 " (invoke \"unzip\" source)\n"
1626 " (invoke \"tar\" \"xvf\" source))\n"
1627 " (chdir (first-subdirectory \".\"))))\n"
1632 #: guix-git/doc/guix-cookbook.texi:1065
1633 msgid "Note the @code{chdir} call: it changes the working directory to where the source was unpacked. Thus every phase following the @code{unpack} will use the source as a working directory, which is why we can directly work on the source files. That is to say, unless a later phase changes the working directory to something else."
1637 #: guix-git/doc/guix-cookbook.texi:1069
1638 msgid "We modify the list of @code{%standard-phases} of the build system with the @code{modify-phases} macro as per the list of specified modifications, which may have the following forms:"
1642 #: guix-git/doc/guix-cookbook.texi:1073
1643 msgid "@code{(add-before @var{phase} @var{new-phase} @var{procedure})}: Run @var{procedure} named @var{new-phase} before @var{phase}."
1647 #: guix-git/doc/guix-cookbook.texi:1075
1648 msgid "@code{(add-after @var{phase} @var{new-phase} @var{procedure})}: Same, but afterwards."
1652 #: guix-git/doc/guix-cookbook.texi:1077
1653 msgid "@code{(replace @var{phase} @var{procedure})}."
1657 #: guix-git/doc/guix-cookbook.texi:1079
1658 msgid "@code{(delete @var{phase})}."
1662 #: guix-git/doc/guix-cookbook.texi:1086
1663 msgid "The @var{procedure} supports the keyword arguments @code{inputs} and @code{outputs}. Each input (whether @emph{native}, @emph{propagated} or not) and output directory is referenced by their name in those variables. Thus @code{(assoc-ref outputs \"out\")} is the store directory of the main output of the package. A phase procedure may look like this:"
1667 #: guix-git/doc/guix-cookbook.texi:1094
1670 "(lambda* (#:key inputs outputs #:allow-other-keys)\n"
1671 " (let ((bash-directory (assoc-ref inputs \"bash\"))\n"
1672 " (output-directory (assoc-ref outputs \"out\"))\n"
1673 " (doc-directory (assoc-ref outputs \"doc\")))\n"
1679 #: guix-git/doc/guix-cookbook.texi:1100
1680 msgid "The procedure must return @code{#true} on success. It's brittle to rely on the return value of the last expression used to tweak the phase because there is no guarantee it would be a @code{#true}. Hence the trailing @code{#true} to ensure the right value is returned on success."
1683 #. type: subsubsection
1684 #: guix-git/doc/guix-cookbook.texi:1101
1686 msgid "Code staging"
1690 #: guix-git/doc/guix-cookbook.texi:1107
1691 msgid "The astute reader may have noticed the quasi-quote and comma syntax in the argument field. Indeed, the build code in the package declaration should not be evaluated on the client side, but only when passed to the Guix daemon. This mechanism of passing code around two running processes is called @uref{https://arxiv.org/abs/1709.00833, code staging}."
1694 #. type: subsubsection
1695 #: guix-git/doc/guix-cookbook.texi:1108
1697 msgid "Utility functions"
1701 #: guix-git/doc/guix-cookbook.texi:1113
1702 msgid "When customizing @code{phases}, we often need to write code that mimics the equivalent system invocations (@code{make}, @code{mkdir}, @code{cp}, etc.)@: commonly used during regular ``Unix-style'' installations."
1706 #: guix-git/doc/guix-cookbook.texi:1116
1707 msgid "Some like @code{chmod} are native to Guile. @xref{,,, guile, Guile reference manual} for a complete list."
1711 #: guix-git/doc/guix-cookbook.texi:1119
1712 msgid "Guix provides additional helper functions which prove especially handy in the context of package management."
1716 #: guix-git/doc/guix-cookbook.texi:1123
1717 msgid "Some of those functions can be found in @samp{$GUIX_CHECKOUT/guix/guix/build/utils.scm}. Most of them mirror the behaviour of the traditional Unix system commands:"
1721 #: guix-git/doc/guix-cookbook.texi:1125
1727 #: guix-git/doc/guix-cookbook.texi:1127
1728 msgid "Like the @samp{which} system command."
1732 #: guix-git/doc/guix-cookbook.texi:1127
1738 #: guix-git/doc/guix-cookbook.texi:1129
1739 msgid "Akin to the @samp{find} system command."
1743 #: guix-git/doc/guix-cookbook.texi:1129
1749 #: guix-git/doc/guix-cookbook.texi:1131
1750 msgid "Like @samp{mkdir -p}, which creates all parents as needed."
1754 #: guix-git/doc/guix-cookbook.texi:1131
1756 msgid "install-file"
1760 #: guix-git/doc/guix-cookbook.texi:1135
1761 msgid "Similar to @samp{install} when installing a file to a (possibly non-existing) directory. Guile has @code{copy-file} which works like @samp{cp}."
1765 #: guix-git/doc/guix-cookbook.texi:1135
1767 msgid "copy-recursively"
1771 #: guix-git/doc/guix-cookbook.texi:1137
1772 msgid "Like @samp{cp -r}."
1776 #: guix-git/doc/guix-cookbook.texi:1137
1778 msgid "delete-file-recursively"
1782 #: guix-git/doc/guix-cookbook.texi:1139
1783 msgid "Like @samp{rm -rf}."
1787 #: guix-git/doc/guix-cookbook.texi:1139
1793 #: guix-git/doc/guix-cookbook.texi:1141
1794 msgid "Run an executable. This should be used instead of @code{system*}."
1798 #: guix-git/doc/guix-cookbook.texi:1141
1800 msgid "with-directory-excursion"
1804 #: guix-git/doc/guix-cookbook.texi:1144
1805 msgid "Run the body in a different working directory, then restore the previous working directory."
1809 #: guix-git/doc/guix-cookbook.texi:1144
1815 #: guix-git/doc/guix-cookbook.texi:1146
1816 msgid "A ``@command{sed}-like'' function."
1820 #: guix-git/doc/guix-cookbook.texi:1150
1821 msgid "@xref{Build Utilities,,, guix, GNU Guix Reference Manual}, for more information on these utilities."
1824 #. type: subsubsection
1825 #: guix-git/doc/guix-cookbook.texi:1151
1827 msgid "Module prefix"
1831 #: guix-git/doc/guix-cookbook.texi:1161
1832 msgid "The license in our last example needs a prefix: this is because of how the @code{license} module was imported in the package, as @code{#:use-module ((guix licenses) #:prefix license:)}. The Guile module import mechanism (@pxref{Using Guile Modules,,, guile, Guile reference manual}) gives the user full control over namespacing: this is needed to avoid clashes between, say, the @samp{zlib} variable from @samp{licenses.scm} (a @emph{license} value) and the @samp{zlib} variable from @samp{compression.scm} (a @emph{package} value)."
1836 #: guix-git/doc/guix-cookbook.texi:1162 guix-git/doc/guix-cookbook.texi:1163
1838 msgid "Other build systems"
1842 #: guix-git/doc/guix-cookbook.texi:1170
1843 msgid "What we've seen so far covers the majority of packages using a build system other than the @code{trivial-build-system}. The latter does not automate anything and leaves you to build everything manually. This can be more demanding and we won't cover it here for now, but thankfully it is rarely necessary to fall back on this system."
1847 #: guix-git/doc/guix-cookbook.texi:1174
1848 msgid "For the other build systems, such as ASDF, Emacs, Perl, Ruby and many more, the process is very similar to the GNU build system except for a few specialized arguments."
1852 #: guix-git/doc/guix-cookbook.texi:1179
1853 msgid "@xref{Build Systems,,, guix, GNU Guix Reference Manual}, for more information on build systems, or check the source code in the @samp{$GUIX_CHECKOUT/guix/build} and @samp{$GUIX_CHECKOUT/guix/build-system} directories."
1857 #: guix-git/doc/guix-cookbook.texi:1180 guix-git/doc/guix-cookbook.texi:1181
1859 msgid "Programmable and automated package definition"
1863 #: guix-git/doc/guix-cookbook.texi:1185
1864 msgid "We can't repeat it enough: having a full-fledged programming language at hand empowers us in ways that reach far beyond traditional package management."
1868 #: guix-git/doc/guix-cookbook.texi:1187
1869 msgid "Let's illustrate this with some awesome features of Guix!"
1872 #. type: subsubsection
1873 #: guix-git/doc/guix-cookbook.texi:1188 guix-git/doc/guix-cookbook.texi:1189
1875 msgid "Recursive importers"
1879 #: guix-git/doc/guix-cookbook.texi:1196
1880 msgid "You might find some build systems good enough that there is little to do at all to write a package, to the point that it becomes repetitive and tedious after a while. A @emph{raison d'être} of computers is to replace human beings at those boring tasks. So let's tell Guix to do this for us and create the package definition of an R package from CRAN (the output is trimmed for conciseness):"
1884 #: guix-git/doc/guix-cookbook.texi:1199
1887 "$ guix import cran --recursive walrus\n"
1892 #: guix-git/doc/guix-cookbook.texi:1203
1895 "(define-public r-mc2d\n"
1897 " (license gpl2+)))\n"
1902 #: guix-git/doc/guix-cookbook.texi:1207
1905 "(define-public r-jmvcore\n"
1907 " (license gpl2+)))\n"
1912 #: guix-git/doc/guix-cookbook.texi:1211
1915 "(define-public r-wrs2\n"
1917 " (license gpl3)))\n"
1922 #: guix-git/doc/guix-cookbook.texi:1237
1925 "(define-public r-walrus\n"
1927 " (name \"r-walrus\")\n"
1928 " (version \"1.0.3\")\n"
1931 " (method url-fetch)\n"
1932 " (uri (cran-uri \"walrus\" version))\n"
1935 " \"1nk2glcvy4hyksl5ipq2mz8jy4fss90hx6cq98m3w96kzjni6jjj\"))))\n"
1936 " (build-system r-build-system)\n"
1937 " (propagated-inputs\n"
1938 " (list r-ggplot2 r-jmvcore r-r6 r-wrs2))\n"
1939 " (home-page \"https://github.com/jamovi/walrus\")\n"
1940 " (synopsis \"Robust Statistical Methods\")\n"
1942 " \"This package provides a toolbox of common robust statistical\n"
1943 "tests, including robust descriptives, robust t-tests, and robust ANOVA.\n"
1944 "It is also available as a module for 'jamovi' (see\n"
1945 "<https://www.jamovi.org> for more information). Walrus is based on the\n"
1946 "WRS2 package by Patrick Mair, which is in turn based on the scripts and\n"
1947 "work of Rand Wilcox. These analyses are described in depth in the book\n"
1948 "'Introduction to Robust Estimation & Hypothesis Testing'.\")\n"
1949 " (license gpl3)))\n"
1953 #: guix-git/doc/guix-cookbook.texi:1241
1954 msgid "The recursive importer won't import packages for which Guix already has package definitions, except for the very first."
1958 #: guix-git/doc/guix-cookbook.texi:1246
1959 msgid "Not all applications can be packaged this way, only those relying on a select number of supported systems. Read about the full list of importers in the guix import section of the manual (@pxref{Invoking guix import,,, guix, GNU Guix Reference Manual})."
1962 #. type: subsubsection
1963 #: guix-git/doc/guix-cookbook.texi:1247 guix-git/doc/guix-cookbook.texi:1248
1965 msgid "Automatic update"
1969 #: guix-git/doc/guix-cookbook.texi:1252
1970 msgid "Guix can be smart enough to check for updates on systems it knows. It can report outdated package definitions with"
1974 #: guix-git/doc/guix-cookbook.texi:1255
1976 msgid "$ guix refresh hello\n"
1980 #: guix-git/doc/guix-cookbook.texi:1260
1981 msgid "In most cases, updating a package to a newer version requires little more than changing the version number and the checksum. Guix can do that automatically as well:"
1985 #: guix-git/doc/guix-cookbook.texi:1263
1987 msgid "$ guix refresh hello --update\n"
1990 #. type: subsubsection
1991 #: guix-git/doc/guix-cookbook.texi:1265 guix-git/doc/guix-cookbook.texi:1266
1997 #: guix-git/doc/guix-cookbook.texi:1270
1998 msgid "If you've started browsing the existing package definitions, you might have noticed that a significant number of them have a @code{inherit} field:"
2002 #: guix-git/doc/guix-cookbook.texi:1285
2005 "(define-public adwaita-icon-theme\n"
2006 " (package (inherit gnome-icon-theme)\n"
2007 " (name \"adwaita-icon-theme\")\n"
2008 " (version \"3.26.1\")\n"
2009 " (source (origin\n"
2010 " (method url-fetch)\n"
2011 " (uri (string-append \"mirror://gnome/sources/\" name \"/\"\n"
2012 " (version-major+minor version) \"/\"\n"
2013 " name \"-\" version \".tar.xz\"))\n"
2016 " \"17fpahgh5dyckgz7rwqvzgnhx53cx9kr2xw0szprc6bnqy977fi8\"))))\n"
2017 " (native-inputs (list `(,gtk+ \"bin\")))))\n"
2021 #: guix-git/doc/guix-cookbook.texi:1290
2022 msgid "All unspecified fields are inherited from the parent package. This is very convenient to create alternative packages, for instance with different source, version or compilation options."
2026 #: guix-git/doc/guix-cookbook.texi:1291 guix-git/doc/guix-cookbook.texi:1292
2028 msgid "Getting help"
2032 #: guix-git/doc/guix-cookbook.texi:1298
2033 msgid "Sadly, some applications can be tough to package. Sometimes they need a patch to work with the non-standard file system hierarchy enforced by the store. Sometimes the tests won't run properly. (They can be skipped but this is not recommended.) Other times the resulting package won't be reproducible."
2037 #: guix-git/doc/guix-cookbook.texi:1301
2038 msgid "Should you be stuck, unable to figure out how to fix any sort of packaging issue, don't hesitate to ask the community for help."
2042 #: guix-git/doc/guix-cookbook.texi:1303
2043 msgid "See the @uref{https://www.gnu.org/software/guix/contact/, Guix homepage} for information on the mailing lists, IRC, etc."
2047 #: guix-git/doc/guix-cookbook.texi:1304 guix-git/doc/guix-cookbook.texi:1305
2053 #: guix-git/doc/guix-cookbook.texi:1311
2054 msgid "This tutorial was a showcase of the sophisticated package management that Guix boasts. At this point we have mostly restricted this introduction to the @code{gnu-build-system} which is a core abstraction layer on which more advanced abstractions are based."
2058 #: guix-git/doc/guix-cookbook.texi:1316
2059 msgid "Where do we go from here? Next we ought to dissect the innards of the build system by removing all abstractions, using the @code{trivial-build-system}: this should give us a thorough understanding of the process before investigating some more advanced packaging techniques and edge cases."
2063 #: guix-git/doc/guix-cookbook.texi:1319
2064 msgid "Other features worth exploring are the interactive editing and debugging capabilities of Guix provided by the Guile REPL@."
2068 #: guix-git/doc/guix-cookbook.texi:1324
2069 msgid "Those fancy features are completely optional and can wait; now is a good time to take a well-deserved break. With what we've introduced here you should be well armed to package lots of programs. You can get started right away and hopefully we will see your contributions soon!"
2073 #: guix-git/doc/guix-cookbook.texi:1325 guix-git/doc/guix-cookbook.texi:1326
2079 #: guix-git/doc/guix-cookbook.texi:1331
2080 msgid "The @uref{https://www.gnu.org/software/guix/manual/en/html_node/Defining-Packages.html, package reference in the manual}"
2084 #: guix-git/doc/guix-cookbook.texi:1334
2085 msgid "@uref{https://gitlab.com/pjotrp/guix-notes/blob/master/HACKING.org, Pjotr’s hacking guide to GNU Guix}"
2089 #: guix-git/doc/guix-cookbook.texi:1337
2090 msgid "@uref{https://www.gnu.org/software/guix/guix-ghm-andreas-20130823.pdf, ``GNU Guix: Package without a scheme!''}, by Andreas Enge"
2094 #: guix-git/doc/guix-cookbook.texi:1346
2095 msgid "Guix offers a flexible language for declaratively configuring your Guix System. This flexibility can at times be overwhelming. The purpose of this chapter is to demonstrate some advanced configuration concepts."
2099 #: guix-git/doc/guix-cookbook.texi:1349
2100 msgid "@pxref{System Configuration,,, guix, GNU Guix Reference Manual} for a complete reference."
2104 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:1645
2105 #: guix-git/doc/guix-cookbook.texi:1646
2107 msgid "Guix System Image API"
2111 #: guix-git/doc/guix-cookbook.texi:1360
2112 msgid "Customizing images to target specific platforms."
2116 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:1856
2117 #: guix-git/doc/guix-cookbook.texi:1857
2119 msgid "Connecting to Wireguard VPN"
2123 #: guix-git/doc/guix-cookbook.texi:1360
2124 msgid "Connecting to a Wireguard VPN."
2128 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:1933
2129 #: guix-git/doc/guix-cookbook.texi:1934
2131 msgid "Customizing a Window Manager"
2135 #: guix-git/doc/guix-cookbook.texi:1360
2136 msgid "Handle customization of a Window manager on Guix System."
2140 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2024
2141 #: guix-git/doc/guix-cookbook.texi:2025
2143 msgid "Running Guix on a Linode Server"
2147 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2267
2148 #: guix-git/doc/guix-cookbook.texi:2268
2150 msgid "Setting up a bind mount"
2154 #: guix-git/doc/guix-cookbook.texi:1360
2155 msgid "Setting up a bind mount in the file-systems definition."
2159 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2316
2160 #: guix-git/doc/guix-cookbook.texi:2317
2162 msgid "Getting substitutes from Tor"
2166 #: guix-git/doc/guix-cookbook.texi:1360
2167 msgid "Configuring Guix daemon to get substitutes through Tor."
2171 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2378
2172 #: guix-git/doc/guix-cookbook.texi:2379
2174 msgid "Setting up NGINX with Lua"
2178 #: guix-git/doc/guix-cookbook.texi:1360
2179 msgid "Configuring NGINX web-server to load Lua modules."
2183 #: guix-git/doc/guix-cookbook.texi:1372
2184 msgid "While the Guix manual explains auto-login one user to @emph{all} TTYs ( @pxref{auto-login to TTY,,, guix, GNU Guix Reference Manual}), some might prefer a situation, in which one user is logged into one TTY with the other TTYs either configured to login different users or no one at all. Note that one can auto-login one user to any TTY, but it is usually advisable to avoid @code{tty1}, which, by default, is used to log warnings and errors."
2188 #: guix-git/doc/guix-cookbook.texi:1374
2189 msgid "Here is how one might set up auto login for one user to one tty:"
2193 #: guix-git/doc/guix-cookbook.texi:1382
2196 "(define (auto-login-to-tty config tty user)\n"
2197 " (if (string=? tty (mingetty-configuration-tty config))\n"
2198 " (mingetty-configuration\n"
2199 " (inherit config)\n"
2200 " (auto-login user))\n"
2206 #: guix-git/doc/guix-cookbook.texi:1389
2209 "(define %my-services\n"
2210 " (modify-services %base-services\n"
2212 " (mingetty-service-type config =>\n"
2213 " (auto-login-to-tty\n"
2214 " config \"tty3\" \"alice\"))))\n"
2219 #: guix-git/doc/guix-cookbook.texi:1393
2222 "(operating-system\n"
2224 " (services %my-services))\n"
2228 #: guix-git/doc/guix-cookbook.texi:1398
2229 msgid "One could also @code{compose} (@pxref{Higher-Order Functions,,, guile, The Guile Reference Manual}) @code{auto-login-to-tty} to login multiple users to multiple ttys."
2233 #: guix-git/doc/guix-cookbook.texi:1405
2234 msgid "Finally, here is a note of caution. Setting up auto login to a TTY, means that anyone can turn on your computer and run commands as your regular user. However, if you have an encrypted root partition, and thus already need to enter a passphrase when the system boots, auto-login might be a convenient option."
2238 #: guix-git/doc/guix-cookbook.texi:1417
2239 msgid "Guix is, at its core, a source based distribution with substitutes (@pxref{Substitutes,,, guix, GNU Guix Reference Manual}), and as such building packages from their source code is an expected part of regular package installations and upgrades. Given this starting point, it makes sense that efforts are made to reduce the amount of time spent compiling packages, and recent changes and upgrades to the building and distribution of substitutes continues to be a topic of discussion within Guix."
2243 #: guix-git/doc/guix-cookbook.texi:1423
2244 msgid "The kernel, while not requiring an overabundance of RAM to build, does take a rather long time on an average machine. The official kernel configuration, as is the case with many GNU/Linux distributions, errs on the side of inclusiveness, and this is really what causes the build to take such a long time when the kernel is built from source."
2248 #: guix-git/doc/guix-cookbook.texi:1428
2249 msgid "The Linux kernel, however, can also just be described as a regular old package, and as such can be customized just like any other package. The procedure is a little bit different, although this is primarily due to the nature of how the package definition is written."
2253 #: guix-git/doc/guix-cookbook.texi:1431
2254 msgid "The @code{linux-libre} kernel package definition is actually a procedure which creates a package."
2258 #: guix-git/doc/guix-cookbook.texi:1442
2261 "(define* (make-linux-libre* version gnu-revision source supported-systems\n"
2263 " (extra-version #f)\n"
2264 " ;; A function that takes an arch and a variant.\n"
2265 " ;; See kernel-config for an example.\n"
2266 " (configuration-file #f)\n"
2267 " (defconfig \"defconfig\")\n"
2268 " (extra-options %default-extra-linux-options))\n"
2273 #: guix-git/doc/guix-cookbook.texi:1446
2274 msgid "The current @code{linux-libre} package is for the 5.15.x series, and is declared like this:"
2278 #: guix-git/doc/guix-cookbook.texi:1454
2281 "(define-public linux-libre-5.15\n"
2282 " (make-linux-libre* linux-libre-5.15-version\n"
2283 " linux-libre-5.15-gnu-revision\n"
2284 " linux-libre-5.15-source\n"
2285 " '(\"x86_64-linux\" \"i686-linux\" \"armhf-linux\" \"aarch64-linux\" \"riscv64-linux\")\n"
2286 " #:configuration-file kernel-config))\n"
2290 #: guix-git/doc/guix-cookbook.texi:1461
2291 msgid "Any keys which are not assigned values inherit their default value from the @code{make-linux-libre} definition. When comparing the two snippets above, notice the code comment that refers to @code{#:configuration-file}. Because of this, it is not actually easy to include a custom kernel configuration from the definition, but don't worry, there are other ways to work with what we do have."
2295 #: guix-git/doc/guix-cookbook.texi:1467
2296 msgid "There are two ways to create a kernel with a custom kernel configuration. The first is to provide a standard @file{.config} file during the build process by including an actual @file{.config} file as a native input to our custom kernel. The following is a snippet from the custom @code{'configure} phase of the @code{make-linux-libre} package definition:"
2300 #: guix-git/doc/guix-cookbook.texi:1471
2303 "(let ((build (assoc-ref %standard-phases 'build))\n"
2304 " (config (assoc-ref (or native-inputs inputs) \"kconfig\")))\n"
2309 #: guix-git/doc/guix-cookbook.texi:1479
2312 " ;; Use a custom kernel configuration file or a default\n"
2313 " ;; configuration file.\n"
2316 " (copy-file config \".config\")\n"
2317 " (chmod \".config\" #o666))\n"
2318 " (invoke \"make\" ,defconfig)))\n"
2322 #: guix-git/doc/guix-cookbook.texi:1484
2323 msgid "Below is a sample kernel package. The @code{linux-libre} package is nothing special and can be inherited from and have its fields overridden like any other package:"
2327 #: guix-git/doc/guix-cookbook.texi:1493
2330 "(define-public linux-libre/E2140\n"
2332 " (inherit linux-libre)\n"
2334 " `((\"kconfig\" ,(local-file \"E2140.config\"))\n"
2335 " ,@@(alist-delete \"kconfig\"\n"
2336 " (package-native-inputs linux-libre))))))\n"
2340 #: guix-git/doc/guix-cookbook.texi:1500
2341 msgid "In the same directory as the file defining @code{linux-libre-E2140} is a file named @file{E2140.config}, which is an actual kernel configuration file. The @code{defconfig} keyword of @code{make-linux-libre} is left blank here, so the only kernel configuration in the package is the one which was included in the @code{native-inputs} field."
2345 #: guix-git/doc/guix-cookbook.texi:1505
2346 msgid "The second way to create a custom kernel is to pass a new value to the @code{extra-options} keyword of the @code{make-linux-libre} procedure. The @code{extra-options} keyword works with another function defined right below it:"
2350 #: guix-git/doc/guix-cookbook.texi:1521
2353 "(define %default-extra-linux-options\n"
2354 " `(;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html\n"
2355 " (\"CONFIG_DEVPTS_MULTIPLE_INSTANCES\" . #true)\n"
2356 " ;; Modules required for initrd:\n"
2357 " (\"CONFIG_NET_9P\" . m)\n"
2358 " (\"CONFIG_NET_9P_VIRTIO\" . m)\n"
2359 " (\"CONFIG_VIRTIO_BLK\" . m)\n"
2360 " (\"CONFIG_VIRTIO_NET\" . m)\n"
2361 " (\"CONFIG_VIRTIO_PCI\" . m)\n"
2362 " (\"CONFIG_VIRTIO_BALLOON\" . m)\n"
2363 " (\"CONFIG_VIRTIO_MMIO\" . m)\n"
2364 " (\"CONFIG_FUSE_FS\" . m)\n"
2365 " (\"CONFIG_CIFS\" . m)\n"
2366 " (\"CONFIG_9P_FS\" . m)))\n"
2371 #: guix-git/doc/guix-cookbook.texi:1532
2374 "(define (config->string options)\n"
2375 " (string-join (map (match-lambda\n"
2377 " (string-append option \"=m\"))\n"
2378 " ((option . #true)\n"
2379 " (string-append option \"=y\"))\n"
2380 " ((option . #false)\n"
2381 " (string-append option \"=n\")))\n"
2387 #: guix-git/doc/guix-cookbook.texi:1535
2388 msgid "And in the custom configure script from the `make-linux-libre` package:"
2392 #: guix-git/doc/guix-cookbook.texi:1543
2395 ";; Appending works even when the option wasn't in the\n"
2396 ";; file. The last one prevails if duplicated.\n"
2397 "(let ((port (open-file \".config\" \"a\"))\n"
2398 " (extra-configuration ,(config->string extra-options)))\n"
2399 " (display extra-configuration port)\n"
2400 " (close-port port))\n"
2405 #: guix-git/doc/guix-cookbook.texi:1545
2407 msgid "(invoke \"make\" \"oldconfig\")\n"
2411 #: guix-git/doc/guix-cookbook.texi:1550
2412 msgid "So by not providing a configuration-file the @file{.config} starts blank, and then we write into it the collection of flags that we want. Here's another custom kernel:"
2416 #: guix-git/doc/guix-cookbook.texi:1558
2419 "(define %macbook41-full-config\n"
2420 " (append %macbook41-config-options\n"
2424 " (@@@@ (gnu packages linux) %default-extra-linux-options)))\n"
2429 #: guix-git/doc/guix-cookbook.texi:1569
2432 "(define-public linux-libre-macbook41\n"
2433 " ;; XXX: Access the internal 'make-linux-libre*' procedure, which is\n"
2434 " ;; private and unexported, and is liable to change in the future.\n"
2435 " ((@@@@ (gnu packages linux) make-linux-libre*)\n"
2436 " (@@@@ (gnu packages linux) linux-libre-version)\n"
2437 " (@@@@ (gnu packages linux) linux-libre-gnu-revision)\n"
2438 " (@@@@ (gnu packages linux) linux-libre-source)\n"
2439 " '(\"x86_64-linux\")\n"
2440 " #:extra-version \"macbook41\"\n"
2441 " #:extra-options %macbook41-config-options))\n"
2445 #: guix-git/doc/guix-cookbook.texi:1576
2446 msgid "In the above example @code{%file-systems} is a collection of flags enabling different file system support, @code{%efi-support} enables EFI support and @code{%emulation} enables a x86_64-linux machine to act in 32-bit mode also. @code{%default-extra-linux-options} are the ones quoted above, which had to be added in since they were replaced in the @code{extra-options} keyword."
2450 #: guix-git/doc/guix-cookbook.texi:1585
2451 msgid "This all sounds like it should be doable, but how does one even know which modules are required for a particular system? Two places that can be helpful in trying to answer this question is the @uref{https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel, Gentoo Handbook} and the @uref{https://www.kernel.org/doc/html/latest/admin-guide/README.html?highlight=localmodconfig, documentation from the kernel itself}. From the kernel documentation, it seems that @code{make localmodconfig} is the command we want."
2455 #: guix-git/doc/guix-cookbook.texi:1588
2456 msgid "In order to actually run @code{make localmodconfig} we first need to get and unpack the kernel source code:"
2460 #: guix-git/doc/guix-cookbook.texi:1591
2462 msgid "tar xf $(guix build linux-libre --source)\n"
2466 #: guix-git/doc/guix-cookbook.texi:1598
2467 msgid "Once inside the directory containing the source code run @code{touch .config} to create an initial, empty @file{.config} to start with. @code{make localmodconfig} works by seeing what you already have in @file{.config} and letting you know what you're missing. If the file is blank then you're missing everything. The next step is to run:"
2471 #: guix-git/doc/guix-cookbook.texi:1601
2473 msgid "guix environment linux-libre -- make localmodconfig\n"
2477 #: guix-git/doc/guix-cookbook.texi:1606
2478 msgid "and note the output. Do note that the @file{.config} file is still empty. The output generally contains two types of warnings. The first start with \"WARNING\" and can actually be ignored in our case. The second read:"
2482 #: guix-git/doc/guix-cookbook.texi:1609
2484 msgid "module pcspkr did not have configs CONFIG_INPUT_PCSPKR\n"
2488 #: guix-git/doc/guix-cookbook.texi:1614
2489 msgid "For each of these lines, copy the @code{CONFIG_XXXX_XXXX} portion into the @file{.config} in the directory, and append @code{=m}, so in the end it looks like this:"
2493 #: guix-git/doc/guix-cookbook.texi:1618
2496 "CONFIG_INPUT_PCSPKR=m\n"
2501 #: guix-git/doc/guix-cookbook.texi:1627
2502 msgid "After copying all the configuration options, run @code{make localmodconfig} again to make sure that you don't have any output starting with ``module''. After all of these machine specific modules there are a couple more left that are also needed. @code{CONFIG_MODULES} is necessary so that you can build and load modules separately and not have everything built into the kernel. @code{CONFIG_BLK_DEV_SD} is required for reading from hard drives. It is possible that there are other modules which you will need."
2506 #: guix-git/doc/guix-cookbook.texi:1631
2507 msgid "This post does not aim to be a guide to configuring your own kernel however, so if you do decide to build a custom kernel you'll have to seek out other guides to create a kernel which is just right for your needs."
2511 #: guix-git/doc/guix-cookbook.texi:1639
2512 msgid "The second way to setup the kernel configuration makes more use of Guix's features and allows you to share configuration segments between different kernels. For example, all machines using EFI to boot have a number of EFI configuration flags that they need. It is likely that all the kernels will share a list of file systems to support. By using variables it is easier to see at a glance what features are enabled and to make sure you don't have features in one kernel but missing in another."
2516 #: guix-git/doc/guix-cookbook.texi:1644
2517 msgid "Left undiscussed however, is Guix's initrd and its customization. It is likely that you'll need to modify the initrd on a machine using a custom kernel, since certain modules which are expected to be built may not be available for inclusion into the initrd."
2521 #: guix-git/doc/guix-cookbook.texi:1651
2522 msgid "Historically, Guix System is centered around an @code{operating-system} structure. This structure contains various fields ranging from the bootloader and kernel declaration to the services to install."
2526 #: guix-git/doc/guix-cookbook.texi:1657
2527 msgid "Depending on the target machine, that can go from a standard @code{x86_64} machine to a small ARM single board computer such as the Pine64, the image constraints can vary a lot. The hardware manufacturers will impose different image formats with various partition sizes and offsets."
2531 #: guix-git/doc/guix-cookbook.texi:1662
2532 msgid "To create images suitable for all those machines, a new abstraction is necessary: that's the goal of the @code{image} record. This record contains all the required information to be transformed into a standalone image, that can be directly booted on any target machine."
2536 #: guix-git/doc/guix-cookbook.texi:1684
2539 "(define-record-type* <image>\n"
2540 " image make-image\n"
2542 " (name image-name ;symbol\n"
2544 " (format image-format) ;symbol\n"
2545 " (target image-target\n"
2547 " (size image-size ;size in bytes as integer\n"
2548 " (default 'guess))\n"
2549 " (operating-system image-operating-system ;<operating-system>\n"
2551 " (partitions image-partitions ;list of <partition>\n"
2553 " (compression? image-compression? ;boolean\n"
2555 " (volatile-root? image-volatile-root? ;boolean\n"
2557 " (substitutable? image-substitutable? ;boolean\n"
2562 #: guix-git/doc/guix-cookbook.texi:1690
2563 msgid "This record contains the operating-system to instantiate. The @code{format} field defines the image type and can be @code{efi-raw}, @code{qcow2} or @code{iso9660} for instance. In the future, it could be extended to @code{docker} or other image types."
2567 #: guix-git/doc/guix-cookbook.texi:1693
2568 msgid "A new directory in the Guix sources is dedicated to images definition. For now there are four files:"
2572 #: guix-git/doc/guix-cookbook.texi:1695
2574 msgid "gnu/system/images/hurd.scm"
2578 #: guix-git/doc/guix-cookbook.texi:1696
2580 msgid "gnu/system/images/pine64.scm"
2584 #: guix-git/doc/guix-cookbook.texi:1697
2586 msgid "gnu/system/images/novena.scm"
2590 #: guix-git/doc/guix-cookbook.texi:1698
2592 msgid "gnu/system/images/pinebook-pro.scm"
2596 #: guix-git/doc/guix-cookbook.texi:1704
2597 msgid "Let's have a look to @file{pine64.scm}. It contains the @code{pine64-barebones-os} variable which is a minimal definition of an operating-system dedicated to the @b{Pine A64 LTS} board."
2601 #: guix-git/doc/guix-cookbook.texi:1728
2604 "(define pine64-barebones-os\n"
2605 " (operating-system\n"
2606 " (host-name \"vignemale\")\n"
2607 " (timezone \"Europe/Paris\")\n"
2608 " (locale \"en_US.utf8\")\n"
2609 " (bootloader (bootloader-configuration\n"
2610 " (bootloader u-boot-pine64-lts-bootloader)\n"
2611 " (targets '(\"/dev/vda\"))))\n"
2612 " (initrd-modules '())\n"
2613 " (kernel linux-libre-arm64-generic)\n"
2614 " (file-systems (cons (file-system\n"
2615 " (device (file-system-label \"my-root\"))\n"
2616 " (mount-point \"/\")\n"
2617 " (type \"ext4\"))\n"
2618 " %base-file-systems))\n"
2619 " (services (cons (service agetty-service-type\n"
2620 " (agetty-configuration\n"
2621 " (extra-options '(\"-L\")) ; no carrier detect\n"
2622 " (baud-rate \"115200\")\n"
2623 " (term \"vt100\")\n"
2624 " (tty \"ttyS0\")))\n"
2625 " %base-services))))\n"
2629 #: guix-git/doc/guix-cookbook.texi:1732
2630 msgid "The @code{kernel} and @code{bootloader} fields are pointing to packages dedicated to this board."
2634 #: guix-git/doc/guix-cookbook.texi:1734
2635 msgid "Right below, the @code{pine64-image-type} variable is also defined."
2639 #: guix-git/doc/guix-cookbook.texi:1740
2642 "(define pine64-image-type\n"
2644 " (name 'pine64-raw)\n"
2645 " (constructor (cut image-with-os arm64-disk-image <>))))\n"
2649 #: guix-git/doc/guix-cookbook.texi:1744
2650 msgid "It's using a record we haven't talked about yet, the @code{image-type} record, defined this way:"
2654 #: guix-git/doc/guix-cookbook.texi:1751
2657 "(define-record-type* <image-type>\n"
2658 " image-type make-image-type\n"
2660 " (name image-type-name) ;symbol\n"
2661 " (constructor image-type-constructor)) ;<operating-system> -> <image>\n"
2665 #: guix-git/doc/guix-cookbook.texi:1757
2666 msgid "The main purpose of this record is to associate a name to a procedure transforming an @code{operating-system} to an image. To understand why it is necessary, let's have a look to the command producing an image from an @code{operating-system} configuration file:"
2670 #: guix-git/doc/guix-cookbook.texi:1760
2672 msgid "guix system image my-os.scm\n"
2676 #: guix-git/doc/guix-cookbook.texi:1766
2677 msgid "This command expects an @code{operating-system} configuration but how should we indicate that we want an image targeting a Pine64 board? We need to provide an extra information, the @code{image-type}, by passing the @code{--image-type} or @code{-t} flag, this way:"
2681 #: guix-git/doc/guix-cookbook.texi:1769
2683 msgid "guix system image --image-type=pine64-raw my-os.scm\n"
2687 #: guix-git/doc/guix-cookbook.texi:1775
2688 msgid "This @code{image-type} parameter points to the @code{pine64-image-type} defined above. Hence, the @code{operating-system} declared in @code{my-os.scm} will be applied the @code{(cut image-with-os arm64-disk-image <>)} procedure to turn it into an image."
2692 #: guix-git/doc/guix-cookbook.texi:1777
2693 msgid "The resulting image looks like:"
2697 #: guix-git/doc/guix-cookbook.texi:1787
2701 " (format 'disk-image)\n"
2702 " (target \"aarch64-linux-gnu\")\n"
2703 " (operating-system my-os)\n"
2705 " (list (partition\n"
2706 " (inherit root-partition)\n"
2707 " (offset root-offset)))))\n"
2711 #: guix-git/doc/guix-cookbook.texi:1791
2712 msgid "which is the aggregation of the @code{operating-system} defined in @code{my-os.scm} to the @code{arm64-disk-image} record."
2716 #: guix-git/doc/guix-cookbook.texi:1793
2717 msgid "But enough Scheme madness. What does this image API bring to the Guix user?"
2721 #: guix-git/doc/guix-cookbook.texi:1795
2722 msgid "One can run:"
2726 #: guix-git/doc/guix-cookbook.texi:1799
2729 "mathieu@@cervin:~$ guix system --list-image-types\n"
2730 "The available image types are:\n"
2735 #: guix-git/doc/guix-cookbook.texi:1811
2738 " - pinebook-pro-raw\n"
2744 " - uncompressed-iso9660\n"
2752 #: guix-git/doc/guix-cookbook.texi:1816
2753 msgid "and by writing an @code{operating-system} file based on @code{pine64-barebones-os}, you can customize your image to your preferences in a file (@file{my-pine-os.scm}) like this:"
2757 #: guix-git/doc/guix-cookbook.texi:1820
2760 "(use-modules (gnu services linux)\n"
2761 " (gnu system images pine64))\n"
2766 #: guix-git/doc/guix-cookbook.texi:1831
2769 "(let ((base-os pine64-barebones-os))\n"
2770 " (operating-system\n"
2771 " (inherit base-os)\n"
2772 " (timezone \"America/Indiana/Indianapolis\")\n"
2775 " (service earlyoom-service-type\n"
2776 " (earlyoom-configuration\n"
2777 " (prefer-regexp \"icecat|chromium\")))\n"
2778 " (operating-system-user-services base-os)))))\n"
2782 #: guix-git/doc/guix-cookbook.texi:1834
2787 #: guix-git/doc/guix-cookbook.texi:1837
2789 msgid "guix system image --image-type=pine64-raw my-pine-os.scm\n"
2793 #: guix-git/doc/guix-cookbook.texi:1840
2798 #: guix-git/doc/guix-cookbook.texi:1843
2800 msgid "guix system image --image-type=hurd-raw my-hurd-os.scm\n"
2804 #: guix-git/doc/guix-cookbook.texi:1847
2805 msgid "to get an image that can be written directly to a hard drive and booted from."
2809 #: guix-git/doc/guix-cookbook.texi:1849
2810 msgid "Without changing anything to @code{my-hurd-os.scm}, calling:"
2814 #: guix-git/doc/guix-cookbook.texi:1852
2816 msgid "guix system image --image-type=hurd-qcow2 my-hurd-os.scm\n"
2820 #: guix-git/doc/guix-cookbook.texi:1855
2821 msgid "will instead produce a Hurd QEMU image."
2825 #: guix-git/doc/guix-cookbook.texi:1862
2826 msgid "To connect to a Wireguard VPN server you need the kernel module to be loaded in memory and a package providing networking tools that support it (e.g. @code{wireguard-tools} or @code{network-manager})."
2830 #: guix-git/doc/guix-cookbook.texi:1866
2831 msgid "Here is a configuration example for Linux-Libre < 5.6, where the module is out of tree and need to be loaded manually---following revisions of the kernel have it built-in and so don't need such configuration:"
2835 #: guix-git/doc/guix-cookbook.texi:1871
2838 "(use-modules (gnu))\n"
2839 "(use-service-modules desktop)\n"
2840 "(use-package-modules vpn)\n"
2845 #: guix-git/doc/guix-cookbook.texi:1880
2848 "(operating-system\n"
2850 " (services (cons (simple-service 'wireguard-module\n"
2851 " kernel-module-loader-service-type\n"
2852 " '(\"wireguard\"))\n"
2853 " %desktop-services))\n"
2854 " (packages (cons wireguard-tools %base-packages))\n"
2855 " (kernel-loadable-modules (list wireguard-linux-compat)))\n"
2859 #: guix-git/doc/guix-cookbook.texi:1884
2860 msgid "After reconfiguring and restarting your system you can either use Wireguard tools or NetworkManager to connect to a VPN server."
2864 #: guix-git/doc/guix-cookbook.texi:1885
2866 msgid "Using Wireguard tools"
2870 #: guix-git/doc/guix-cookbook.texi:1891
2871 msgid "To test your Wireguard setup it is convenient to use @command{wg-quick}. Just give it a configuration file @command{wg-quick up ./wg0.conf}; or put that file in @file{/etc/wireguard} and run @command{wg-quick up wg0} instead."
2875 #: guix-git/doc/guix-cookbook.texi:1895
2876 msgid "Be warned that the author described this command as a: “[…] very quick and dirty bash script […]”."
2880 #: guix-git/doc/guix-cookbook.texi:1897
2882 msgid "Using NetworkManager"
2886 #: guix-git/doc/guix-cookbook.texi:1905
2887 msgid "Thanks to NetworkManager support for Wireguard we can connect to our VPN using @command{nmcli} command. Up to this point this guide assumes that you're using Network Manager service provided by @code{%desktop-services}. Ortherwise you need to adjust your services list to load @code{network-manager-service-type} and reconfigure your Guix system."
2891 #: guix-git/doc/guix-cookbook.texi:1907
2892 msgid "To import your VPN configuration execute nmcli import command:"
2896 #: guix-git/doc/guix-cookbook.texi:1911
2899 "# nmcli connection import type wireguard file wg0.conf\n"
2900 "Connection 'wg0' (edbee261-aa5a-42db-b032-6c7757c60fde) successfully added\n"
2904 #: guix-git/doc/guix-cookbook.texi:1916
2905 msgid "This will create a configuration file in @file{/etc/NetworkManager/wg0.nmconnection}. Next connect to the Wireguard server:"
2909 #: guix-git/doc/guix-cookbook.texi:1920
2912 "$ nmcli connection up wg0\n"
2913 "Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)\n"
2917 #: guix-git/doc/guix-cookbook.texi:1924
2918 msgid "By default NetworkManager will connect automatically on system boot. To change that behaviour you need to edit your config:"
2922 #: guix-git/doc/guix-cookbook.texi:1927
2924 msgid "# nmcli connection modify wg0 connection.autoconnect no\n"
2928 #: guix-git/doc/guix-cookbook.texi:1932
2929 msgid "For more specific information about NetworkManager and wireguard @uref{https://blogs.gnome.org/thaller/2019/03/15/wireguard-in-networkmanager/,see this post by thaller}."
2933 #: guix-git/doc/guix-cookbook.texi:1935
2939 #: guix-git/doc/guix-cookbook.texi:1937 guix-git/doc/guix-cookbook.texi:1938
2945 #: guix-git/doc/guix-cookbook.texi:1939
2951 #: guix-git/doc/guix-cookbook.texi:1944
2952 msgid "You could install StumpWM with a Guix system by adding @code{stumpwm} and optionally @code{`(,stumpwm \"lib\")} packages to a system configuration file, e.g.@: @file{/etc/config.scm}."
2956 #: guix-git/doc/guix-cookbook.texi:1946
2957 msgid "An example configuration can look like this:"
2961 #: guix-git/doc/guix-cookbook.texi:1950
2964 "(use-modules (gnu))\n"
2965 "(use-package-modules wm)\n"
2970 #: guix-git/doc/guix-cookbook.texi:1955
2973 "(operating-system\n"
2975 " (packages (append (list sbcl stumpwm `(,stumpwm \"lib\"))\n"
2976 " %base-packages)))\n"
2980 #: guix-git/doc/guix-cookbook.texi:1957
2982 msgid "stumpwm fonts"
2986 #: guix-git/doc/guix-cookbook.texi:1961
2987 msgid "By default StumpWM uses X11 fonts, which could be small or pixelated on your system. You could fix this by installing StumpWM contrib Lisp module @code{sbcl-ttf-fonts}, adding it to Guix system packages:"
2991 #: guix-git/doc/guix-cookbook.texi:1965
2994 "(use-modules (gnu))\n"
2995 "(use-package-modules fonts wm)\n"
3000 #: guix-git/doc/guix-cookbook.texi:1970
3003 "(operating-system\n"
3005 " (packages (append (list sbcl stumpwm `(,stumpwm \"lib\"))\n"
3006 " sbcl-ttf-fonts font-dejavu %base-packages)))\n"
3010 #: guix-git/doc/guix-cookbook.texi:1974
3011 msgid "Then you need to add the following code to a StumpWM configuration file @file{~/.stumpwm.d/init.lisp}:"
3015 #: guix-git/doc/guix-cookbook.texi:1981
3018 "(require :ttf-fonts)\n"
3019 "(setf xft:*font-dirs* '(\"/run/current-system/profile/share/fonts/\"))\n"
3020 "(setf clx-truetype:+font-cache-filename+ (concat (getenv \"HOME\") \"/.fonts/font-cache.sexp\"))\n"
3021 "(xft:cache-fonts)\n"
3022 "(set-font (make-instance 'xft:font :family \"DejaVu Sans Mono\" :subfamily \"Book\" :size 11))\n"
3026 #: guix-git/doc/guix-cookbook.texi:1983 guix-git/doc/guix-cookbook.texi:1984
3028 msgid "Session lock"
3032 #: guix-git/doc/guix-cookbook.texi:1985
3038 #: guix-git/doc/guix-cookbook.texi:1991
3039 msgid "Depending on your environment, locking the screen of your session might come built in or it might be something you have to set up yourself. If you use a desktop environment like GNOME or KDE, it's usually built in. If you use a plain window manager like StumpWM or EXWM, you might have to set it up yourself."
3042 #. type: subsubsection
3043 #: guix-git/doc/guix-cookbook.texi:1992 guix-git/doc/guix-cookbook.texi:1993
3049 #: guix-git/doc/guix-cookbook.texi:1999
3050 msgid "If you use Xorg, you can use the utility @uref{https://www.mankier.com/1/xss-lock, xss-lock} to lock the screen of your session. xss-lock is triggered by DPMS which since Xorg 1.8 is auto-detected and enabled if ACPI is also enabled at kernel runtime."
3054 #: guix-git/doc/guix-cookbook.texi:2002
3055 msgid "To use xss-lock, you can simple execute it and put it into the background before you start your window manager from e.g. your @file{~/.xsession}:"
3059 #: guix-git/doc/guix-cookbook.texi:2006
3062 "xss-lock -- slock &\n"
3067 #: guix-git/doc/guix-cookbook.texi:2010
3068 msgid "In this example, xss-lock uses @code{slock} to do the actual locking of the screen when it determines it's appropriate, like when you suspend your device."
3072 #: guix-git/doc/guix-cookbook.texi:2014
3073 msgid "For slock to be allowed to be a screen locker for the graphical session, it needs to be made setuid-root so it can authenticate users, and it needs a PAM service. This can be achieved by adding the following service to your @file{config.scm}:"
3077 #: guix-git/doc/guix-cookbook.texi:2017
3079 msgid "(screen-locker-service slock)\n"
3083 #: guix-git/doc/guix-cookbook.texi:2023
3084 msgid "If you manually lock your screen, e.g. by directly calling slock when you want to lock your screen but not suspend it, it's a good idea to notify xss-lock about this so no confusion occurs. This can be done by executing @code{xset s activate} immediately before you execute slock."
3088 #: guix-git/doc/guix-cookbook.texi:2026
3090 msgid "linode, Linode"
3094 #: guix-git/doc/guix-cookbook.texi:2031
3095 msgid "To run Guix on a server hosted by @uref{https://www.linode.com, Linode}, start with a recommended Debian server. We recommend using the default distro as a way to bootstrap Guix. Create your SSH keys."
3099 #: guix-git/doc/guix-cookbook.texi:2034
3101 msgid "ssh-keygen\n"
3105 #: guix-git/doc/guix-cookbook.texi:2040
3106 msgid "Be sure to add your SSH key for easy login to the remote server. This is trivially done via Linode's graphical interface for adding SSH keys. Go to your profile and click add SSH Key. Copy into it the output of:"
3110 #: guix-git/doc/guix-cookbook.texi:2043
3112 msgid "cat ~/.ssh/<username>_rsa.pub\n"
3116 #: guix-git/doc/guix-cookbook.texi:2046
3117 msgid "Power the Linode down."
3121 #: guix-git/doc/guix-cookbook.texi:2050
3122 msgid "In the Linode's Storage tab, resize the Debian disk to be smaller. 30 GB free space is recommended. Then click \"Add a disk\", and fill out the form with the following:"
3126 #: guix-git/doc/guix-cookbook.texi:2054
3127 msgid "Label: \"Guix\""
3131 #: guix-git/doc/guix-cookbook.texi:2057
3132 msgid "Filesystem: ext4"
3136 #: guix-git/doc/guix-cookbook.texi:2060
3137 msgid "Set it to the remaining size"
3141 #: guix-git/doc/guix-cookbook.texi:2065
3142 msgid "In the Configurations tab, press \"Edit\" on the default Debian profile. Under \"Block Device Assignment\" click \"Add a Device\". It should be @file{/dev/sdc} and you can select the \"Guix\" disk. Save Changes."
3146 #: guix-git/doc/guix-cookbook.texi:2067
3147 msgid "Now \"Add a Configuration\", with the following:"
3151 #: guix-git/doc/guix-cookbook.texi:2070
3156 #: guix-git/doc/guix-cookbook.texi:2073
3157 msgid "Kernel:GRUB 2 (it's at the bottom! This step is @b{IMPORTANT!})"
3161 #: guix-git/doc/guix-cookbook.texi:2076
3162 msgid "Block device assignment:"
3166 #: guix-git/doc/guix-cookbook.texi:2079
3167 msgid "@file{/dev/sda}: Guix"
3171 #: guix-git/doc/guix-cookbook.texi:2082
3172 msgid "@file{/dev/sdb}: swap"
3176 #: guix-git/doc/guix-cookbook.texi:2085
3177 msgid "Root device: @file{/dev/sda}"
3181 #: guix-git/doc/guix-cookbook.texi:2088
3182 msgid "Turn off all the filesystem/boot helpers"
3186 #: guix-git/doc/guix-cookbook.texi:2095
3187 msgid "Now power it back up, booting with the Debian configuration. Once it's running, ssh to your server via @code{ssh root@@@var{<your-server-IP-here>}}. (You can find your server IP address in your Linode Summary section.) Now you can run the \"install guix from @pxref{Binary Installation,,, guix, GNU Guix}\" steps:"
3191 #: guix-git/doc/guix-cookbook.texi:2103
3194 "sudo apt-get install gpg\n"
3195 "wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -\n"
3196 "wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh\n"
3197 "chmod +x guix-install.sh\n"
3198 "./guix-install.sh\n"
3203 #: guix-git/doc/guix-cookbook.texi:2107
3204 msgid "Now it's time to write out a config for the server. The key information is below. Save the resulting file as @file{guix-config.scm}."
3208 #: guix-git/doc/guix-cookbook.texi:2118
3211 "(use-modules (gnu)\n"
3212 " (guix modules))\n"
3213 "(use-service-modules networking\n"
3215 "(use-package-modules admin\n"
3217 " package-management\n"
3224 #: guix-git/doc/guix-cookbook.texi:2135
3227 "(operating-system\n"
3228 " (host-name \"my-server\")\n"
3229 " (timezone \"America/New_York\")\n"
3230 " (locale \"en_US.UTF-8\")\n"
3231 " ;; This goofy code will generate the grub.cfg\n"
3232 " ;; without installing the grub bootloader on disk.\n"
3233 " (bootloader (bootloader-configuration\n"
3236 " (inherit grub-bootloader)\n"
3237 " (installer #~(const #true))))))\n"
3238 " (file-systems (cons (file-system\n"
3239 " (device \"/dev/sda\")\n"
3240 " (mount-point \"/\")\n"
3241 " (type \"ext4\"))\n"
3242 " %base-file-systems))\n"
3247 #: guix-git/doc/guix-cookbook.texi:2138
3250 " (swap-devices (list \"/dev/sdb\"))\n"
3255 #: guix-git/doc/guix-cookbook.texi:2142
3258 " (initrd-modules (cons \"virtio_scsi\" ; Needed to find the disk\n"
3259 " %base-initrd-modules))\n"
3264 #: guix-git/doc/guix-cookbook.texi:2151
3267 " (users (cons (user-account\n"
3268 " (name \"janedoe\")\n"
3269 " (group \"users\")\n"
3270 " ;; Adding the account to the \"wheel\" group\n"
3271 " ;; makes it a sudoer.\n"
3272 " (supplementary-groups '(\"wheel\"))\n"
3273 " (home-directory \"/home/janedoe\"))\n"
3274 " %base-user-accounts))\n"
3279 #: guix-git/doc/guix-cookbook.texi:2155
3282 " (packages (cons* nss-certs ;for HTTPS access\n"
3284 " %base-packages))\n"
3289 #: guix-git/doc/guix-cookbook.texi:2166
3292 " (services (cons*\n"
3293 " (service dhcp-client-service-type)\n"
3294 " (service openssh-service-type\n"
3295 " (openssh-configuration\n"
3296 " (openssh openssh-sans-x)\n"
3297 " (password-authentication? #false)\n"
3298 " (authorized-keys\n"
3299 " `((\"janedoe\" ,(local-file \"janedoe_rsa.pub\"))\n"
3300 " (\"root\" ,(local-file \"janedoe_rsa.pub\"))))))\n"
3301 " %base-services)))\n"
3305 #: guix-git/doc/guix-cookbook.texi:2169
3306 msgid "Replace the following fields in the above configuration:"
3310 #: guix-git/doc/guix-cookbook.texi:2177
3313 "(host-name \"my-server\") ; replace with your server name\n"
3314 "; if you chose a linode server outside the U.S., then\n"
3315 "; use tzselect to find a correct timezone string\n"
3316 "(timezone \"America/New_York\") ; if needed replace timezone\n"
3317 "(name \"janedoe\") ; replace with your username\n"
3318 "(\"janedoe\" ,(local-file \"janedoe_rsa.pub\")) ; replace with your ssh key\n"
3319 "(\"root\" ,(local-file \"janedoe_rsa.pub\")) ; replace with your ssh key\n"
3323 #: guix-git/doc/guix-cookbook.texi:2184
3324 msgid "The last line in the above example lets you log into the server as root and set the initial root password (see the note at the end of this recipe about root login). After you have done this, you may delete that line from your configuration and reconfigure to prevent root login."
3328 #: guix-git/doc/guix-cookbook.texi:2189
3329 msgid "Copy your ssh public key (eg: @file{~/.ssh/id_rsa.pub}) as @file{@var{<your-username-here>}_rsa.pub} and put @file{guix-config.scm} in the same directory. In a new terminal run these commands."
3333 #: guix-git/doc/guix-cookbook.texi:2194
3336 "sftp root@@<remote server ip address>\n"
3337 "put /path/to/files/<username>_rsa.pub .\n"
3338 "put /path/to/files/guix-config.scm .\n"
3342 #: guix-git/doc/guix-cookbook.texi:2197
3343 msgid "In your first terminal, mount the guix drive:"
3347 #: guix-git/doc/guix-cookbook.texi:2201
3351 "mount /dev/sdc /mnt/guix\n"
3355 #: guix-git/doc/guix-cookbook.texi:2206
3356 msgid "Due to the way we set up the bootloader section of the guix-config.scm, only the grub configuration file will be installed. So, we need to copy over some of the other GRUB stuff already installed on the Debian system:"
3360 #: guix-git/doc/guix-cookbook.texi:2210
3363 "mkdir -p /mnt/guix/boot/grub\n"
3364 "cp -r /boot/grub/* /mnt/guix/boot/grub/\n"
3368 #: guix-git/doc/guix-cookbook.texi:2213
3369 msgid "Now initialize the Guix installation:"
3373 #: guix-git/doc/guix-cookbook.texi:2216
3375 msgid "guix system init guix-config.scm /mnt/guix\n"
3379 #: guix-git/doc/guix-cookbook.texi:2220
3380 msgid "Ok, power it down! Now from the Linode console, select boot and select \"Guix\"."
3384 #: guix-git/doc/guix-cookbook.texi:2223
3385 msgid "Once it boots, you should be able to log in via SSH! (The server config will have changed though.) You may encounter an error like:"
3389 #: guix-git/doc/guix-cookbook.texi:2239
3392 "$ ssh root@@<server ip address>\n"
3393 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
3394 "@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @\n"
3395 "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"
3396 "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\n"
3397 "Someone could be eavesdropping on you right now (man-in-the-middle attack)!\n"
3398 "It is also possible that a host key has just been changed.\n"
3399 "The fingerprint for the ECDSA key sent by the remote host is\n"
3400 "SHA256:0B+wp33w57AnKQuHCvQP0+ZdKaqYrI/kyU7CfVbS7R4.\n"
3401 "Please contact your system administrator.\n"
3402 "Add correct host key in /home/joshua/.ssh/known_hosts to get rid of this message.\n"
3403 "Offending ECDSA key in /home/joshua/.ssh/known_hosts:3\n"
3404 "ECDSA host key for 198.58.98.76 has changed and you have requested strict checking.\n"
3405 "Host key verification failed.\n"
3409 #: guix-git/doc/guix-cookbook.texi:2243
3410 msgid "Either delete @file{~/.ssh/known_hosts} file, or delete the offending line starting with your server IP address."
3414 #: guix-git/doc/guix-cookbook.texi:2245
3415 msgid "Be sure to set your password and root's password."
3419 #: guix-git/doc/guix-cookbook.texi:2250
3422 "ssh root@@<remote ip address>\n"
3423 "passwd ; for the root password\n"
3424 "passwd <username> ; for the user password\n"
3428 #: guix-git/doc/guix-cookbook.texi:2257
3429 msgid "You may not be able to run the above commands at this point. If you have issues remotely logging into your linode box via SSH, then you may still need to set your root and user password initially by clicking on the ``Launch Console'' option in your linode. Choose the ``Glish'' instead of ``Weblish''. Now you should be able to ssh into the machine."
3433 #: guix-git/doc/guix-cookbook.texi:2261
3434 msgid "Hooray! At this point you can shut down the server, delete the Debian disk, and resize the Guix to the rest of the size. Congratulations!"
3438 #: guix-git/doc/guix-cookbook.texi:2266
3439 msgid "By the way, if you save it as a disk image right at this point, you'll have an easy time spinning up new Guix images! You may need to down-size the Guix image to 6144MB, to save it as an image. Then you can resize it again to the max size."
3443 #: guix-git/doc/guix-cookbook.texi:2275
3444 msgid "To bind mount a file system, one must first set up some definitions before the @code{operating-system} section of the system definition. In this example we will bind mount a folder from a spinning disk drive to @file{/tmp}, to save wear and tear on the primary SSD, without dedicating an entire partition to be mounted as @file{/tmp}."
3448 #: guix-git/doc/guix-cookbook.texi:2278
3449 msgid "First, the source drive that hosts the folder we wish to bind mount should be defined, so that the bind mount can depend on it."
3453 #: guix-git/doc/guix-cookbook.texi:2285
3456 "(define source-drive ;; \"source-drive\" can be named anything you want.\n"
3458 " (device (uuid \"UUID goes here\"))\n"
3459 " (mount-point \"/path-to-spinning-disk-goes-here\")\n"
3460 " (type \"ext4\"))) ;; Make sure to set this to the appropriate type for your drive.\n"
3464 #: guix-git/doc/guix-cookbook.texi:2289
3465 msgid "The source folder must also be defined, so that guix will know it's not a regular block device, but a folder."
3469 #: guix-git/doc/guix-cookbook.texi:2291
3471 msgid "(define (%source-directory) \"/path-to-spinning-disk-goes-here/tmp\") ;; \"source-directory\" can be named any valid variable name.\n"
3475 #: guix-git/doc/guix-cookbook.texi:2295
3476 msgid "Finally, inside the @code{file-systems} definition, we must add the mount itself."
3480 #: guix-git/doc/guix-cookbook.texi:2298
3483 "(file-systems (cons*\n"
3488 #: guix-git/doc/guix-cookbook.texi:2300
3491 " ...<other drives omitted for clarity>...\n"
3496 #: guix-git/doc/guix-cookbook.texi:2302
3499 " source-drive ;; Must match the name you gave the source drive in the earlier definition.\n"
3504 #: guix-git/doc/guix-cookbook.texi:2310
3508 " (device (%source-directory)) ;; Make sure \"source-directory\" matches your earlier definition.\n"
3509 " (mount-point \"/tmp\")\n"
3510 " (type \"none\") ;; We are mounting a folder, not a partition, so this type needs to be \"none\"\n"
3511 " (flags '(bind-mount))\n"
3512 " (dependencies (list source-drive)) ;; Ensure \"source-drive\" matches what you've named the variable for the drive.\n"
3518 #: guix-git/doc/guix-cookbook.texi:2312
3521 " ...<other drives omitted for clarity>...\n"
3526 #: guix-git/doc/guix-cookbook.texi:2314
3532 #: guix-git/doc/guix-cookbook.texi:2321
3533 msgid "Guix daemon can use a HTTP proxy to get substitutes, here we are configuring it to get them via Tor."
3537 #: guix-git/doc/guix-cookbook.texi:2322
3543 #: guix-git/doc/guix-cookbook.texi:2328
3544 msgid "@emph{Not all} Guix daemon's traffic will go through Tor! Only HTTP/HTTPS will get proxied; FTP, Git protocol, SSH, etc connections will still go through the clearnet. Again, this configuration isn't foolproof some of your traffic won't get routed by Tor at all. Use it at your own risk."
3548 #: guix-git/doc/guix-cookbook.texi:2334
3549 msgid "Also note that the procedure described here applies only to package substitution. When you update your guix distribution with @command{guix pull}, you still need to use @command{torsocks} if you want to route the connection to guix's git repository servers through Tor."
3553 #: guix-git/doc/guix-cookbook.texi:2339
3554 msgid "Guix's substitute server is available as a Onion service, if you want to use it to get your substitutes through Tor configure your system as follow:"
3558 #: guix-git/doc/guix-cookbook.texi:2343
3561 "(use-modules (gnu))\n"
3562 "(use-service-module base networking)\n"
3567 #: guix-git/doc/guix-cookbook.texi:2359
3570 "(operating-system\n"
3574 " (service tor-service-type\n"
3575 " (tor-configuration\n"
3576 " (config-file (plain-file \"tor-config\"\n"
3577 " \"HTTPTunnelPort 127.0.0.1:9250\"))))\n"
3578 " (modify-services %base-services\n"
3579 " (guix-service-type\n"
3580 " config => (guix-configuration\n"
3581 " (inherit config)\n"
3582 " ;; ci.guix.gnu.org's Onion service\n"
3583 " (substitute-urls \"https://bp7o7ckwlewr4slm.onion\")\n"
3584 " (http-proxy \"http://localhost:9250\")))))))\n"
3588 #: guix-git/doc/guix-cookbook.texi:2368
3589 msgid "This will keep a tor process running that provides a HTTP CONNECT tunnel which will be used by @command{guix-daemon}. The daemon can use other protocols than HTTP(S) to get remote resources, request using those protocols won't go through Tor since we are only setting a HTTP tunnel here. Note that @code{substitutes-urls} is using HTTPS and not HTTP or it won't work, that's a limitation of Tor's tunnel; you may want to use @command{privoxy} instead to avoid such limitations."
3593 #: guix-git/doc/guix-cookbook.texi:2372
3594 msgid "If you don't want to always get substitutes through Tor but using it just some of the times, then skip the @code{guix-configuration}. When you want to get a substitute from the Tor tunnel run:"
3598 #: guix-git/doc/guix-cookbook.texi:2376
3601 "sudo herd set-http-proxy guix-daemon http://localhost:9250\n"
3602 "guix build --substitute-urls=https://bp7o7ckwlewr4slm.onion …\n"
3606 #: guix-git/doc/guix-cookbook.texi:2380
3608 msgid "nginx, lua, openresty, resty"
3612 #: guix-git/doc/guix-cookbook.texi:2383
3613 msgid "NGINX could be extended with Lua scripts."
3617 #: guix-git/doc/guix-cookbook.texi:2386
3618 msgid "Guix provides NGINX service with ability to load Lua module and specific Lua packages, and reply to requests by evaluating Lua scripts."
3622 #: guix-git/doc/guix-cookbook.texi:2390
3623 msgid "The following example demonstrates system definition with configuration to evaluate @file{index.lua} Lua script on HTTP request to @uref{http://localhost/hello} endpoint:"
3627 #: guix-git/doc/guix-cookbook.texi:2393
3630 "local shell = require \"resty.shell\"\n"
3635 #: guix-git/doc/guix-cookbook.texi:2397
3638 "local stdin = \"\"\n"
3639 "local timeout = 1000 -- ms\n"
3640 "local max_size = 4096 -- byte\n"
3645 #: guix-git/doc/guix-cookbook.texi:2400
3648 "local ok, stdout, stderr, reason, status =\n"
3649 " shell.run([[/run/current-system/profile/bin/ls /tmp]], stdin, timeout, max_size)\n"
3654 #: guix-git/doc/guix-cookbook.texi:2402
3656 msgid "ngx.say(stdout)\n"
3660 #: guix-git/doc/guix-cookbook.texi:2433
3663 "(use-modules (gnu))\n"
3664 "(use-service-modules #;… web)\n"
3665 "(use-package-modules #;… lua)\n"
3666 "(operating-system\n"
3670 " (service nginx-service-type\n"
3671 " (nginx-configuration\n"
3674 " (file-append nginx-lua-module \"/etc/nginx/modules/ngx_http_lua_module.so\")))\n"
3675 " (lua-package-path (list lua-resty-core\n"
3676 " lua-resty-lrucache\n"
3677 " lua-resty-signal\n"
3679 " lua-resty-shell))\n"
3680 " (lua-package-cpath (list lua-resty-signal))\n"
3682 " (list (nginx-server-configuration\n"
3683 " (server-name '(\"localhost\"))\n"
3684 " (listen '(\"80\"))\n"
3685 " (root \"/etc\")\n"
3686 " (locations (list\n"
3687 " (nginx-location-configuration\n"
3688 " (uri \"/hello\")\n"
3689 " (body (list #~(format #f \"content_by_lua_file ~s;\"\n"
3690 " #$(local-file \"index.lua\"))))))))))))))\n"
3694 #: guix-git/doc/guix-cookbook.texi:2444
3695 msgid "Guix is a functional package manager that offers many features beyond what more traditional package managers can do. To the uninitiated, those features might not have obvious use cases at first. The purpose of this chapter is to demonstrate some advanced package management concepts."
3699 #: guix-git/doc/guix-cookbook.texi:2447
3700 msgid "@pxref{Package Management,,, guix, GNU Guix Reference Manual} for a complete reference."
3704 #: guix-git/doc/guix-cookbook.texi:2450 guix-git/doc/guix-cookbook.texi:2452
3705 #: guix-git/doc/guix-cookbook.texi:2453
3707 msgid "Guix Profiles in Practice"
3711 #: guix-git/doc/guix-cookbook.texi:2450
3712 msgid "Strategies for multiple profiles and manifests."
3716 #: guix-git/doc/guix-cookbook.texi:2458
3717 msgid "Guix provides a very useful feature that may be quite foreign to newcomers: @emph{profiles}. They are a way to group package installations together and all users on the same system are free to use as many profiles as they want."
3721 #: guix-git/doc/guix-cookbook.texi:2463
3722 msgid "Whether you're a developer or not, you may find that multiple profiles bring you great power and flexibility. While they shift the paradigm somewhat compared to @emph{traditional package managers}, they are very convenient to use once you've understood how to set them up."
3726 #: guix-git/doc/guix-cookbook.texi:2469
3727 msgid "If you are familiar with Python's @samp{virtualenv}, you can think of a profile as a kind of universal @samp{virtualenv} that can hold any kind of software whatsoever, not just Python software. Furthermore, profiles are self-sufficient: they capture all the runtime dependencies which guarantees that all programs within a profile will always work at any point in time."
3731 #: guix-git/doc/guix-cookbook.texi:2471
3732 msgid "Multiple profiles have many benefits:"
3736 #: guix-git/doc/guix-cookbook.texi:2475
3737 msgid "Clean semantic separation of the various packages a user needs for different contexts."
3741 #: guix-git/doc/guix-cookbook.texi:2479
3742 msgid "Multiple profiles can be made available into the environment either on login or within a dedicated shell."
3746 #: guix-git/doc/guix-cookbook.texi:2483
3747 msgid "Profiles can be loaded on demand. For instance, the user can use multiple shells, each of them running different profiles."
3751 #: guix-git/doc/guix-cookbook.texi:2488
3752 msgid "Isolation: Programs from one profile will not use programs from the other, and the user can even install different versions of the same programs to the two profiles without conflict."
3756 #: guix-git/doc/guix-cookbook.texi:2492
3757 msgid "Deduplication: Profiles share dependencies that happens to be the exact same. This makes multiple profiles storage-efficient."
3761 #: guix-git/doc/guix-cookbook.texi:2500
3762 msgid "Reproducible: when used with declarative manifests, a profile can be fully specified by the Guix commit that was active when it was set up. This means that the exact same profile can be @uref{https://guix.gnu.org/blog/2018/multi-dimensional-transactions-and-rollbacks-oh-my/, set up anywhere and anytime}, with just the commit information. See the section on @ref{Reproducible profiles}."
3766 #: guix-git/doc/guix-cookbook.texi:2504
3767 msgid "Easier upgrades and maintenance: Multiple profiles make it easy to keep package listings at hand and make upgrades completely frictionless."
3771 #: guix-git/doc/guix-cookbook.texi:2507
3772 msgid "Concretely, here follows some typical profiles:"
3776 #: guix-git/doc/guix-cookbook.texi:2511
3777 msgid "The dependencies of a project you are working on."
3781 #: guix-git/doc/guix-cookbook.texi:2514
3782 msgid "Your favourite programming language libraries."
3786 #: guix-git/doc/guix-cookbook.texi:2517
3787 msgid "Laptop-specific programs (like @samp{powertop}) that you don't need on a desktop."
3791 #: guix-git/doc/guix-cookbook.texi:2521
3792 msgid "@TeX{}live (this one can be really useful when you need to install just one package for this one document you've just received over email)."
3796 #: guix-git/doc/guix-cookbook.texi:2524
3801 #: guix-git/doc/guix-cookbook.texi:2527
3802 msgid "Let's dive in the set up!"
3806 #: guix-git/doc/guix-cookbook.texi:2528 guix-git/doc/guix-cookbook.texi:2529
3808 msgid "Basic setup with manifests"
3812 #: guix-git/doc/guix-cookbook.texi:2533
3813 msgid "A Guix profile can be set up @emph{via} a so-called @emph{manifest specification} that looks like this:"
3817 #: guix-git/doc/guix-cookbook.texi:2543
3820 "(specifications->manifest\n"
3821 " '(\"package-1\"\n"
3822 " ;; Version 1.3 of package-2.\n"
3823 " \"package-2@@1.3\"\n"
3824 " ;; The \"lib\" output of package-3.\n"
3825 " \"package-3:lib\"\n"
3827 " \"package-N\"))\n"
3831 #: guix-git/doc/guix-cookbook.texi:2547
3832 msgid "@pxref{Invoking guix package,,, guix, GNU Guix Reference Manual}, for the syntax details."
3836 #: guix-git/doc/guix-cookbook.texi:2549
3837 msgid "We can create a manifest specification per profile and install them this way:"
3841 #: guix-git/doc/guix-cookbook.texi:2554
3844 "GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles\n"
3845 "mkdir -p \"$GUIX_EXTRA_PROFILES\"/my-project # if it does not exist yet\n"
3846 "guix package --manifest=/path/to/guix-my-project-manifest.scm --profile=\"$GUIX_EXTRA_PROFILES\"/my-project/my-project\n"
3850 #: guix-git/doc/guix-cookbook.texi:2558
3851 msgid "Here we set an arbitrary variable @samp{GUIX_EXTRA_PROFILES} to point to the directory where we will store our profiles in the rest of this article."
3855 #: guix-git/doc/guix-cookbook.texi:2564
3856 msgid "Placing all your profiles in a single directory, with each profile getting its own sub-directory, is somewhat cleaner. This way, each sub-directory will contain all the symlinks for precisely one profile. Besides, ``looping over profiles'' becomes obvious from any programming language (e.g.@: a shell script) by simply looping over the sub-directories of @samp{$GUIX_EXTRA_PROFILES}."
3860 #: guix-git/doc/guix-cookbook.texi:2566
3861 msgid "Note that it's also possible to loop over the output of"
3865 #: guix-git/doc/guix-cookbook.texi:2569
3867 msgid "guix package --list-profiles\n"
3871 #: guix-git/doc/guix-cookbook.texi:2572
3872 msgid "although you'll probably have to filter out @file{~/.config/guix/current}."
3876 #: guix-git/doc/guix-cookbook.texi:2574
3877 msgid "To enable all profiles on login, add this to your @file{~/.bash_profile} (or similar):"
3881 #: guix-git/doc/guix-cookbook.texi:2584
3884 "for i in $GUIX_EXTRA_PROFILES/*; do\n"
3885 " profile=$i/$(basename \"$i\")\n"
3886 " if [ -f \"$profile\"/etc/profile ]; then\n"
3887 " GUIX_PROFILE=\"$profile\"\n"
3888 " . \"$GUIX_PROFILE\"/etc/profile\n"
3895 #: guix-git/doc/guix-cookbook.texi:2589
3896 msgid "Note to Guix System users: the above reflects how your default profile @file{~/.guix-profile} is activated from @file{/etc/profile}, that latter being loaded by @file{~/.bashrc} by default."
3900 #: guix-git/doc/guix-cookbook.texi:2591
3901 msgid "You can obviously choose to only enable a subset of them:"
3905 #: guix-git/doc/guix-cookbook.texi:2601
3908 "for i in \"$GUIX_EXTRA_PROFILES\"/my-project-1 \"$GUIX_EXTRA_PROFILES\"/my-project-2; do\n"
3909 " profile=$i/$(basename \"$i\")\n"
3910 " if [ -f \"$profile\"/etc/profile ]; then\n"
3911 " GUIX_PROFILE=\"$profile\"\n"
3912 " . \"$GUIX_PROFILE\"/etc/profile\n"
3919 #: guix-git/doc/guix-cookbook.texi:2605
3920 msgid "When a profile is off, it's straightforward to enable it for an individual shell without \"polluting\" the rest of the user session:"
3924 #: guix-git/doc/guix-cookbook.texi:2608
3926 msgid "GUIX_PROFILE=\"path/to/my-project\" ; . \"$GUIX_PROFILE\"/etc/profile\n"
3930 #: guix-git/doc/guix-cookbook.texi:2615
3931 msgid "The key to enabling a profile is to @emph{source} its @samp{etc/profile} file. This file contains shell code that exports the right environment variables necessary to activate the software contained in the profile. It is built automatically by Guix and meant to be sourced. It contains the same variables you would get if you ran:"
3935 #: guix-git/doc/guix-cookbook.texi:2618
3937 msgid "guix package --search-paths=prefix --profile=$my_profile\"\n"
3941 #: guix-git/doc/guix-cookbook.texi:2622
3942 msgid "Once again, see (@pxref{Invoking guix package,,, guix, GNU Guix Reference Manual}) for the command line options."
3946 #: guix-git/doc/guix-cookbook.texi:2624
3947 msgid "To upgrade a profile, simply install the manifest again:"
3951 #: guix-git/doc/guix-cookbook.texi:2627
3953 msgid "guix package -m /path/to/guix-my-project-manifest.scm -p \"$GUIX_EXTRA_PROFILES\"/my-project/my-project\n"
3957 #: guix-git/doc/guix-cookbook.texi:2633
3958 msgid "To upgrade all profiles, it's easy enough to loop over them. For instance, assuming your manifest specifications are stored in @file{~/.guix-manifests/guix-$profile-manifest.scm}, with @samp{$profile} being the name of the profile (e.g.@: \"project1\"), you could do the following in Bourne shell:"
3962 #: guix-git/doc/guix-cookbook.texi:2638
3965 "for profile in \"$GUIX_EXTRA_PROFILES\"/*; do\n"
3966 " guix package --profile=\"$profile\" --manifest=\"$HOME/.guix-manifests/guix-$profile-manifest.scm\"\n"
3971 #: guix-git/doc/guix-cookbook.texi:2641
3972 msgid "Each profile has its own generations:"
3976 #: guix-git/doc/guix-cookbook.texi:2644
3978 msgid "guix package -p \"$GUIX_EXTRA_PROFILES\"/my-project/my-project --list-generations\n"
3982 #: guix-git/doc/guix-cookbook.texi:2647
3983 msgid "You can roll-back to any generation of a given profile:"
3987 #: guix-git/doc/guix-cookbook.texi:2650
3989 msgid "guix package -p \"$GUIX_EXTRA_PROFILES\"/my-project/my-project --switch-generations=17\n"
3993 #: guix-git/doc/guix-cookbook.texi:2654
3994 msgid "Finally, if you want to switch to a profile without inheriting from the current environment, you can activate it from an empty shell:"
3998 #: guix-git/doc/guix-cookbook.texi:2658
4001 "env -i $(which bash) --login --noprofile --norc\n"
4002 ". my-project/etc/profile\n"
4006 #: guix-git/doc/guix-cookbook.texi:2660 guix-git/doc/guix-cookbook.texi:2661
4008 msgid "Required packages"
4012 #: guix-git/doc/guix-cookbook.texi:2666
4013 msgid "Activating a profile essentially boils down to exporting a bunch of environmental variables. This is the role of the @samp{etc/profile} within the profile."
4017 #: guix-git/doc/guix-cookbook.texi:2669
4018 msgid "Note: Only the environmental variables of the packages that consume them will be set."
4022 #: guix-git/doc/guix-cookbook.texi:2673
4023 msgid "For instance, @samp{MANPATH} won't be set if there is no consumer application for man pages within the profile. So if you need to transparently access man pages once the profile is loaded, you've got two options:"
4027 #: guix-git/doc/guix-cookbook.texi:2677
4028 msgid "Either export the variable manually, e.g."
4032 #: guix-git/doc/guix-cookbook.texi:2679
4034 msgid "export MANPATH=/path/to/profile$@{MANPATH:+:@}$MANPATH\n"
4038 #: guix-git/doc/guix-cookbook.texi:2683
4039 msgid "Or include @samp{man-db} to the profile manifest."
4043 #: guix-git/doc/guix-cookbook.texi:2687
4044 msgid "The same is true for @samp{INFOPATH} (you can install @samp{info-reader}), @samp{PKG_CONFIG_PATH} (install @samp{pkg-config}), etc."
4048 #: guix-git/doc/guix-cookbook.texi:2688 guix-git/doc/guix-cookbook.texi:2689
4050 msgid "Default profile"
4054 #: guix-git/doc/guix-cookbook.texi:2692
4055 msgid "What about the default profile that Guix keeps in @file{~/.guix-profile}?"
4059 #: guix-git/doc/guix-cookbook.texi:2695
4060 msgid "You can assign it the role you want. Typically you would install the manifest of the packages you want to use all the time."
4064 #: guix-git/doc/guix-cookbook.texi:2699
4065 msgid "Alternatively, you could keep it ``manifest-less'' for throw-away packages that you would just use for a couple of days. This way makes it convenient to run"
4069 #: guix-git/doc/guix-cookbook.texi:2703
4072 "guix install package-foo\n"
4073 "guix upgrade package-bar\n"
4077 #: guix-git/doc/guix-cookbook.texi:2706
4078 msgid "without having to specify the path to a profile."
4082 #: guix-git/doc/guix-cookbook.texi:2707 guix-git/doc/guix-cookbook.texi:2708
4084 msgid "The benefits of manifests"
4088 #: guix-git/doc/guix-cookbook.texi:2712
4089 msgid "Manifests are a convenient way to keep your package lists around and, say, to synchronize them across multiple machines using a version control system."
4093 #: guix-git/doc/guix-cookbook.texi:2716
4094 msgid "A common complaint about manifests is that they can be slow to install when they contain large number of packages. This is especially cumbersome when you just want get an upgrade for one package within a big manifest."
4098 #: guix-git/doc/guix-cookbook.texi:2721
4099 msgid "This is one more reason to use multiple profiles, which happen to be just perfect to break down manifests into multiple sets of semantically connected packages. Using multiple, small profiles provides more flexibility and usability."
4103 #: guix-git/doc/guix-cookbook.texi:2723
4104 msgid "Manifests come with multiple benefits. In particular, they ease maintenance:"
4108 #: guix-git/doc/guix-cookbook.texi:2731
4109 msgid "When a profile is set up from a manifest, the manifest itself is self-sufficient to keep a ``package listing'' around and reinstall the profile later or on a different system. For ad-hoc profiles, we would need to generate a manifest specification manually and maintain the package versions for the packages that don't use the default version."
4113 #: guix-git/doc/guix-cookbook.texi:2736
4114 msgid "@code{guix package --upgrade} always tries to update the packages that have propagated inputs, even if there is nothing to do. Guix manifests remove this problem."
4118 #: guix-git/doc/guix-cookbook.texi:2742
4119 msgid "When partially upgrading a profile, conflicts may arise (due to diverging dependencies between the updated and the non-updated packages) and they can be annoying to resolve manually. Manifests remove this problem altogether since all packages are always upgraded at once."
4123 #: guix-git/doc/guix-cookbook.texi:2748
4124 msgid "As mentioned above, manifests allow for reproducible profiles, while the imperative @code{guix install}, @code{guix upgrade}, etc. do not, since they produce different profiles every time even when they hold the same packages. See @uref{https://issues.guix.gnu.org/issue/33285, the related discussion on the matter}."
4128 #: guix-git/doc/guix-cookbook.texi:2756
4129 msgid "Manifest specifications are usable by other @samp{guix} commands. For example, you can run @code{guix weather -m manifest.scm} to see how many substitutes are available, which can help you decide whether you want to try upgrading today or wait a while. Another example: you can run @code{guix pack -m manifest.scm} to create a pack containing all the packages in the manifest (and their transitive references)."
4133 #: guix-git/doc/guix-cookbook.texi:2760
4134 msgid "Finally, manifests have a Scheme representation, the @samp{<manifest>} record type. They can be manipulated in Scheme and passed to the various Guix @uref{https://en.wikipedia.org/wiki/Api, APIs}."
4138 #: guix-git/doc/guix-cookbook.texi:2768
4139 msgid "It's important to understand that while manifests can be used to declare profiles, they are not strictly equivalent: profiles have the side effect that they ``pin'' packages in the store, which prevents them from being garbage-collected (@pxref{Invoking guix gc,,, guix, GNU Guix Reference Manual}) and ensures that they will still be available at any point in the future."
4143 #: guix-git/doc/guix-cookbook.texi:2770
4144 msgid "Let's take an example:"
4148 #: guix-git/doc/guix-cookbook.texi:2776
4149 msgid "We have an environment for hacking on a project for which there isn't a Guix package yet. We build the environment using a manifest, and then run @code{guix environment -m manifest.scm}. So far so good."
4153 #: guix-git/doc/guix-cookbook.texi:2782
4154 msgid "Many weeks pass and we have run a couple of @code{guix pull} in the mean time. Maybe a dependency from our manifest has been updated; or we may have run @code{guix gc} and some packages needed by our manifest have been garbage-collected."
4158 #: guix-git/doc/guix-cookbook.texi:2787
4159 msgid "Eventually, we set to work on that project again, so we run @code{guix environment -m manifest.scm}. But now we have to wait for Guix to build and install stuff!"
4163 #: guix-git/doc/guix-cookbook.texi:2793
4164 msgid "Ideally, we could spare the rebuild time. And indeed we can, all we need is to install the manifest to a profile and use @code{GUIX_PROFILE=/the/profile; . \"$GUIX_PROFILE\"/etc/profile} as explained above: this guarantees that our hacking environment will be available at all times."
4168 #: guix-git/doc/guix-cookbook.texi:2796
4169 msgid "@emph{Security warning:} While keeping old profiles around can be convenient, keep in mind that outdated packages may not have received the latest security fixes."
4173 #: guix-git/doc/guix-cookbook.texi:2797 guix-git/doc/guix-cookbook.texi:2798
4175 msgid "Reproducible profiles"
4179 #: guix-git/doc/guix-cookbook.texi:2801
4180 msgid "To reproduce a profile bit-for-bit, we need two pieces of information:"
4184 #: guix-git/doc/guix-cookbook.texi:2805
4189 #: guix-git/doc/guix-cookbook.texi:2807
4190 msgid "a Guix channel specification."
4194 #: guix-git/doc/guix-cookbook.texi:2811
4195 msgid "Indeed, manifests alone might not be enough: different Guix versions (or different channels) can produce different outputs for a given manifest."
4199 #: guix-git/doc/guix-cookbook.texi:2815
4200 msgid "You can output the Guix channel specification with @samp{guix describe --format=channels}. Save this to a file, say @samp{channel-specs.scm}."
4204 #: guix-git/doc/guix-cookbook.texi:2818
4205 msgid "On another computer, you can use the channel specification file and the manifest to reproduce the exact same profile:"
4209 #: guix-git/doc/guix-cookbook.texi:2822
4212 "GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles\n"
4213 "GUIX_EXTRA=$HOME/.guix-extra\n"
4218 #: guix-git/doc/guix-cookbook.texi:2825
4221 "mkdir \"$GUIX_EXTRA\"/my-project\n"
4222 "guix pull --channels=channel-specs.scm --profile \"$GUIX_EXTRA/my-project/guix\"\n"
4227 #: guix-git/doc/guix-cookbook.texi:2828
4230 "mkdir -p \"$GUIX_EXTRA_PROFILES/my-project\"\n"
4231 "\"$GUIX_EXTRA\"/my-project/guix/bin/guix package --manifest=/path/to/guix-my-project-manifest.scm --profile=\"$GUIX_EXTRA_PROFILES\"/my-project/my-project\n"
4235 #: guix-git/doc/guix-cookbook.texi:2832
4236 msgid "It's safe to delete the Guix channel profile you've just installed with the channel specification, the project profile does not depend on it."
4240 #: guix-git/doc/guix-cookbook.texi:2839
4241 msgid "Guix provides multiple tools to manage environment. This chapter demonstrate such utilities."
4245 #: guix-git/doc/guix-cookbook.texi:2842 guix-git/doc/guix-cookbook.texi:2844
4246 #: guix-git/doc/guix-cookbook.texi:2845
4248 msgid "Guix environment via direnv"
4252 #: guix-git/doc/guix-cookbook.texi:2842
4253 msgid "Setup Guix environment with direnv"
4257 #: guix-git/doc/guix-cookbook.texi:2850
4258 msgid "Guix provides a @samp{direnv} package, which could extend shell after directory change. This tool could be used to prepare a pure Guix environment."
4262 #: guix-git/doc/guix-cookbook.texi:2856
4263 msgid "The following example provides a shell function for @file{~/.direnvrc} file, which could be used from Guix Git repository in @file{~/src/guix/.envrc} file to setup a build environment similar to described in @pxref{Building from Git,,, guix, GNU Guix Reference Manual}."
4267 #: guix-git/doc/guix-cookbook.texi:2858
4268 msgid "Create a @file{~/.direnvrc} with a Bash code:"
4272 #: guix-git/doc/guix-cookbook.texi:2876
4275 "# Thanks <https://github.com/direnv/direnv/issues/73#issuecomment-152284914>\n"
4276 "export_function()\n"
4279 " local alias_dir=$PWD/.direnv/aliases\n"
4280 " mkdir -p \"$alias_dir\"\n"
4281 " PATH_add \"$alias_dir\"\n"
4282 " local target=\"$alias_dir/$name\"\n"
4283 " if declare -f \"$name\" >/dev/null; then\n"
4284 " echo \"#!$SHELL\" > \"$target\"\n"
4285 " declare -f \"$name\" >> \"$target\" 2>/dev/null\n"
4286 " # Notice that we add shell variables to the function trigger.\n"
4287 " echo \"$name \\$*\" >> \"$target\"\n"
4288 " chmod +x \"$target\"\n"
4295 #: guix-git/doc/guix-cookbook.texi:2881
4300 " # Set GitHub token.\n"
4301 " export GUIX_GITHUB_TOKEN=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n"
4306 #: guix-git/doc/guix-cookbook.texi:2884
4309 " # Unset 'GUIX_PACKAGE_PATH'.\n"
4310 " export GUIX_PACKAGE_PATH=\"\"\n"
4315 #: guix-git/doc/guix-cookbook.texi:2893
4318 " # Recreate a garbage collector root.\n"
4319 " gcroots=\"$HOME/.config/guix/gcroots\"\n"
4320 " mkdir -p \"$gcroots\"\n"
4321 " gcroot=\"$gcroots/guix\"\n"
4322 " if [ -L \"$gcroot\" ]\n"
4324 " rm -v \"$gcroot\"\n"
4330 #: guix-git/doc/guix-cookbook.texi:2908
4333 " # Miscellaneous packages.\n"
4334 " PACKAGES_MAINTENANCE=(\n"
4340 " guile-colorized\n"
4351 #: guix-git/doc/guix-cookbook.texi:2911
4354 " # Environment packages.\n"
4355 " PACKAGES=(help2man guile-sqlite3 guile-gcrypt)\n"
4360 #: guix-git/doc/guix-cookbook.texi:2914
4363 " # Thanks <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg00859.html>\n"
4364 " eval \"$(guix environment --search-paths --root=\"$gcroot\" --pure guix --ad-hoc $@{PACKAGES[@@]@} $@{PACKAGES_MAINTENANCE[@@]@} \"$@@\")\"\n"
4369 #: guix-git/doc/guix-cookbook.texi:2921
4372 " # Predefine configure flags.\n"
4375 " ./configure --localstatedir=/var --prefix=\n"
4377 " export_function configure\n"
4382 #: guix-git/doc/guix-cookbook.texi:2932
4385 " # Run make and optionally build something.\n"
4389 " if [ $# -gt 0 ]\n"
4391 " ./pre-inst-env guix build \"$@@\"\n"
4394 " export_function build\n"
4399 #: guix-git/doc/guix-cookbook.texi:2939
4402 " # Predefine push Git command.\n"
4405 " git push --set-upstream origin\n"
4407 " export_function push\n"
4412 #: guix-git/doc/guix-cookbook.texi:2942
4415 " clear # Clean up the screen.\n"
4416 " git-cal --author='Your Name' # Show contributions calendar.\n"
4421 #: guix-git/doc/guix-cookbook.texi:2950
4424 " # Show commands help.\n"
4426 "build build a package or just a project if no argument provided\n"
4427 "configure run ./configure with predefined parameters\n"
4428 "push push to upstream Git repository\n"
4434 #: guix-git/doc/guix-cookbook.texi:2954
4435 msgid "Every project containing @file{.envrc} with a string @code{use guix} will have predefined environment variables and procedures."
4439 #: guix-git/doc/guix-cookbook.texi:2956
4440 msgid "Run @command{direnv allow} to setup the environment for the first time."
4444 #: guix-git/doc/guix-cookbook.texi:2968
4445 msgid "Guix is based on the @uref{https://nixos.org/nix/, Nix package manager}, which was designed and implemented by Eelco Dolstra, with contributions from other people (see the @file{nix/AUTHORS} file in Guix.) Nix pioneered functional package management, and promoted unprecedented features, such as transactional package upgrades and rollbacks, per-user profiles, and referentially transparent build processes. Without this work, Guix would not exist."
4449 #: guix-git/doc/guix-cookbook.texi:2971
4450 msgid "The Nix-based software distributions, Nixpkgs and NixOS, have also been an inspiration for Guix."
4454 #: guix-git/doc/guix-cookbook.texi:2977
4455 msgid "GNU@tie{}Guix itself is a collective work with contributions from a number of people. See the @file{AUTHORS} file in Guix for more information on these fine people. The @file{THANKS} file lists people who have helped by reporting bugs, taking care of the infrastructure, providing artwork and themes, making suggestions, and more---thank you!"
4459 #: guix-git/doc/guix-cookbook.texi:2980
4460 msgid "This document includes adapted sections from articles that have previously been published on the Guix blog at @uref{https://guix.gnu.org/blog}."
4464 #: guix-git/doc/guix-cookbook.texi:2985
4466 msgid "license, GNU Free Documentation License"
4470 #: guix-git/doc/guix-cookbook.texi:2986
4472 msgid "fdl-1.3.texi"