nls: Update translations.
[jackhill/guix/guix.git] / po / doc / guix-cookbook.es.po
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.
6 msgid ""
7 msgstr ""
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"
14 "Language: es\n"
15 "MIME-Version: 1.0\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"
20
21 #. type: Plain text
22 #: guix-git/doc/guix-cookbook.texi:7
23 msgid "@documentencoding UTF-8"
24 msgstr "@documentencoding UTF-8"
25
26 #. type: top
27 #: guix-git/doc/guix-cookbook.texi:7 guix-git/doc/guix-cookbook.texi:36
28 #: guix-git/doc/guix-cookbook.texi:50
29 #, no-wrap
30 msgid "GNU Guix Cookbook"
31 msgstr "Libro de cocina GNU Guix"
32
33 #. type: copying
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@*"
36 msgstr ""
37
38 #. type: copying
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''."
41 msgstr ""
42
43 #. type: dircategory
44 #: guix-git/doc/guix-cookbook.texi:30
45 #, no-wrap
46 msgid "System administration"
47 msgstr ""
48
49 #. type: menuentry
50 #: guix-git/doc/guix-cookbook.texi:33
51 msgid "Guix cookbook: (guix-cookbook)"
52 msgstr ""
53
54 #. type: menuentry
55 #: guix-git/doc/guix-cookbook.texi:33
56 msgid "Tutorials and examples for GNU Guix."
57 msgstr "Tutoriales y ejemplos para GNU Guix."
58
59 #. type: subtitle
60 #: guix-git/doc/guix-cookbook.texi:37
61 #, no-wrap
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"
64
65 #. type: author
66 #: guix-git/doc/guix-cookbook.texi:38
67 #, no-wrap
68 msgid "The GNU Guix Developers"
69 msgstr "Los desarrolladores de GNU Guix"
70
71 #. type: node
72 #: guix-git/doc/guix-cookbook.texi:49
73 #, no-wrap
74 msgid "Top"
75 msgstr "Arriba"
76
77 #. type: Plain text
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."
81
82 #. type: Plain text
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})."
85 msgstr ""
86
87 #. type: chapter
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
90 #, no-wrap
91 msgid "Scheme tutorials"
92 msgstr ""
93
94 #. type: menuentry
95 #: guix-git/doc/guix-cookbook.texi:73
96 msgid "Meet your new favorite language!"
97 msgstr ""
98
99 #. type: chapter
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
102 #, no-wrap
103 msgid "Packaging"
104 msgstr ""
105
106 #. type: menuentry
107 #: guix-git/doc/guix-cookbook.texi:73
108 msgid "Packaging tutorials"
109 msgstr ""
110
111 #. type: chapter
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
114 #, no-wrap
115 msgid "System Configuration"
116 msgstr ""
117
118 #. type: menuentry
119 #: guix-git/doc/guix-cookbook.texi:73
120 msgid "Customizing the GNU System"
121 msgstr ""
122
123 #. type: chapter
124 #: guix-git/doc/guix-cookbook.texi:73 guix-git/doc/guix-cookbook.texi:2436
125 #: guix-git/doc/guix-cookbook.texi:2437
126 #, no-wrap
127 msgid "Advanced package management"
128 msgstr ""
129
130 #. type: menuentry
131 #: guix-git/doc/guix-cookbook.texi:73
132 msgid "Power to the users!"
133 msgstr ""
134
135 #. type: chapter
136 #: guix-git/doc/guix-cookbook.texi:73 guix-git/doc/guix-cookbook.texi:2834
137 #: guix-git/doc/guix-cookbook.texi:2835
138 #, no-wrap
139 msgid "Environment management"
140 msgstr ""
141
142 #. type: menuentry
143 #: guix-git/doc/guix-cookbook.texi:73
144 msgid "Control environment"
145 msgstr ""
146
147 #. type: chapter
148 #: guix-git/doc/guix-cookbook.texi:77 guix-git/doc/guix-cookbook.texi:2958
149 #: guix-git/doc/guix-cookbook.texi:2959
150 #, no-wrap
151 msgid "Acknowledgments"
152 msgstr ""
153
154 #. type: menuentry
155 #: guix-git/doc/guix-cookbook.texi:77
156 msgid "Thanks!"
157 msgstr ""
158
159 #. type: appendix
160 #: guix-git/doc/guix-cookbook.texi:77 guix-git/doc/guix-cookbook.texi:2983
161 #: guix-git/doc/guix-cookbook.texi:2984
162 #, no-wrap
163 msgid "GNU Free Documentation License"
164 msgstr ""
165
166 #. type: menuentry
167 #: guix-git/doc/guix-cookbook.texi:77
168 msgid "The license of this document."
169 msgstr ""
170
171 #. type: unnumbered
172 #: guix-git/doc/guix-cookbook.texi:77 guix-git/doc/guix-cookbook.texi:2989
173 #: guix-git/doc/guix-cookbook.texi:2990
174 #, no-wrap
175 msgid "Concept Index"
176 msgstr ""
177
178 #. type: menuentry
179 #: guix-git/doc/guix-cookbook.texi:77
180 msgid "Concepts."
181 msgstr ""
182
183 #. type: menuentry
184 #: guix-git/doc/guix-cookbook.texi:80
185 msgid "--- The Detailed Node Listing ---"
186 msgstr ""
187
188 #. type: section
189 #: guix-git/doc/guix-cookbook.texi:84 guix-git/doc/guix-cookbook.texi:112
190 #: guix-git/doc/guix-cookbook.texi:113
191 #, no-wrap
192 msgid "A Scheme Crash Course"
193 msgstr ""
194
195 #. type: menuentry
196 #: guix-git/doc/guix-cookbook.texi:84
197 msgid "Learn the basics of Scheme"
198 msgstr ""
199
200 #. type: section
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
203 #, no-wrap
204 msgid "Packaging Tutorial"
205 msgstr ""
206
207 #. type: menuentry
208 #: guix-git/doc/guix-cookbook.texi:88
209 msgid "Let's add a package to Guix!"
210 msgstr ""
211
212 #. type: section
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
215 #, no-wrap
216 msgid "Auto-Login to a Specific TTY"
217 msgstr ""
218
219 #. type: menuentry
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"
222 msgstr ""
223
224 #. type: section
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
227 #, no-wrap
228 msgid "Customizing the Kernel"
229 msgstr ""
230
231 #. type: menuentry
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."
234 msgstr ""
235
236 #. type: Plain text
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."
239 msgstr ""
240
241 #. type: Plain text
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!"
244 msgstr ""
245
246 #. type: Plain text
247 #: guix-git/doc/guix-cookbook.texi:111
248 msgid "Let's get started!"
249 msgstr ""
250
251 #. type: cindex
252 #: guix-git/doc/guix-cookbook.texi:115
253 #, no-wrap
254 msgid "Scheme, crash course"
255 msgstr ""
256
257 #. type: Plain text
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."
260 msgstr ""
261
262 #. type: Plain text
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."
265 msgstr ""
266
267 #. type: Plain text
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."
270 msgstr ""
271
272 #. type: itemize
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."
275 msgstr ""
276
277 #. type: itemize
278 #: guix-git/doc/guix-cookbook.texi:140
279 msgid "Examples of valid expressions:"
280 msgstr ""
281
282 #. type: lisp
283 #: guix-git/doc/guix-cookbook.texi:144
284 #, no-wrap
285 msgid ""
286 "\"Hello World!\"\n"
287 "@result{} \"Hello World!\"\n"
288 "\n"
289 msgstr ""
290
291 #. type: lisp
292 #: guix-git/doc/guix-cookbook.texi:147
293 #, no-wrap
294 msgid ""
295 "17\n"
296 "@result{} 17\n"
297 "\n"
298 msgstr ""
299
300 #. type: lisp
301 #: guix-git/doc/guix-cookbook.texi:151
302 #, no-wrap
303 msgid ""
304 "(display (string-append \"Hello \" \"Guix\" \"\\n\"))\n"
305 "@print{} Hello Guix!\n"
306 "@result{} #<unspecified>\n"
307 msgstr ""
308
309 #. type: itemize
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."
312 msgstr ""
313
314 #. type: itemize
315 #: guix-git/doc/guix-cookbook.texi:161
316 msgid "Anonymous functions are declared with the @code{lambda} term:"
317 msgstr ""
318
319 #. type: lisp
320 #: guix-git/doc/guix-cookbook.texi:165
321 #, no-wrap
322 msgid ""
323 "(lambda (x) (* x x))\n"
324 "@result{} #<procedure 120e348 at <unknown port>:24:0 (x)>\n"
325 msgstr ""
326
327 #. type: itemize
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:"
330 msgstr ""
331
332 #. type: lisp
333 #: guix-git/doc/guix-cookbook.texi:174
334 #, no-wrap
335 msgid ""
336 "((lambda (x) (* x x)) 3)\n"
337 "@result{} 9\n"
338 msgstr ""
339
340 #. type: itemize
341 #: guix-git/doc/guix-cookbook.texi:178
342 msgid "Anything can be assigned a global name with @code{define}:"
343 msgstr ""
344
345 #. type: lisp
346 #: guix-git/doc/guix-cookbook.texi:184
347 #, no-wrap
348 msgid ""
349 "(define a 3)\n"
350 "(define square (lambda (x) (* x x)))\n"
351 "(square a)\n"
352 "@result{} 9\n"
353 msgstr ""
354
355 #. type: itemize
356 #: guix-git/doc/guix-cookbook.texi:188
357 msgid "Procedures can be defined more concisely with the following syntax:"
358 msgstr ""
359
360 #. type: lisp
361 #: guix-git/doc/guix-cookbook.texi:191
362 #, no-wrap
363 msgid "(define (square x) (* x x))\n"
364 msgstr ""
365
366 #. type: itemize
367 #: guix-git/doc/guix-cookbook.texi:195
368 msgid "A list structure can be created with the @code{list} procedure:"
369 msgstr ""
370
371 #. type: lisp
372 #: guix-git/doc/guix-cookbook.texi:199
373 #, no-wrap
374 msgid ""
375 "(list 2 a 5 7)\n"
376 "@result{} (2 3 5 7)\n"
377 msgstr ""
378
379 #. type: itemize
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."
382 msgstr ""
383
384 #. type: lisp
385 #: guix-git/doc/guix-cookbook.texi:210
386 #, no-wrap
387 msgid ""
388 "'(display (string-append \"Hello \" \"Guix\" \"\\n\"))\n"
389 "@result{} (display (string-append \"Hello \" \"Guix\" \"\\n\"))\n"
390 "\n"
391 msgstr ""
392
393 #. type: lisp
394 #: guix-git/doc/guix-cookbook.texi:213
395 #, no-wrap
396 msgid ""
397 "'(2 a 5 7)\n"
398 "@result{} (2 a 5 7)\n"
399 msgstr ""
400
401 #. type: itemize
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."
404 msgstr ""
405
406 #. type: lisp
407 #: guix-git/doc/guix-cookbook.texi:223
408 #, no-wrap
409 msgid ""
410 "`(2 a 5 7 (2 ,a 5 ,(+ a 4)))\n"
411 "@result{} (2 a 5 7 (2 3 5 7))\n"
412 msgstr ""
413
414 #. type: itemize
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."
417 msgstr ""
418
419 #. type: itemize
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}):"
422 msgstr ""
423
424 #. type: lisp
425 #: guix-git/doc/guix-cookbook.texi:238
426 #, no-wrap
427 msgid ""
428 "(define x 10)\n"
429 "(let ((x 2)\n"
430 " (y 3))\n"
431 " (list x y))\n"
432 "@result{} (2 3)\n"
433 "\n"
434 msgstr ""
435
436 #. type: lisp
437 #: guix-git/doc/guix-cookbook.texi:241
438 #, no-wrap
439 msgid ""
440 "x\n"
441 "@result{} 10\n"
442 "\n"
443 msgstr ""
444
445 #. type: lisp
446 #: guix-git/doc/guix-cookbook.texi:244
447 #, no-wrap
448 msgid ""
449 "y\n"
450 "@error{} In procedure module-lookup: Unbound variable: y\n"
451 msgstr ""
452
453 #. type: itemize
454 #: guix-git/doc/guix-cookbook.texi:248
455 msgid "Use @code{let*} to allow later variable declarations to refer to earlier definitions."
456 msgstr ""
457
458 #. type: lisp
459 #: guix-git/doc/guix-cookbook.texi:254
460 #, no-wrap
461 msgid ""
462 "(let* ((x 2)\n"
463 " (y (* x 3)))\n"
464 " (list x y))\n"
465 "@result{} (2 6)\n"
466 msgstr ""
467
468 #. type: itemize
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}."
471 msgstr ""
472
473 #. type: itemize
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."
476 msgstr ""
477
478 #. type: itemize
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"
481 msgstr ""
482
483 #. type: lisp
484 #: guix-git/doc/guix-cookbook.texi:276
485 #, no-wrap
486 msgid ""
487 "(define-module (guix build-system ruby)\n"
488 " #:use-module (guix store)\n"
489 " #:export (ruby-build\n"
490 " ruby-build-system))\n"
491 msgstr ""
492
493 #. type: itemize
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}."
496 msgstr ""
497
498 #. type: Plain text
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."
501 msgstr ""
502
503 #. type: Plain text
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}."
506 msgstr ""
507
508 #. type: Plain text
509 #: guix-git/doc/guix-cookbook.texi:302
510 msgid "You'll find more books, tutorials and other resources at @url{https://schemers.org/}."
511 msgstr ""
512
513 #. type: cindex
514 #: guix-git/doc/guix-cookbook.texi:308
515 #, no-wrap
516 msgid "packaging"
517 msgstr ""
518
519 #. type: Plain text
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."
522 msgstr ""
523
524 #. type: menuentry
525 #: guix-git/doc/guix-cookbook.texi:317
526 msgid "A tutorial on how to add packages to Guix."
527 msgstr ""
528
529 #. type: Plain text
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}."
532 msgstr ""
533
534 #. type: Plain text
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."
537 msgstr ""
538
539 #. type: itemize
540 #: guix-git/doc/guix-cookbook.texi:337
541 msgid "Use functions, structures, macros and all of Scheme expressiveness for your package definitions."
542 msgstr ""
543
544 #. type: itemize
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."
547 msgstr ""
548
549 #. type: itemize
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!"
552 msgstr ""
553
554 #. type: Plain text
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."
557 msgstr ""
558
559 #. type: subsection
560 #: guix-git/doc/guix-cookbook.texi:358 guix-git/doc/guix-cookbook.texi:359
561 #, no-wrap
562 msgid "A ``Hello World'' package"
563 msgstr ""
564
565 #. type: Plain text
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."
568 msgstr ""
569
570 #. type: Plain text
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:"
573 msgstr ""
574
575 #. type: lisp
576 #: guix-git/doc/guix-cookbook.texi:391
577 #, no-wrap
578 msgid ""
579 "(define-public hello\n"
580 " (package\n"
581 " (name \"hello\")\n"
582 " (version \"2.10\")\n"
583 " (source (origin\n"
584 " (method url-fetch)\n"
585 " (uri (string-append \"mirror://gnu/hello/hello-\" version\n"
586 " \".tar.gz\"))\n"
587 " (sha256\n"
588 " (base32\n"
589 " \"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i\"))))\n"
590 " (build-system gnu-build-system)\n"
591 " (synopsis \"Hello, GNU world: An example GNU package\")\n"
592 " (description\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"
598 msgstr ""
599
600 #. type: Plain text
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:"
603 msgstr ""
604
605 #. type: item
606 #: guix-git/doc/guix-cookbook.texi:397
607 #, no-wrap
608 msgid "name"
609 msgstr ""
610
611 #. type: table
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."
614 msgstr ""
615
616 #. type: item
617 #: guix-git/doc/guix-cookbook.texi:401
618 #, no-wrap
619 msgid "source"
620 msgstr ""
621
622 #. type: table
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:"
625 msgstr ""
626
627 #. type: item
628 #: guix-git/doc/guix-cookbook.texi:406
629 #, no-wrap
630 msgid "The method, here @code{url-fetch} to download via HTTP/FTP, but other methods"
631 msgstr ""
632
633 #. type: enumerate
634 #: guix-git/doc/guix-cookbook.texi:408
635 msgid "exist, such as @code{git-fetch} for Git repositories."
636 msgstr ""
637
638 #. type: item
639 #: guix-git/doc/guix-cookbook.texi:408
640 #, no-wrap
641 msgid "The URI, which is typically some @code{https://} location for @code{url-fetch}. Here"
642 msgstr ""
643
644 #. type: enumerate
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."
647 msgstr ""
648
649 #. type: item
650 #: guix-git/doc/guix-cookbook.texi:411
651 #, no-wrap
652 msgid "The @code{sha256} checksum of the requested file. This is essential to ensure"
653 msgstr ""
654
655 #. type: enumerate
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."
658 msgstr ""
659
660 #. type: item
661 #: guix-git/doc/guix-cookbook.texi:416
662 #, no-wrap
663 msgid "build-system"
664 msgstr ""
665
666 #. type: table
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})."
669 msgstr ""
670
671 #. type: item
672 #: guix-git/doc/guix-cookbook.texi:426
673 #, no-wrap
674 msgid "synopsis"
675 msgstr ""
676
677 #. type: table
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."
680 msgstr ""
681
682 #. type: item
683 #: guix-git/doc/guix-cookbook.texi:430
684 #, no-wrap
685 msgid "description"
686 msgstr ""
687
688 #. type: table
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."
691 msgstr ""
692
693 #. type: item
694 #: guix-git/doc/guix-cookbook.texi:434
695 #, no-wrap
696 msgid "home-page"
697 msgstr ""
698
699 #. type: table
700 #: guix-git/doc/guix-cookbook.texi:436
701 msgid "Use HTTPS if available."
702 msgstr ""
703
704 #. type: item
705 #: guix-git/doc/guix-cookbook.texi:437
706 #, no-wrap
707 msgid "license"
708 msgstr ""
709
710 #. type: table
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."
713 msgstr ""
714
715 #. type: Plain text
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."
718 msgstr ""
719
720 #. type: Plain text
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."
723 msgstr ""
724
725 #. type: Plain text
726 #: guix-git/doc/guix-cookbook.texi:450
727 msgid "Save the following to a file @file{my-hello.scm}."
728 msgstr ""
729
730 #. type: lisp
731 #: guix-git/doc/guix-cookbook.texi:456
732 #, no-wrap
733 msgid ""
734 "(use-modules (guix packages)\n"
735 " (guix download)\n"
736 " (guix build-system gnu)\n"
737 " (guix licenses))\n"
738 "\n"
739 msgstr ""
740
741 #. type: lisp
742 #: guix-git/doc/guix-cookbook.texi:475
743 #, no-wrap
744 msgid ""
745 "(package\n"
746 " (name \"my-hello\")\n"
747 " (version \"2.10\")\n"
748 " (source (origin\n"
749 " (method url-fetch)\n"
750 " (uri (string-append \"mirror://gnu/hello/hello-\" version\n"
751 " \".tar.gz\"))\n"
752 " (sha256\n"
753 " (base32\n"
754 " \"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i\"))))\n"
755 " (build-system gnu-build-system)\n"
756 " (synopsis \"Hello, Guix world: An example custom Guix package\")\n"
757 " (description\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"
763 msgstr ""
764
765 #. type: Plain text
766 #: guix-git/doc/guix-cookbook.texi:478
767 msgid "We will explain the extra code in a moment."
768 msgstr ""
769
770 #. type: Plain text
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."
773 msgstr ""
774
775 #. type: Plain text
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:"
778 msgstr ""
779
780 #. type: example
781 #: guix-git/doc/guix-cookbook.texi:492
782 #, no-wrap
783 msgid ""
784 "$ guix download mirror://gnu/hello/hello-2.10.tar.gz\n"
785 "\n"
786 msgstr ""
787
788 #. type: example
789 #: guix-git/doc/guix-cookbook.texi:499
790 #, no-wrap
791 msgid ""
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"
798 msgstr ""
799
800 #. type: Plain text
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."
803 msgstr ""
804
805 #. type: Plain text
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:"
808 msgstr ""
809
810 #. type: example
811 #: guix-git/doc/guix-cookbook.texi:512
812 #, no-wrap
813 msgid ""
814 "$ guix download mirror://gnu/hello/hello-2.10.tar.gz.sig\n"
815 "\n"
816 msgstr ""
817
818 #. type: example
819 #: guix-git/doc/guix-cookbook.texi:527
820 #, no-wrap
821 msgid ""
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"
836 msgstr ""
837
838 #. type: Plain text
839 #: guix-git/doc/guix-cookbook.texi:530
840 msgid "You can then happily run"
841 msgstr ""
842
843 #. type: example
844 #: guix-git/doc/guix-cookbook.texi:534
845 #, no-wrap
846 msgid "$ guix package --install-from-file=my-hello.scm\n"
847 msgstr ""
848
849 #. type: Plain text
850 #: guix-git/doc/guix-cookbook.texi:537
851 msgid "You should now have @code{my-hello} in your profile!"
852 msgstr ""
853
854 #. type: example
855 #: guix-git/doc/guix-cookbook.texi:543
856 #, no-wrap
857 msgid ""
858 "$ guix package --list-installed=my-hello\n"
859 "my-hello\t2.10\tout\n"
860 "/gnu/store/f1db2mfm8syb8qvc357c53slbvf1g9m9-my-hello-2.10\n"
861 msgstr ""
862
863 #. type: Plain text
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."
866 msgstr ""
867
868 #. type: subsection
869 #: guix-git/doc/guix-cookbook.texi:549 guix-git/doc/guix-cookbook.texi:550
870 #, no-wrap
871 msgid "Setup"
872 msgstr ""
873
874 #. type: Plain text
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."
877 msgstr ""
878
879 #. type: Plain text
880 #: guix-git/doc/guix-cookbook.texi:557
881 msgid "There are several ways to set up a Guix packaging environment."
882 msgstr ""
883
884 #. type: Plain text
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."
887 msgstr ""
888
889 #. type: Plain text
890 #: guix-git/doc/guix-cookbook.texi:562
891 msgid "But first, let's look at other possibilities."
892 msgstr ""
893
894 #. type: subsubsection
895 #: guix-git/doc/guix-cookbook.texi:563 guix-git/doc/guix-cookbook.texi:564
896 #, no-wrap
897 msgid "Local file"
898 msgstr ""
899
900 #. type: Plain text
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}:"
903 msgstr ""
904
905 #. type: example
906 #: guix-git/doc/guix-cookbook.texi:574
907 #, no-wrap
908 msgid ""
909 " -f, --install-from-file=FILE\n"
910 " install the package that the code within FILE\n"
911 " evaluates to\n"
912 msgstr ""
913
914 #. type: Plain text
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."
917 msgstr ""
918
919 #. type: Plain text
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."
922 msgstr ""
923
924 #. type: node
925 #: guix-git/doc/guix-cookbook.texi:583
926 #, no-wrap
927 msgid "@samp{GUIX_PACKAGE_PATH}"
928 msgstr ""
929
930 #. type: samp{#1}
931 #: guix-git/doc/guix-cookbook.texi:584
932 #, no-wrap
933 msgid "GUIX_PACKAGE_PATH"
934 msgstr ""
935
936 #. type: emph{#1}
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."
939 msgstr ""
940
941 #. type: Plain text
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."
944 msgstr ""
945
946 #. type: Plain text
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."
949 msgstr ""
950
951 #. type: Plain text
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:"
954 msgstr ""
955
956 #. type: example
957 #: guix-git/doc/guix-cookbook.texi:602
958 #, no-wrap
959 msgid ""
960 "$ mkdir ~/guix-packages\n"
961 "$ export GUIX_PACKAGE_PATH=~/guix-packages\n"
962 msgstr ""
963
964 #. type: Plain text
965 #: guix-git/doc/guix-cookbook.texi:605
966 msgid "To add several directories, separate them with a colon (@code{:})."
967 msgstr ""
968
969 #. type: Plain text
970 #: guix-git/doc/guix-cookbook.texi:607
971 msgid "Our previous @samp{my-hello} needs some adjustments though:"
972 msgstr ""
973
974 #. type: lisp
975 #: guix-git/doc/guix-cookbook.texi:614
976 #, no-wrap
977 msgid ""
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"
983 "\n"
984 msgstr ""
985
986 #. type: lisp
987 #: guix-git/doc/guix-cookbook.texi:634
988 #, no-wrap
989 msgid ""
990 "(define-public my-hello\n"
991 " (package\n"
992 " (name \"my-hello\")\n"
993 " (version \"2.10\")\n"
994 " (source (origin\n"
995 " (method url-fetch)\n"
996 " (uri (string-append \"mirror://gnu/hello/hello-\" version\n"
997 " \".tar.gz\"))\n"
998 " (sha256\n"
999 " (base32\n"
1000 " \"0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i\"))))\n"
1001 " (build-system gnu-build-system)\n"
1002 " (synopsis \"Hello, Guix world: An example custom Guix package\")\n"
1003 " (description\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"
1009 msgstr ""
1010
1011 #. type: Plain text
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."
1014 msgstr ""
1015
1016 #. type: Plain text
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}:"
1019 msgstr ""
1020
1021 #. type: lisp
1022 #: guix-git/doc/guix-cookbook.texi:651
1023 #, no-wrap
1024 msgid ""
1025 "; ...\n"
1026 "(define-public my-hello\n"
1027 " ; ...\n"
1028 " )\n"
1029 "\n"
1030 msgstr ""
1031
1032 #. type: lisp
1033 #: guix-git/doc/guix-cookbook.texi:653
1034 #, no-wrap
1035 msgid "my-hello\n"
1036 msgstr ""
1037
1038 #. type: Plain text
1039 #: guix-git/doc/guix-cookbook.texi:656
1040 msgid "This last example is not very typical."
1041 msgstr ""
1042
1043 #. type: Plain text
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:"
1046 msgstr ""
1047
1048 #. type: example
1049 #: guix-git/doc/guix-cookbook.texi:662
1050 #, no-wrap
1051 msgid "$ guix package --show=my-hello\n"
1052 msgstr ""
1053
1054 #. type: subsubsection
1055 #: guix-git/doc/guix-cookbook.texi:664 guix-git/doc/guix-cookbook.texi:665
1056 #, no-wrap
1057 msgid "Guix channels"
1058 msgstr ""
1059
1060 #. type: Plain text
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."
1063 msgstr ""
1064
1065 #. type: Plain text
1066 #: guix-git/doc/guix-cookbook.texi:673
1067 msgid "@xref{Channels,,, guix, GNU Guix Reference Manual} for setup details."
1068 msgstr ""
1069
1070 #. type: subsubsection
1071 #: guix-git/doc/guix-cookbook.texi:674 guix-git/doc/guix-cookbook.texi:675
1072 #, no-wrap
1073 msgid "Direct checkout hacking"
1074 msgstr ""
1075
1076 #. type: Plain text
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!"
1079 msgstr ""
1080
1081 #. type: Plain text
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."
1084 msgstr ""
1085
1086 #. type: Plain text
1087 #: guix-git/doc/guix-cookbook.texi:688
1088 msgid "Check out the official @uref{https://git-scm.com/, Git} repository:"
1089 msgstr ""
1090
1091 #. type: example
1092 #: guix-git/doc/guix-cookbook.texi:691
1093 #, no-wrap
1094 msgid "$ git clone https://git.savannah.gnu.org/git/guix.git\n"
1095 msgstr ""
1096
1097 #. type: Plain text
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."
1100 msgstr ""
1101
1102 #. type: Plain text
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."
1105 msgstr ""
1106
1107 #. type: Plain text
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."
1110 msgstr ""
1111
1112 #. type: Plain text
1113 #: guix-git/doc/guix-cookbook.texi:704
1114 msgid "Feel free to edit package definitions found in @samp{$GUIX_CHECKOUT/gnu/packages}."
1115 msgstr ""
1116
1117 #. type: Plain text
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})."
1120 msgstr ""
1121
1122 #. type: itemize
1123 #: guix-git/doc/guix-cookbook.texi:712
1124 msgid "Search packages, such as Ruby:"
1125 msgstr ""
1126
1127 #. type: example
1128 #: guix-git/doc/guix-cookbook.texi:719
1129 #, no-wrap
1130 msgid ""
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"
1136 msgstr ""
1137
1138 #. type: itemize
1139 #: guix-git/doc/guix-cookbook.texi:723
1140 msgid "Build a package, here Ruby version 2.1:"
1141 msgstr ""
1142
1143 #. type: example
1144 #: guix-git/doc/guix-cookbook.texi:727
1145 #, no-wrap
1146 msgid ""
1147 " $ ./pre-inst-env guix build --keep-failed ruby@@2.1\n"
1148 " /gnu/store/c13v73jxmj2nir2xjqaz5259zywsa9zi-ruby-2.1.6\n"
1149 msgstr ""
1150
1151 #. type: itemize
1152 #: guix-git/doc/guix-cookbook.texi:731
1153 msgid "Install it to your user profile:"
1154 msgstr ""
1155
1156 #. type: example
1157 #: guix-git/doc/guix-cookbook.texi:734
1158 #, no-wrap
1159 msgid " $ ./pre-inst-env guix package --install ruby@@2.1\n"
1160 msgstr ""
1161
1162 #. type: itemize
1163 #: guix-git/doc/guix-cookbook.texi:738
1164 msgid "Check for common mistakes:"
1165 msgstr ""
1166
1167 #. type: example
1168 #: guix-git/doc/guix-cookbook.texi:741
1169 #, no-wrap
1170 msgid " $ ./pre-inst-env guix lint ruby@@2.1\n"
1171 msgstr ""
1172
1173 #. type: Plain text
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"
1176 msgstr ""
1177
1178 #. type: itemize
1179 #: guix-git/doc/guix-cookbook.texi:750
1180 msgid "follow the coding style (@pxref{Coding Style,,, guix, GNU Guix Reference Manual}),"
1181 msgstr ""
1182
1183 #. type: itemize
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})."
1186 msgstr ""
1187
1188 #. type: Plain text
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})"
1191 msgstr ""
1192
1193 #. type: Plain text
1194 #: guix-git/doc/guix-cookbook.texi:759
1195 msgid "It's a community effort so the more join in, the better Guix becomes!"
1196 msgstr ""
1197
1198 #. type: subsection
1199 #: guix-git/doc/guix-cookbook.texi:760 guix-git/doc/guix-cookbook.texi:761
1200 #, no-wrap
1201 msgid "Extended example"
1202 msgstr ""
1203
1204 #. type: Plain text
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):"
1207 msgstr ""
1208
1209 #. type: lisp
1210 #: guix-git/doc/guix-cookbook.texi:780
1211 #, no-wrap
1212 msgid ""
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"
1225 "\n"
1226 msgstr ""
1227
1228 #. type: lisp
1229 #: guix-git/doc/guix-cookbook.texi:834
1230 #, no-wrap
1231 msgid ""
1232 "(define-public my-libgit2\n"
1233 " (let ((commit \"e98d0a37c93574d2c6107bf7f31140b548c6a7bf\")\n"
1234 " (revision \"1\"))\n"
1235 " (package\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"
1244 " (sha256\n"
1245 " (base32\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"
1253 " (arguments\n"
1254 " `(#:tests? #true ; Run the test suite (this is the default)\n"
1255 " #:configure-flags '(\"-DUSE_SHA1DC=ON\") ; SHA-1 collision detection\n"
1256 " #:phases\n"
1257 " (modify-phases %standard-phases\n"
1258 " (add-after 'unpack 'fix-hardcoded-paths\n"
1259 " (lambda _\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"
1270 " (inputs\n"
1271 " (list libssh2 http-parser python-wrapper))\n"
1272 " (native-inputs\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"
1279 " (description\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"
1285 msgstr ""
1286
1287 #. type: Plain text
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.)"
1290 msgstr ""
1291
1292 #. type: Plain text
1293 #: guix-git/doc/guix-cookbook.texi:841
1294 msgid "Let's discuss those fields in depth."
1295 msgstr ""
1296
1297 #. type: subsubsection
1298 #: guix-git/doc/guix-cookbook.texi:842
1299 #, no-wrap
1300 msgid "@code{git-fetch} method"
1301 msgstr ""
1302
1303 #. type: Plain text
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))}."
1306 msgstr ""
1307
1308 #. type: Plain text
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))}."
1311 msgstr ""
1312
1313 #. type: Plain text
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})."
1316 msgstr ""
1317
1318 #. type: Plain text
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:"
1321 msgstr ""
1322
1323 #. type: example
1324 #: guix-git/doc/guix-cookbook.texi:868
1325 #, no-wrap
1326 msgid ""
1327 "git clone https://github.com/libgit2/libgit2/\n"
1328 "cd libgit2\n"
1329 "git checkout v0.26.6\n"
1330 "guix hash -rx .\n"
1331 msgstr ""
1332
1333 #. type: Plain text
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})."
1336 msgstr ""
1337
1338 #. type: Plain text
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."
1341 msgstr ""
1342
1343 #. type: subsubsection
1344 #: guix-git/doc/guix-cookbook.texi:877
1345 #, no-wrap
1346 msgid "Snippets"
1347 msgstr ""
1348
1349 #. type: Plain text
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."
1352 msgstr ""
1353
1354 #. type: Plain text
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."
1357 msgstr ""
1358
1359 #. type: subsubsection
1360 #: guix-git/doc/guix-cookbook.texi:887
1361 #, no-wrap
1362 msgid "Inputs"
1363 msgstr ""
1364
1365 #. type: Plain text
1366 #: guix-git/doc/guix-cookbook.texi:890
1367 msgid "There are 3 different input types. In short:"
1368 msgstr ""
1369
1370 #. type: item
1371 #: guix-git/doc/guix-cookbook.texi:892
1372 #, no-wrap
1373 msgid "native-inputs"
1374 msgstr ""
1375
1376 #. type: table
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."
1379 msgstr ""
1380
1381 #. type: item
1382 #: guix-git/doc/guix-cookbook.texi:895
1383 #, no-wrap
1384 msgid "inputs"
1385 msgstr ""
1386
1387 #. type: table
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."
1390 msgstr ""
1391
1392 #. type: item
1393 #: guix-git/doc/guix-cookbook.texi:898
1394 #, no-wrap
1395 msgid "propagated-inputs"
1396 msgstr ""
1397
1398 #. type: table
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."
1401 msgstr ""
1402
1403 #. type: Plain text
1404 #: guix-git/doc/guix-cookbook.texi:904
1405 msgid "@xref{Package Reference,,, guix, GNU Guix Reference Manual} for more details."
1406 msgstr ""
1407
1408 #. type: Plain text
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."
1411 msgstr ""
1412
1413 #. type: Plain text
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."
1416 msgstr ""
1417
1418 #. type: Plain text
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."
1421 msgstr ""
1422
1423 #. type: quotation
1424 #: guix-git/doc/guix-cookbook.texi:922 guix-git/doc/guix-cookbook.texi:1892
1425 #, no-wrap
1426 msgid "Note"
1427 msgstr ""
1428
1429 #. type: quotation
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:"
1432 msgstr ""
1433
1434 #. type: lisp
1435 #: guix-git/doc/guix-cookbook.texi:932
1436 #, no-wrap
1437 msgid ""
1438 ";; The \"old style\" for inputs.\n"
1439 "(inputs\n"
1440 " `((\"libssh2\" ,libssh2)\n"
1441 " (\"http-parser\" ,http-parser)\n"
1442 " (\"python\" ,python-wrapper)))\n"
1443 msgstr ""
1444
1445 #. type: quotation
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."
1448 msgstr ""
1449
1450 #. type: subsubsection
1451 #: guix-git/doc/guix-cookbook.texi:940
1452 #, no-wrap
1453 msgid "Outputs"
1454 msgstr ""
1455
1456 #. type: Plain text
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."
1459 msgstr ""
1460
1461 #. type: Plain text
1462 #: guix-git/doc/guix-cookbook.texi:946
1463 msgid "Each output corresponds to a separate directory in the store."
1464 msgstr ""
1465
1466 #. type: Plain text
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."
1469 msgstr ""
1470
1471 #. type: Plain text
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\"}."
1474 msgstr ""
1475
1476 #. type: Plain text
1477 #: guix-git/doc/guix-cookbook.texi:954
1478 msgid "Typical separate output names include @code{debug} and @code{doc}."
1479 msgstr ""
1480
1481 #. type: Plain text
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."
1484 msgstr ""
1485
1486 #. type: subsubsection
1487 #: guix-git/doc/guix-cookbook.texi:959
1488 #, no-wrap
1489 msgid "Build system arguments"
1490 msgstr ""
1491
1492 #. type: Plain text
1493 #: guix-git/doc/guix-cookbook.texi:962
1494 msgid "The @code{arguments} is a keyword-value list used to configure the build process."
1495 msgstr ""
1496
1497 #. type: Plain text
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."
1500 msgstr ""
1501
1502 #. type: Plain text
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"
1505 msgstr ""
1506
1507 #. type: lisp
1508 #: guix-git/doc/guix-cookbook.texi:975
1509 #, no-wrap
1510 msgid ""
1511 "#:make-flags (list (string-append \"prefix=\" (assoc-ref %outputs \"out\"))\n"
1512 " \"CC=gcc\")\n"
1513 msgstr ""
1514
1515 #. type: Plain text
1516 #: guix-git/doc/guix-cookbook.texi:978
1517 msgid "translate into"
1518 msgstr ""
1519
1520 #. type: example
1521 #: guix-git/doc/guix-cookbook.texi:981
1522 #, no-wrap
1523 msgid "$ make CC=gcc prefix=/gnu/store/...-<out>\n"
1524 msgstr ""
1525
1526 #. type: Plain text
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})."
1529 msgstr ""
1530
1531 #. type: Plain text
1532 #: guix-git/doc/guix-cookbook.texi:989
1533 msgid "Similarly, it's possible to set the configure flags:"
1534 msgstr ""
1535
1536 #. type: lisp
1537 #: guix-git/doc/guix-cookbook.texi:992
1538 #, no-wrap
1539 msgid "#:configure-flags '(\"-DUSE_SHA1DC=ON\")\n"
1540 msgstr ""
1541
1542 #. type: Plain text
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."
1545 msgstr ""
1546
1547 #. type: Plain text
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}:"
1550 msgstr ""
1551
1552 #. type: lisp
1553 #: guix-git/doc/guix-cookbook.texi:1020
1554 #, no-wrap
1555 msgid ""
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"
1561 " bootstrap\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"
1573 msgstr ""
1574
1575 #. type: Plain text
1576 #: guix-git/doc/guix-cookbook.texi:1023
1577 msgid "Or from the REPL:"
1578 msgstr ""
1579
1580 #. type: lisp
1581 #: guix-git/doc/guix-cookbook.texi:1029
1582 #, no-wrap
1583 msgid ""
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"
1588 msgstr ""
1589
1590 #. type: Plain text
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."
1593 msgstr ""
1594
1595 #. type: Plain text
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:"
1598 msgstr ""
1599
1600 #. type: lisp
1601 #: guix-git/doc/guix-cookbook.texi:1046
1602 #, no-wrap
1603 msgid ""
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"
1609 " (begin\n"
1610 " (mkdir \"source\")\n"
1611 " (chdir \"source\")\n"
1612 "\n"
1613 msgstr ""
1614
1615 #. type: lisp
1616 #: guix-git/doc/guix-cookbook.texi:1057
1617 #, no-wrap
1618 msgid ""
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"
1623 " (begin\n"
1624 " (if (string-suffix? \".zip\" source)\n"
1625 " (invoke \"unzip\" source)\n"
1626 " (invoke \"tar\" \"xvf\" source))\n"
1627 " (chdir (first-subdirectory \".\"))))\n"
1628 " #true)\n"
1629 msgstr ""
1630
1631 #. type: Plain text
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."
1634 msgstr ""
1635
1636 #. type: Plain text
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:"
1639 msgstr ""
1640
1641 #. type: itemize
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}."
1644 msgstr ""
1645
1646 #. type: itemize
1647 #: guix-git/doc/guix-cookbook.texi:1075
1648 msgid "@code{(add-after @var{phase} @var{new-phase} @var{procedure})}: Same, but afterwards."
1649 msgstr ""
1650
1651 #. type: itemize
1652 #: guix-git/doc/guix-cookbook.texi:1077
1653 msgid "@code{(replace @var{phase} @var{procedure})}."
1654 msgstr ""
1655
1656 #. type: itemize
1657 #: guix-git/doc/guix-cookbook.texi:1079
1658 msgid "@code{(delete @var{phase})}."
1659 msgstr ""
1660
1661 #. type: Plain text
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:"
1664 msgstr ""
1665
1666 #. type: lisp
1667 #: guix-git/doc/guix-cookbook.texi:1094
1668 #, no-wrap
1669 msgid ""
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"
1674 " ;; ...\n"
1675 " #true))\n"
1676 msgstr ""
1677
1678 #. type: Plain text
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."
1681 msgstr ""
1682
1683 #. type: subsubsection
1684 #: guix-git/doc/guix-cookbook.texi:1101
1685 #, no-wrap
1686 msgid "Code staging"
1687 msgstr ""
1688
1689 #. type: Plain text
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}."
1692 msgstr ""
1693
1694 #. type: subsubsection
1695 #: guix-git/doc/guix-cookbook.texi:1108
1696 #, no-wrap
1697 msgid "Utility functions"
1698 msgstr ""
1699
1700 #. type: Plain text
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."
1703 msgstr ""
1704
1705 #. type: Plain text
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."
1708 msgstr ""
1709
1710 #. type: Plain text
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."
1713 msgstr ""
1714
1715 #. type: Plain text
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:"
1718 msgstr ""
1719
1720 #. type: item
1721 #: guix-git/doc/guix-cookbook.texi:1125
1722 #, no-wrap
1723 msgid "which"
1724 msgstr ""
1725
1726 #. type: table
1727 #: guix-git/doc/guix-cookbook.texi:1127
1728 msgid "Like the @samp{which} system command."
1729 msgstr ""
1730
1731 #. type: item
1732 #: guix-git/doc/guix-cookbook.texi:1127
1733 #, no-wrap
1734 msgid "find-files"
1735 msgstr ""
1736
1737 #. type: table
1738 #: guix-git/doc/guix-cookbook.texi:1129
1739 msgid "Akin to the @samp{find} system command."
1740 msgstr ""
1741
1742 #. type: item
1743 #: guix-git/doc/guix-cookbook.texi:1129
1744 #, no-wrap
1745 msgid "mkdir-p"
1746 msgstr ""
1747
1748 #. type: table
1749 #: guix-git/doc/guix-cookbook.texi:1131
1750 msgid "Like @samp{mkdir -p}, which creates all parents as needed."
1751 msgstr ""
1752
1753 #. type: item
1754 #: guix-git/doc/guix-cookbook.texi:1131
1755 #, no-wrap
1756 msgid "install-file"
1757 msgstr ""
1758
1759 #. type: table
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}."
1762 msgstr ""
1763
1764 #. type: item
1765 #: guix-git/doc/guix-cookbook.texi:1135
1766 #, no-wrap
1767 msgid "copy-recursively"
1768 msgstr ""
1769
1770 #. type: table
1771 #: guix-git/doc/guix-cookbook.texi:1137
1772 msgid "Like @samp{cp -r}."
1773 msgstr ""
1774
1775 #. type: item
1776 #: guix-git/doc/guix-cookbook.texi:1137
1777 #, no-wrap
1778 msgid "delete-file-recursively"
1779 msgstr ""
1780
1781 #. type: table
1782 #: guix-git/doc/guix-cookbook.texi:1139
1783 msgid "Like @samp{rm -rf}."
1784 msgstr ""
1785
1786 #. type: item
1787 #: guix-git/doc/guix-cookbook.texi:1139
1788 #, no-wrap
1789 msgid "invoke"
1790 msgstr ""
1791
1792 #. type: table
1793 #: guix-git/doc/guix-cookbook.texi:1141
1794 msgid "Run an executable. This should be used instead of @code{system*}."
1795 msgstr ""
1796
1797 #. type: item
1798 #: guix-git/doc/guix-cookbook.texi:1141
1799 #, no-wrap
1800 msgid "with-directory-excursion"
1801 msgstr ""
1802
1803 #. type: table
1804 #: guix-git/doc/guix-cookbook.texi:1144
1805 msgid "Run the body in a different working directory, then restore the previous working directory."
1806 msgstr ""
1807
1808 #. type: item
1809 #: guix-git/doc/guix-cookbook.texi:1144
1810 #, no-wrap
1811 msgid "substitute*"
1812 msgstr ""
1813
1814 #. type: table
1815 #: guix-git/doc/guix-cookbook.texi:1146
1816 msgid "A ``@command{sed}-like'' function."
1817 msgstr ""
1818
1819 #. type: Plain text
1820 #: guix-git/doc/guix-cookbook.texi:1150
1821 msgid "@xref{Build Utilities,,, guix, GNU Guix Reference Manual}, for more information on these utilities."
1822 msgstr ""
1823
1824 #. type: subsubsection
1825 #: guix-git/doc/guix-cookbook.texi:1151
1826 #, no-wrap
1827 msgid "Module prefix"
1828 msgstr ""
1829
1830 #. type: Plain text
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)."
1833 msgstr ""
1834
1835 #. type: subsection
1836 #: guix-git/doc/guix-cookbook.texi:1162 guix-git/doc/guix-cookbook.texi:1163
1837 #, no-wrap
1838 msgid "Other build systems"
1839 msgstr ""
1840
1841 #. type: Plain text
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."
1844 msgstr ""
1845
1846 #. type: Plain text
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."
1849 msgstr ""
1850
1851 #. type: Plain text
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."
1854 msgstr ""
1855
1856 #. type: subsection
1857 #: guix-git/doc/guix-cookbook.texi:1180 guix-git/doc/guix-cookbook.texi:1181
1858 #, no-wrap
1859 msgid "Programmable and automated package definition"
1860 msgstr ""
1861
1862 #. type: Plain text
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."
1865 msgstr ""
1866
1867 #. type: Plain text
1868 #: guix-git/doc/guix-cookbook.texi:1187
1869 msgid "Let's illustrate this with some awesome features of Guix!"
1870 msgstr ""
1871
1872 #. type: subsubsection
1873 #: guix-git/doc/guix-cookbook.texi:1188 guix-git/doc/guix-cookbook.texi:1189
1874 #, no-wrap
1875 msgid "Recursive importers"
1876 msgstr ""
1877
1878 #. type: Plain text
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):"
1881 msgstr ""
1882
1883 #. type: example
1884 #: guix-git/doc/guix-cookbook.texi:1199
1885 #, no-wrap
1886 msgid ""
1887 "$ guix import cran --recursive walrus\n"
1888 "\n"
1889 msgstr ""
1890
1891 #. type: example
1892 #: guix-git/doc/guix-cookbook.texi:1203
1893 #, no-wrap
1894 msgid ""
1895 "(define-public r-mc2d\n"
1896 " ; ...\n"
1897 " (license gpl2+)))\n"
1898 "\n"
1899 msgstr ""
1900
1901 #. type: example
1902 #: guix-git/doc/guix-cookbook.texi:1207
1903 #, no-wrap
1904 msgid ""
1905 "(define-public r-jmvcore\n"
1906 " ; ...\n"
1907 " (license gpl2+)))\n"
1908 "\n"
1909 msgstr ""
1910
1911 #. type: example
1912 #: guix-git/doc/guix-cookbook.texi:1211
1913 #, no-wrap
1914 msgid ""
1915 "(define-public r-wrs2\n"
1916 " ; ...\n"
1917 " (license gpl3)))\n"
1918 "\n"
1919 msgstr ""
1920
1921 #. type: example
1922 #: guix-git/doc/guix-cookbook.texi:1237
1923 #, no-wrap
1924 msgid ""
1925 "(define-public r-walrus\n"
1926 " (package\n"
1927 " (name \"r-walrus\")\n"
1928 " (version \"1.0.3\")\n"
1929 " (source\n"
1930 " (origin\n"
1931 " (method url-fetch)\n"
1932 " (uri (cran-uri \"walrus\" version))\n"
1933 " (sha256\n"
1934 " (base32\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"
1941 " (description\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"
1950 msgstr ""
1951
1952 #. type: Plain text
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."
1955 msgstr ""
1956
1957 #. type: Plain text
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})."
1960 msgstr ""
1961
1962 #. type: subsubsection
1963 #: guix-git/doc/guix-cookbook.texi:1247 guix-git/doc/guix-cookbook.texi:1248
1964 #, no-wrap
1965 msgid "Automatic update"
1966 msgstr ""
1967
1968 #. type: Plain text
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"
1971 msgstr ""
1972
1973 #. type: example
1974 #: guix-git/doc/guix-cookbook.texi:1255
1975 #, no-wrap
1976 msgid "$ guix refresh hello\n"
1977 msgstr ""
1978
1979 #. type: Plain text
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:"
1982 msgstr ""
1983
1984 #. type: example
1985 #: guix-git/doc/guix-cookbook.texi:1263
1986 #, no-wrap
1987 msgid "$ guix refresh hello --update\n"
1988 msgstr ""
1989
1990 #. type: subsubsection
1991 #: guix-git/doc/guix-cookbook.texi:1265 guix-git/doc/guix-cookbook.texi:1266
1992 #, no-wrap
1993 msgid "Inheritance"
1994 msgstr ""
1995
1996 #. type: Plain text
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:"
1999 msgstr ""
2000
2001 #. type: lisp
2002 #: guix-git/doc/guix-cookbook.texi:1285
2003 #, no-wrap
2004 msgid ""
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"
2014 " (sha256\n"
2015 " (base32\n"
2016 " \"17fpahgh5dyckgz7rwqvzgnhx53cx9kr2xw0szprc6bnqy977fi8\"))))\n"
2017 " (native-inputs (list `(,gtk+ \"bin\")))))\n"
2018 msgstr ""
2019
2020 #. type: Plain text
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."
2023 msgstr ""
2024
2025 #. type: subsection
2026 #: guix-git/doc/guix-cookbook.texi:1291 guix-git/doc/guix-cookbook.texi:1292
2027 #, no-wrap
2028 msgid "Getting help"
2029 msgstr ""
2030
2031 #. type: Plain text
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."
2034 msgstr ""
2035
2036 #. type: Plain text
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."
2039 msgstr ""
2040
2041 #. type: Plain text
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."
2044 msgstr ""
2045
2046 #. type: subsection
2047 #: guix-git/doc/guix-cookbook.texi:1304 guix-git/doc/guix-cookbook.texi:1305
2048 #, no-wrap
2049 msgid "Conclusion"
2050 msgstr ""
2051
2052 #. type: Plain text
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."
2055 msgstr ""
2056
2057 #. type: Plain text
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."
2060 msgstr ""
2061
2062 #. type: Plain text
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@."
2065 msgstr ""
2066
2067 #. type: Plain text
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!"
2070 msgstr ""
2071
2072 #. type: subsection
2073 #: guix-git/doc/guix-cookbook.texi:1325 guix-git/doc/guix-cookbook.texi:1326
2074 #, no-wrap
2075 msgid "References"
2076 msgstr ""
2077
2078 #. type: itemize
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}"
2081 msgstr ""
2082
2083 #. type: itemize
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}"
2086 msgstr ""
2087
2088 #. type: itemize
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"
2091 msgstr ""
2092
2093 #. type: Plain text
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."
2096 msgstr ""
2097
2098 #. type: Plain text
2099 #: guix-git/doc/guix-cookbook.texi:1349
2100 msgid "@pxref{System Configuration,,, guix, GNU Guix Reference Manual} for a complete reference."
2101 msgstr ""
2102
2103 #. type: section
2104 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:1645
2105 #: guix-git/doc/guix-cookbook.texi:1646
2106 #, no-wrap
2107 msgid "Guix System Image API"
2108 msgstr ""
2109
2110 #. type: menuentry
2111 #: guix-git/doc/guix-cookbook.texi:1360
2112 msgid "Customizing images to target specific platforms."
2113 msgstr ""
2114
2115 #. type: section
2116 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:1856
2117 #: guix-git/doc/guix-cookbook.texi:1857
2118 #, no-wrap
2119 msgid "Connecting to Wireguard VPN"
2120 msgstr ""
2121
2122 #. type: menuentry
2123 #: guix-git/doc/guix-cookbook.texi:1360
2124 msgid "Connecting to a Wireguard VPN."
2125 msgstr ""
2126
2127 #. type: section
2128 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:1933
2129 #: guix-git/doc/guix-cookbook.texi:1934
2130 #, no-wrap
2131 msgid "Customizing a Window Manager"
2132 msgstr ""
2133
2134 #. type: menuentry
2135 #: guix-git/doc/guix-cookbook.texi:1360
2136 msgid "Handle customization of a Window manager on Guix System."
2137 msgstr ""
2138
2139 #. type: section
2140 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2024
2141 #: guix-git/doc/guix-cookbook.texi:2025
2142 #, no-wrap
2143 msgid "Running Guix on a Linode Server"
2144 msgstr ""
2145
2146 #. type: section
2147 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2267
2148 #: guix-git/doc/guix-cookbook.texi:2268
2149 #, no-wrap
2150 msgid "Setting up a bind mount"
2151 msgstr ""
2152
2153 #. type: menuentry
2154 #: guix-git/doc/guix-cookbook.texi:1360
2155 msgid "Setting up a bind mount in the file-systems definition."
2156 msgstr ""
2157
2158 #. type: section
2159 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2316
2160 #: guix-git/doc/guix-cookbook.texi:2317
2161 #, no-wrap
2162 msgid "Getting substitutes from Tor"
2163 msgstr ""
2164
2165 #. type: menuentry
2166 #: guix-git/doc/guix-cookbook.texi:1360
2167 msgid "Configuring Guix daemon to get substitutes through Tor."
2168 msgstr ""
2169
2170 #. type: section
2171 #: guix-git/doc/guix-cookbook.texi:1360 guix-git/doc/guix-cookbook.texi:2378
2172 #: guix-git/doc/guix-cookbook.texi:2379
2173 #, no-wrap
2174 msgid "Setting up NGINX with Lua"
2175 msgstr ""
2176
2177 #. type: menuentry
2178 #: guix-git/doc/guix-cookbook.texi:1360
2179 msgid "Configuring NGINX web-server to load Lua modules."
2180 msgstr ""
2181
2182 #. type: Plain text
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."
2185 msgstr ""
2186
2187 #. type: Plain text
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:"
2190 msgstr ""
2191
2192 #. type: lisp
2193 #: guix-git/doc/guix-cookbook.texi:1382
2194 #, no-wrap
2195 msgid ""
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"
2201 " config))\n"
2202 "\n"
2203 msgstr ""
2204
2205 #. type: lisp
2206 #: guix-git/doc/guix-cookbook.texi:1389
2207 #, no-wrap
2208 msgid ""
2209 "(define %my-services\n"
2210 " (modify-services %base-services\n"
2211 " ;; @dots{}\n"
2212 " (mingetty-service-type config =>\n"
2213 " (auto-login-to-tty\n"
2214 " config \"tty3\" \"alice\"))))\n"
2215 "\n"
2216 msgstr ""
2217
2218 #. type: lisp
2219 #: guix-git/doc/guix-cookbook.texi:1393
2220 #, no-wrap
2221 msgid ""
2222 "(operating-system\n"
2223 " ;; @dots{}\n"
2224 " (services %my-services))\n"
2225 msgstr ""
2226
2227 #. type: Plain text
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."
2230 msgstr ""
2231
2232 #. type: Plain text
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."
2235 msgstr ""
2236
2237 #. type: Plain text
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."
2240 msgstr ""
2241
2242 #. type: Plain text
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."
2245 msgstr ""
2246
2247 #. type: Plain text
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."
2250 msgstr ""
2251
2252 #. type: Plain text
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."
2255 msgstr ""
2256
2257 #. type: lisp
2258 #: guix-git/doc/guix-cookbook.texi:1442
2259 #, no-wrap
2260 msgid ""
2261 "(define* (make-linux-libre* version gnu-revision source supported-systems\n"
2262 " #:key\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"
2269 " ...)\n"
2270 msgstr ""
2271
2272 #. type: Plain text
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:"
2275 msgstr ""
2276
2277 #. type: lisp
2278 #: guix-git/doc/guix-cookbook.texi:1454
2279 #, no-wrap
2280 msgid ""
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"
2287 msgstr ""
2288
2289 #. type: Plain text
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."
2292 msgstr ""
2293
2294 #. type: Plain text
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:"
2297 msgstr ""
2298
2299 #. type: lisp
2300 #: guix-git/doc/guix-cookbook.texi:1471
2301 #, no-wrap
2302 msgid ""
2303 "(let ((build (assoc-ref %standard-phases 'build))\n"
2304 " (config (assoc-ref (or native-inputs inputs) \"kconfig\")))\n"
2305 "\n"
2306 msgstr ""
2307
2308 #. type: lisp
2309 #: guix-git/doc/guix-cookbook.texi:1479
2310 #, no-wrap
2311 msgid ""
2312 " ;; Use a custom kernel configuration file or a default\n"
2313 " ;; configuration file.\n"
2314 " (if config\n"
2315 " (begin\n"
2316 " (copy-file config \".config\")\n"
2317 " (chmod \".config\" #o666))\n"
2318 " (invoke \"make\" ,defconfig)))\n"
2319 msgstr ""
2320
2321 #. type: Plain text
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:"
2324 msgstr ""
2325
2326 #. type: lisp
2327 #: guix-git/doc/guix-cookbook.texi:1493
2328 #, no-wrap
2329 msgid ""
2330 "(define-public linux-libre/E2140\n"
2331 " (package\n"
2332 " (inherit linux-libre)\n"
2333 " (native-inputs\n"
2334 " `((\"kconfig\" ,(local-file \"E2140.config\"))\n"
2335 " ,@@(alist-delete \"kconfig\"\n"
2336 " (package-native-inputs linux-libre))))))\n"
2337 msgstr ""
2338
2339 #. type: Plain text
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."
2342 msgstr ""
2343
2344 #. type: Plain text
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:"
2347 msgstr ""
2348
2349 #. type: lisp
2350 #: guix-git/doc/guix-cookbook.texi:1521
2351 #, no-wrap
2352 msgid ""
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"
2367 "\n"
2368 msgstr ""
2369
2370 #. type: lisp
2371 #: guix-git/doc/guix-cookbook.texi:1532
2372 #, no-wrap
2373 msgid ""
2374 "(define (config->string options)\n"
2375 " (string-join (map (match-lambda\n"
2376 " ((option . 'm)\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"
2382 " options)\n"
2383 " \"\\n\"))\n"
2384 msgstr ""
2385
2386 #. type: Plain text
2387 #: guix-git/doc/guix-cookbook.texi:1535
2388 msgid "And in the custom configure script from the `make-linux-libre` package:"
2389 msgstr ""
2390
2391 #. type: lisp
2392 #: guix-git/doc/guix-cookbook.texi:1543
2393 #, no-wrap
2394 msgid ""
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"
2401 "\n"
2402 msgstr ""
2403
2404 #. type: lisp
2405 #: guix-git/doc/guix-cookbook.texi:1545
2406 #, no-wrap
2407 msgid "(invoke \"make\" \"oldconfig\")\n"
2408 msgstr ""
2409
2410 #. type: Plain text
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:"
2413 msgstr ""
2414
2415 #. type: lisp
2416 #: guix-git/doc/guix-cookbook.texi:1558
2417 #, no-wrap
2418 msgid ""
2419 "(define %macbook41-full-config\n"
2420 " (append %macbook41-config-options\n"
2421 " %file-systems\n"
2422 " %efi-support\n"
2423 " %emulation\n"
2424 " (@@@@ (gnu packages linux) %default-extra-linux-options)))\n"
2425 "\n"
2426 msgstr ""
2427
2428 #. type: lisp
2429 #: guix-git/doc/guix-cookbook.texi:1569
2430 #, no-wrap
2431 msgid ""
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"
2442 msgstr ""
2443
2444 #. type: Plain text
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."
2447 msgstr ""
2448
2449 #. type: Plain text
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."
2452 msgstr ""
2453
2454 #. type: Plain text
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:"
2457 msgstr ""
2458
2459 #. type: example
2460 #: guix-git/doc/guix-cookbook.texi:1591
2461 #, no-wrap
2462 msgid "tar xf $(guix build linux-libre --source)\n"
2463 msgstr ""
2464
2465 #. type: Plain text
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:"
2468 msgstr ""
2469
2470 #. type: example
2471 #: guix-git/doc/guix-cookbook.texi:1601
2472 #, no-wrap
2473 msgid "guix environment linux-libre -- make localmodconfig\n"
2474 msgstr ""
2475
2476 #. type: Plain text
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:"
2479 msgstr ""
2480
2481 #. type: example
2482 #: guix-git/doc/guix-cookbook.texi:1609
2483 #, no-wrap
2484 msgid "module pcspkr did not have configs CONFIG_INPUT_PCSPKR\n"
2485 msgstr ""
2486
2487 #. type: Plain text
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:"
2490 msgstr ""
2491
2492 #. type: example
2493 #: guix-git/doc/guix-cookbook.texi:1618
2494 #, no-wrap
2495 msgid ""
2496 "CONFIG_INPUT_PCSPKR=m\n"
2497 "CONFIG_VIRTIO=m\n"
2498 msgstr ""
2499
2500 #. type: Plain text
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."
2503 msgstr ""
2504
2505 #. type: Plain text
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."
2508 msgstr ""
2509
2510 #. type: Plain text
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."
2513 msgstr ""
2514
2515 #. type: Plain text
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."
2518 msgstr ""
2519
2520 #. type: Plain text
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."
2523 msgstr ""
2524
2525 #. type: Plain text
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."
2528 msgstr ""
2529
2530 #. type: Plain text
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."
2533 msgstr ""
2534
2535 #. type: lisp
2536 #: guix-git/doc/guix-cookbook.texi:1684
2537 #, no-wrap
2538 msgid ""
2539 "(define-record-type* <image>\n"
2540 " image make-image\n"
2541 " image?\n"
2542 " (name image-name ;symbol\n"
2543 " (default #f))\n"
2544 " (format image-format) ;symbol\n"
2545 " (target image-target\n"
2546 " (default #f))\n"
2547 " (size image-size ;size in bytes as integer\n"
2548 " (default 'guess))\n"
2549 " (operating-system image-operating-system ;<operating-system>\n"
2550 " (default #f))\n"
2551 " (partitions image-partitions ;list of <partition>\n"
2552 " (default '()))\n"
2553 " (compression? image-compression? ;boolean\n"
2554 " (default #t))\n"
2555 " (volatile-root? image-volatile-root? ;boolean\n"
2556 " (default #t))\n"
2557 " (substitutable? image-substitutable? ;boolean\n"
2558 " (default #t)))\n"
2559 msgstr ""
2560
2561 #. type: Plain text
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."
2564 msgstr ""
2565
2566 #. type: Plain text
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:"
2569 msgstr ""
2570
2571 #. type: file{#1}
2572 #: guix-git/doc/guix-cookbook.texi:1695
2573 #, no-wrap
2574 msgid "gnu/system/images/hurd.scm"
2575 msgstr ""
2576
2577 #. type: file{#1}
2578 #: guix-git/doc/guix-cookbook.texi:1696
2579 #, no-wrap
2580 msgid "gnu/system/images/pine64.scm"
2581 msgstr ""
2582
2583 #. type: file{#1}
2584 #: guix-git/doc/guix-cookbook.texi:1697
2585 #, no-wrap
2586 msgid "gnu/system/images/novena.scm"
2587 msgstr ""
2588
2589 #. type: file{#1}
2590 #: guix-git/doc/guix-cookbook.texi:1698
2591 #, no-wrap
2592 msgid "gnu/system/images/pinebook-pro.scm"
2593 msgstr ""
2594
2595 #. type: Plain text
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."
2598 msgstr ""
2599
2600 #. type: lisp
2601 #: guix-git/doc/guix-cookbook.texi:1728
2602 #, no-wrap
2603 msgid ""
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"
2626 msgstr ""
2627
2628 #. type: Plain text
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."
2631 msgstr ""
2632
2633 #. type: Plain text
2634 #: guix-git/doc/guix-cookbook.texi:1734
2635 msgid "Right below, the @code{pine64-image-type} variable is also defined."
2636 msgstr ""
2637
2638 #. type: lisp
2639 #: guix-git/doc/guix-cookbook.texi:1740
2640 #, no-wrap
2641 msgid ""
2642 "(define pine64-image-type\n"
2643 " (image-type\n"
2644 " (name 'pine64-raw)\n"
2645 " (constructor (cut image-with-os arm64-disk-image <>))))\n"
2646 msgstr ""
2647
2648 #. type: Plain text
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:"
2651 msgstr ""
2652
2653 #. type: lisp
2654 #: guix-git/doc/guix-cookbook.texi:1751
2655 #, no-wrap
2656 msgid ""
2657 "(define-record-type* <image-type>\n"
2658 " image-type make-image-type\n"
2659 " image-type?\n"
2660 " (name image-type-name) ;symbol\n"
2661 " (constructor image-type-constructor)) ;<operating-system> -> <image>\n"
2662 msgstr ""
2663
2664 #. type: Plain text
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:"
2667 msgstr ""
2668
2669 #. type: example
2670 #: guix-git/doc/guix-cookbook.texi:1760
2671 #, no-wrap
2672 msgid "guix system image my-os.scm\n"
2673 msgstr ""
2674
2675 #. type: Plain text
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:"
2678 msgstr ""
2679
2680 #. type: example
2681 #: guix-git/doc/guix-cookbook.texi:1769
2682 #, no-wrap
2683 msgid "guix system image --image-type=pine64-raw my-os.scm\n"
2684 msgstr ""
2685
2686 #. type: Plain text
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."
2689 msgstr ""
2690
2691 #. type: Plain text
2692 #: guix-git/doc/guix-cookbook.texi:1777
2693 msgid "The resulting image looks like:"
2694 msgstr ""
2695
2696 #. type: lisp
2697 #: guix-git/doc/guix-cookbook.texi:1787
2698 #, no-wrap
2699 msgid ""
2700 "(image\n"
2701 " (format 'disk-image)\n"
2702 " (target \"aarch64-linux-gnu\")\n"
2703 " (operating-system my-os)\n"
2704 " (partitions\n"
2705 " (list (partition\n"
2706 " (inherit root-partition)\n"
2707 " (offset root-offset)))))\n"
2708 msgstr ""
2709
2710 #. type: Plain text
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."
2713 msgstr ""
2714
2715 #. type: Plain text
2716 #: guix-git/doc/guix-cookbook.texi:1793
2717 msgid "But enough Scheme madness. What does this image API bring to the Guix user?"
2718 msgstr ""
2719
2720 #. type: Plain text
2721 #: guix-git/doc/guix-cookbook.texi:1795
2722 msgid "One can run:"
2723 msgstr ""
2724
2725 #. type: example
2726 #: guix-git/doc/guix-cookbook.texi:1799
2727 #, no-wrap
2728 msgid ""
2729 "mathieu@@cervin:~$ guix system --list-image-types\n"
2730 "The available image types are:\n"
2731 "\n"
2732 msgstr ""
2733
2734 #. type: example
2735 #: guix-git/doc/guix-cookbook.texi:1811
2736 #, no-wrap
2737 msgid ""
2738 " - pinebook-pro-raw\n"
2739 " - pine64-raw\n"
2740 " - novena-raw\n"
2741 " - hurd-raw\n"
2742 " - hurd-qcow2\n"
2743 " - qcow2\n"
2744 " - uncompressed-iso9660\n"
2745 " - efi-raw\n"
2746 " - arm64-raw\n"
2747 " - arm32-raw\n"
2748 " - iso9660\n"
2749 msgstr ""
2750
2751 #. type: Plain text
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:"
2754 msgstr ""
2755
2756 #. type: lisp
2757 #: guix-git/doc/guix-cookbook.texi:1820
2758 #, no-wrap
2759 msgid ""
2760 "(use-modules (gnu services linux)\n"
2761 " (gnu system images pine64))\n"
2762 "\n"
2763 msgstr ""
2764
2765 #. type: lisp
2766 #: guix-git/doc/guix-cookbook.texi:1831
2767 #, no-wrap
2768 msgid ""
2769 "(let ((base-os pine64-barebones-os))\n"
2770 " (operating-system\n"
2771 " (inherit base-os)\n"
2772 " (timezone \"America/Indiana/Indianapolis\")\n"
2773 " (services\n"
2774 " (cons\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"
2779 msgstr ""
2780
2781 #. type: Plain text
2782 #: guix-git/doc/guix-cookbook.texi:1834
2783 msgid "run:"
2784 msgstr ""
2785
2786 #. type: example
2787 #: guix-git/doc/guix-cookbook.texi:1837
2788 #, no-wrap
2789 msgid "guix system image --image-type=pine64-raw my-pine-os.scm\n"
2790 msgstr ""
2791
2792 #. type: Plain text
2793 #: guix-git/doc/guix-cookbook.texi:1840
2794 msgid "or,"
2795 msgstr ""
2796
2797 #. type: example
2798 #: guix-git/doc/guix-cookbook.texi:1843
2799 #, no-wrap
2800 msgid "guix system image --image-type=hurd-raw my-hurd-os.scm\n"
2801 msgstr ""
2802
2803 #. type: Plain text
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."
2806 msgstr ""
2807
2808 #. type: Plain text
2809 #: guix-git/doc/guix-cookbook.texi:1849
2810 msgid "Without changing anything to @code{my-hurd-os.scm}, calling:"
2811 msgstr ""
2812
2813 #. type: example
2814 #: guix-git/doc/guix-cookbook.texi:1852
2815 #, no-wrap
2816 msgid "guix system image --image-type=hurd-qcow2 my-hurd-os.scm\n"
2817 msgstr ""
2818
2819 #. type: Plain text
2820 #: guix-git/doc/guix-cookbook.texi:1855
2821 msgid "will instead produce a Hurd QEMU image."
2822 msgstr ""
2823
2824 #. type: Plain text
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})."
2827 msgstr ""
2828
2829 #. type: Plain text
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:"
2832 msgstr ""
2833
2834 #. type: lisp
2835 #: guix-git/doc/guix-cookbook.texi:1871
2836 #, no-wrap
2837 msgid ""
2838 "(use-modules (gnu))\n"
2839 "(use-service-modules desktop)\n"
2840 "(use-package-modules vpn)\n"
2841 "\n"
2842 msgstr ""
2843
2844 #. type: lisp
2845 #: guix-git/doc/guix-cookbook.texi:1880
2846 #, no-wrap
2847 msgid ""
2848 "(operating-system\n"
2849 " ;; …\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"
2856 msgstr ""
2857
2858 #. type: Plain text
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."
2861 msgstr ""
2862
2863 #. type: subsection
2864 #: guix-git/doc/guix-cookbook.texi:1885
2865 #, no-wrap
2866 msgid "Using Wireguard tools"
2867 msgstr ""
2868
2869 #. type: Plain text
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."
2872 msgstr ""
2873
2874 #. type: quotation
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 […]”."
2877 msgstr ""
2878
2879 #. type: subsection
2880 #: guix-git/doc/guix-cookbook.texi:1897
2881 #, no-wrap
2882 msgid "Using NetworkManager"
2883 msgstr ""
2884
2885 #. type: Plain text
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."
2888 msgstr ""
2889
2890 #. type: Plain text
2891 #: guix-git/doc/guix-cookbook.texi:1907
2892 msgid "To import your VPN configuration execute nmcli import command:"
2893 msgstr ""
2894
2895 #. type: example
2896 #: guix-git/doc/guix-cookbook.texi:1911
2897 #, no-wrap
2898 msgid ""
2899 "# nmcli connection import type wireguard file wg0.conf\n"
2900 "Connection 'wg0' (edbee261-aa5a-42db-b032-6c7757c60fde) successfully added\n"
2901 msgstr ""
2902
2903 #. type: Plain text
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:"
2906 msgstr ""
2907
2908 #. type: example
2909 #: guix-git/doc/guix-cookbook.texi:1920
2910 #, no-wrap
2911 msgid ""
2912 "$ nmcli connection up wg0\n"
2913 "Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)\n"
2914 msgstr ""
2915
2916 #. type: Plain text
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:"
2919 msgstr ""
2920
2921 #. type: example
2922 #: guix-git/doc/guix-cookbook.texi:1927
2923 #, no-wrap
2924 msgid "# nmcli connection modify wg0 connection.autoconnect no\n"
2925 msgstr ""
2926
2927 #. type: Plain text
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}."
2930 msgstr ""
2931
2932 #. type: cindex
2933 #: guix-git/doc/guix-cookbook.texi:1935
2934 #, no-wrap
2935 msgid "wm"
2936 msgstr ""
2937
2938 #. type: subsection
2939 #: guix-git/doc/guix-cookbook.texi:1937 guix-git/doc/guix-cookbook.texi:1938
2940 #, no-wrap
2941 msgid "StumpWM"
2942 msgstr ""
2943
2944 #. type: cindex
2945 #: guix-git/doc/guix-cookbook.texi:1939
2946 #, no-wrap
2947 msgid "stumpwm"
2948 msgstr ""
2949
2950 #. type: Plain text
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}."
2953 msgstr ""
2954
2955 #. type: Plain text
2956 #: guix-git/doc/guix-cookbook.texi:1946
2957 msgid "An example configuration can look like this:"
2958 msgstr ""
2959
2960 #. type: lisp
2961 #: guix-git/doc/guix-cookbook.texi:1950
2962 #, no-wrap
2963 msgid ""
2964 "(use-modules (gnu))\n"
2965 "(use-package-modules wm)\n"
2966 "\n"
2967 msgstr ""
2968
2969 #. type: lisp
2970 #: guix-git/doc/guix-cookbook.texi:1955
2971 #, no-wrap
2972 msgid ""
2973 "(operating-system\n"
2974 " ;; …\n"
2975 " (packages (append (list sbcl stumpwm `(,stumpwm \"lib\"))\n"
2976 " %base-packages)))\n"
2977 msgstr ""
2978
2979 #. type: cindex
2980 #: guix-git/doc/guix-cookbook.texi:1957
2981 #, no-wrap
2982 msgid "stumpwm fonts"
2983 msgstr ""
2984
2985 #. type: Plain text
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:"
2988 msgstr ""
2989
2990 #. type: lisp
2991 #: guix-git/doc/guix-cookbook.texi:1965
2992 #, no-wrap
2993 msgid ""
2994 "(use-modules (gnu))\n"
2995 "(use-package-modules fonts wm)\n"
2996 "\n"
2997 msgstr ""
2998
2999 #. type: lisp
3000 #: guix-git/doc/guix-cookbook.texi:1970
3001 #, no-wrap
3002 msgid ""
3003 "(operating-system\n"
3004 " ;; …\n"
3005 " (packages (append (list sbcl stumpwm `(,stumpwm \"lib\"))\n"
3006 " sbcl-ttf-fonts font-dejavu %base-packages)))\n"
3007 msgstr ""
3008
3009 #. type: Plain text
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}:"
3012 msgstr ""
3013
3014 #. type: lisp
3015 #: guix-git/doc/guix-cookbook.texi:1981
3016 #, no-wrap
3017 msgid ""
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"
3023 msgstr ""
3024
3025 #. type: subsection
3026 #: guix-git/doc/guix-cookbook.texi:1983 guix-git/doc/guix-cookbook.texi:1984
3027 #, no-wrap
3028 msgid "Session lock"
3029 msgstr ""
3030
3031 #. type: cindex
3032 #: guix-git/doc/guix-cookbook.texi:1985
3033 #, no-wrap
3034 msgid "sessionlock"
3035 msgstr ""
3036
3037 #. type: Plain text
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."
3040 msgstr ""
3041
3042 #. type: subsubsection
3043 #: guix-git/doc/guix-cookbook.texi:1992 guix-git/doc/guix-cookbook.texi:1993
3044 #, no-wrap
3045 msgid "Xorg"
3046 msgstr ""
3047
3048 #. type: Plain text
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."
3051 msgstr ""
3052
3053 #. type: Plain text
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}:"
3056 msgstr ""
3057
3058 #. type: example
3059 #: guix-git/doc/guix-cookbook.texi:2006
3060 #, no-wrap
3061 msgid ""
3062 "xss-lock -- slock &\n"
3063 "exec stumpwm\n"
3064 msgstr ""
3065
3066 #. type: Plain text
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."
3069 msgstr ""
3070
3071 #. type: Plain text
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}:"
3074 msgstr ""
3075
3076 #. type: lisp
3077 #: guix-git/doc/guix-cookbook.texi:2017
3078 #, no-wrap
3079 msgid "(screen-locker-service slock)\n"
3080 msgstr ""
3081
3082 #. type: Plain text
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."
3085 msgstr ""
3086
3087 #. type: cindex
3088 #: guix-git/doc/guix-cookbook.texi:2026
3089 #, no-wrap
3090 msgid "linode, Linode"
3091 msgstr ""
3092
3093 #. type: Plain text
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."
3096 msgstr ""
3097
3098 #. type: example
3099 #: guix-git/doc/guix-cookbook.texi:2034
3100 #, no-wrap
3101 msgid "ssh-keygen\n"
3102 msgstr ""
3103
3104 #. type: Plain text
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:"
3107 msgstr ""
3108
3109 #. type: example
3110 #: guix-git/doc/guix-cookbook.texi:2043
3111 #, no-wrap
3112 msgid "cat ~/.ssh/<username>_rsa.pub\n"
3113 msgstr ""
3114
3115 #. type: Plain text
3116 #: guix-git/doc/guix-cookbook.texi:2046
3117 msgid "Power the Linode down."
3118 msgstr ""
3119
3120 #. type: Plain text
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:"
3123 msgstr ""
3124
3125 #. type: itemize
3126 #: guix-git/doc/guix-cookbook.texi:2054
3127 msgid "Label: \"Guix\""
3128 msgstr ""
3129
3130 #. type: itemize
3131 #: guix-git/doc/guix-cookbook.texi:2057
3132 msgid "Filesystem: ext4"
3133 msgstr ""
3134
3135 #. type: itemize
3136 #: guix-git/doc/guix-cookbook.texi:2060
3137 msgid "Set it to the remaining size"
3138 msgstr ""
3139
3140 #. type: Plain text
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."
3143 msgstr ""
3144
3145 #. type: Plain text
3146 #: guix-git/doc/guix-cookbook.texi:2067
3147 msgid "Now \"Add a Configuration\", with the following:"
3148 msgstr ""
3149
3150 #. type: itemize
3151 #: guix-git/doc/guix-cookbook.texi:2070
3152 msgid "Label: Guix"
3153 msgstr ""
3154
3155 #. type: itemize
3156 #: guix-git/doc/guix-cookbook.texi:2073
3157 msgid "Kernel:GRUB 2 (it's at the bottom! This step is @b{IMPORTANT!})"
3158 msgstr ""
3159
3160 #. type: itemize
3161 #: guix-git/doc/guix-cookbook.texi:2076
3162 msgid "Block device assignment:"
3163 msgstr ""
3164
3165 #. type: itemize
3166 #: guix-git/doc/guix-cookbook.texi:2079
3167 msgid "@file{/dev/sda}: Guix"
3168 msgstr ""
3169
3170 #. type: itemize
3171 #: guix-git/doc/guix-cookbook.texi:2082
3172 msgid "@file{/dev/sdb}: swap"
3173 msgstr ""
3174
3175 #. type: itemize
3176 #: guix-git/doc/guix-cookbook.texi:2085
3177 msgid "Root device: @file{/dev/sda}"
3178 msgstr ""
3179
3180 #. type: itemize
3181 #: guix-git/doc/guix-cookbook.texi:2088
3182 msgid "Turn off all the filesystem/boot helpers"
3183 msgstr ""
3184
3185 #. type: Plain text
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:"
3188 msgstr ""
3189
3190 #. type: example
3191 #: guix-git/doc/guix-cookbook.texi:2103
3192 #, no-wrap
3193 msgid ""
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"
3199 "guix pull\n"
3200 msgstr ""
3201
3202 #. type: Plain text
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}."
3205 msgstr ""
3206
3207 #. type: lisp
3208 #: guix-git/doc/guix-cookbook.texi:2118
3209 #, no-wrap
3210 msgid ""
3211 "(use-modules (gnu)\n"
3212 " (guix modules))\n"
3213 "(use-service-modules networking\n"
3214 " ssh)\n"
3215 "(use-package-modules admin\n"
3216 " certs\n"
3217 " package-management\n"
3218 " ssh\n"
3219 " tls)\n"
3220 "\n"
3221 msgstr ""
3222
3223 #. type: lisp
3224 #: guix-git/doc/guix-cookbook.texi:2135
3225 #, no-wrap
3226 msgid ""
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"
3234 " (bootloader\n"
3235 " (bootloader\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"
3243 "\n"
3244 msgstr ""
3245
3246 #. type: lisp
3247 #: guix-git/doc/guix-cookbook.texi:2138
3248 #, no-wrap
3249 msgid ""
3250 " (swap-devices (list \"/dev/sdb\"))\n"
3251 "\n"
3252 msgstr ""
3253
3254 #. type: lisp
3255 #: guix-git/doc/guix-cookbook.texi:2142
3256 #, no-wrap
3257 msgid ""
3258 " (initrd-modules (cons \"virtio_scsi\" ; Needed to find the disk\n"
3259 " %base-initrd-modules))\n"
3260 "\n"
3261 msgstr ""
3262
3263 #. type: lisp
3264 #: guix-git/doc/guix-cookbook.texi:2151
3265 #, no-wrap
3266 msgid ""
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"
3275 "\n"
3276 msgstr ""
3277
3278 #. type: lisp
3279 #: guix-git/doc/guix-cookbook.texi:2155
3280 #, no-wrap
3281 msgid ""
3282 " (packages (cons* nss-certs ;for HTTPS access\n"
3283 " openssh-sans-x\n"
3284 " %base-packages))\n"
3285 "\n"
3286 msgstr ""
3287
3288 #. type: lisp
3289 #: guix-git/doc/guix-cookbook.texi:2166
3290 #, no-wrap
3291 msgid ""
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"
3302 msgstr ""
3303
3304 #. type: Plain text
3305 #: guix-git/doc/guix-cookbook.texi:2169
3306 msgid "Replace the following fields in the above configuration:"
3307 msgstr ""
3308
3309 #. type: lisp
3310 #: guix-git/doc/guix-cookbook.texi:2177
3311 #, no-wrap
3312 msgid ""
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"
3320 msgstr ""
3321
3322 #. type: Plain text
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."
3325 msgstr ""
3326
3327 #. type: Plain text
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."
3330 msgstr ""
3331
3332 #. type: example
3333 #: guix-git/doc/guix-cookbook.texi:2194
3334 #, no-wrap
3335 msgid ""
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"
3339 msgstr ""
3340
3341 #. type: Plain text
3342 #: guix-git/doc/guix-cookbook.texi:2197
3343 msgid "In your first terminal, mount the guix drive:"
3344 msgstr ""
3345
3346 #. type: example
3347 #: guix-git/doc/guix-cookbook.texi:2201
3348 #, no-wrap
3349 msgid ""
3350 "mkdir /mnt/guix\n"
3351 "mount /dev/sdc /mnt/guix\n"
3352 msgstr ""
3353
3354 #. type: Plain text
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:"
3357 msgstr ""
3358
3359 #. type: example
3360 #: guix-git/doc/guix-cookbook.texi:2210
3361 #, no-wrap
3362 msgid ""
3363 "mkdir -p /mnt/guix/boot/grub\n"
3364 "cp -r /boot/grub/* /mnt/guix/boot/grub/\n"
3365 msgstr ""
3366
3367 #. type: Plain text
3368 #: guix-git/doc/guix-cookbook.texi:2213
3369 msgid "Now initialize the Guix installation:"
3370 msgstr ""
3371
3372 #. type: example
3373 #: guix-git/doc/guix-cookbook.texi:2216
3374 #, no-wrap
3375 msgid "guix system init guix-config.scm /mnt/guix\n"
3376 msgstr ""
3377
3378 #. type: Plain text
3379 #: guix-git/doc/guix-cookbook.texi:2220
3380 msgid "Ok, power it down! Now from the Linode console, select boot and select \"Guix\"."
3381 msgstr ""
3382
3383 #. type: Plain text
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:"
3386 msgstr ""
3387
3388 #. type: example
3389 #: guix-git/doc/guix-cookbook.texi:2239
3390 #, no-wrap
3391 msgid ""
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"
3406 msgstr ""
3407
3408 #. type: Plain text
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."
3411 msgstr ""
3412
3413 #. type: Plain text
3414 #: guix-git/doc/guix-cookbook.texi:2245
3415 msgid "Be sure to set your password and root's password."
3416 msgstr ""
3417
3418 #. type: example
3419 #: guix-git/doc/guix-cookbook.texi:2250
3420 #, no-wrap
3421 msgid ""
3422 "ssh root@@<remote ip address>\n"
3423 "passwd ; for the root password\n"
3424 "passwd <username> ; for the user password\n"
3425 msgstr ""
3426
3427 #. type: Plain text
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."
3430 msgstr ""
3431
3432 #. type: Plain text
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!"
3435 msgstr ""
3436
3437 #. type: Plain text
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."
3440 msgstr ""
3441
3442 #. type: Plain text
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}."
3445 msgstr ""
3446
3447 #. type: Plain text
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."
3450 msgstr ""
3451
3452 #. type: lisp
3453 #: guix-git/doc/guix-cookbook.texi:2285
3454 #, no-wrap
3455 msgid ""
3456 "(define source-drive ;; \"source-drive\" can be named anything you want.\n"
3457 " (file-system\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"
3461 msgstr ""
3462
3463 #. type: Plain text
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."
3466 msgstr ""
3467
3468 #. type: lisp
3469 #: guix-git/doc/guix-cookbook.texi:2291
3470 #, no-wrap
3471 msgid "(define (%source-directory) \"/path-to-spinning-disk-goes-here/tmp\") ;; \"source-directory\" can be named any valid variable name.\n"
3472 msgstr ""
3473
3474 #. type: Plain text
3475 #: guix-git/doc/guix-cookbook.texi:2295
3476 msgid "Finally, inside the @code{file-systems} definition, we must add the mount itself."
3477 msgstr ""
3478
3479 #. type: lisp
3480 #: guix-git/doc/guix-cookbook.texi:2298
3481 #, no-wrap
3482 msgid ""
3483 "(file-systems (cons*\n"
3484 "\n"
3485 msgstr ""
3486
3487 #. type: lisp
3488 #: guix-git/doc/guix-cookbook.texi:2300
3489 #, no-wrap
3490 msgid ""
3491 " ...<other drives omitted for clarity>...\n"
3492 "\n"
3493 msgstr ""
3494
3495 #. type: lisp
3496 #: guix-git/doc/guix-cookbook.texi:2302
3497 #, no-wrap
3498 msgid ""
3499 " source-drive ;; Must match the name you gave the source drive in the earlier definition.\n"
3500 "\n"
3501 msgstr ""
3502
3503 #. type: lisp
3504 #: guix-git/doc/guix-cookbook.texi:2310
3505 #, no-wrap
3506 msgid ""
3507 " (file-system\n"
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"
3513 " )\n"
3514 "\n"
3515 msgstr ""
3516
3517 #. type: lisp
3518 #: guix-git/doc/guix-cookbook.texi:2312
3519 #, no-wrap
3520 msgid ""
3521 " ...<other drives omitted for clarity>...\n"
3522 "\n"
3523 msgstr ""
3524
3525 #. type: lisp
3526 #: guix-git/doc/guix-cookbook.texi:2314
3527 #, no-wrap
3528 msgid " ))\n"
3529 msgstr ""
3530
3531 #. type: Plain text
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."
3534 msgstr ""
3535
3536 #. type: quotation
3537 #: guix-git/doc/guix-cookbook.texi:2322
3538 #, no-wrap
3539 msgid "Warning"
3540 msgstr ""
3541
3542 #. type: quotation
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."
3545 msgstr ""
3546
3547 #. type: quotation
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."
3550 msgstr ""
3551
3552 #. type: Plain text
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:"
3555 msgstr ""
3556
3557 #. type: lisp
3558 #: guix-git/doc/guix-cookbook.texi:2343
3559 #, no-wrap
3560 msgid ""
3561 "(use-modules (gnu))\n"
3562 "(use-service-module base networking)\n"
3563 "\n"
3564 msgstr ""
3565
3566 #. type: lisp
3567 #: guix-git/doc/guix-cookbook.texi:2359
3568 #, no-wrap
3569 msgid ""
3570 "(operating-system\n"
3571 " …\n"
3572 " (services\n"
3573 " (cons\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"
3585 msgstr ""
3586
3587 #. type: Plain text
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."
3590 msgstr ""
3591
3592 #. type: Plain text
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:"
3595 msgstr ""
3596
3597 #. type: example
3598 #: guix-git/doc/guix-cookbook.texi:2376
3599 #, no-wrap
3600 msgid ""
3601 "sudo herd set-http-proxy guix-daemon http://localhost:9250\n"
3602 "guix build --substitute-urls=https://bp7o7ckwlewr4slm.onion …\n"
3603 msgstr ""
3604
3605 #. type: cindex
3606 #: guix-git/doc/guix-cookbook.texi:2380
3607 #, no-wrap
3608 msgid "nginx, lua, openresty, resty"
3609 msgstr ""
3610
3611 #. type: Plain text
3612 #: guix-git/doc/guix-cookbook.texi:2383
3613 msgid "NGINX could be extended with Lua scripts."
3614 msgstr ""
3615
3616 #. type: Plain text
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."
3619 msgstr ""
3620
3621 #. type: Plain text
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:"
3624 msgstr ""
3625
3626 #. type: example
3627 #: guix-git/doc/guix-cookbook.texi:2393
3628 #, no-wrap
3629 msgid ""
3630 "local shell = require \"resty.shell\"\n"
3631 "\n"
3632 msgstr ""
3633
3634 #. type: example
3635 #: guix-git/doc/guix-cookbook.texi:2397
3636 #, no-wrap
3637 msgid ""
3638 "local stdin = \"\"\n"
3639 "local timeout = 1000 -- ms\n"
3640 "local max_size = 4096 -- byte\n"
3641 "\n"
3642 msgstr ""
3643
3644 #. type: example
3645 #: guix-git/doc/guix-cookbook.texi:2400
3646 #, no-wrap
3647 msgid ""
3648 "local ok, stdout, stderr, reason, status =\n"
3649 " shell.run([[/run/current-system/profile/bin/ls /tmp]], stdin, timeout, max_size)\n"
3650 "\n"
3651 msgstr ""
3652
3653 #. type: example
3654 #: guix-git/doc/guix-cookbook.texi:2402
3655 #, no-wrap
3656 msgid "ngx.say(stdout)\n"
3657 msgstr ""
3658
3659 #. type: lisp
3660 #: guix-git/doc/guix-cookbook.texi:2433
3661 #, no-wrap
3662 msgid ""
3663 "(use-modules (gnu))\n"
3664 "(use-service-modules #;… web)\n"
3665 "(use-package-modules #;… lua)\n"
3666 "(operating-system\n"
3667 " ;; …\n"
3668 " (services\n"
3669 " ;; …\n"
3670 " (service nginx-service-type\n"
3671 " (nginx-configuration\n"
3672 " (modules\n"
3673 " (list\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"
3678 " lua-tablepool\n"
3679 " lua-resty-shell))\n"
3680 " (lua-package-cpath (list lua-resty-signal))\n"
3681 " (server-blocks\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"
3691 msgstr ""
3692
3693 #. type: Plain text
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."
3696 msgstr ""
3697
3698 #. type: Plain text
3699 #: guix-git/doc/guix-cookbook.texi:2447
3700 msgid "@pxref{Package Management,,, guix, GNU Guix Reference Manual} for a complete reference."
3701 msgstr ""
3702
3703 #. type: section
3704 #: guix-git/doc/guix-cookbook.texi:2450 guix-git/doc/guix-cookbook.texi:2452
3705 #: guix-git/doc/guix-cookbook.texi:2453
3706 #, no-wrap
3707 msgid "Guix Profiles in Practice"
3708 msgstr ""
3709
3710 #. type: menuentry
3711 #: guix-git/doc/guix-cookbook.texi:2450
3712 msgid "Strategies for multiple profiles and manifests."
3713 msgstr ""
3714
3715 #. type: Plain text
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."
3718 msgstr ""
3719
3720 #. type: Plain text
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."
3723 msgstr ""
3724
3725 #. type: Plain text
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."
3728 msgstr ""
3729
3730 #. type: Plain text
3731 #: guix-git/doc/guix-cookbook.texi:2471
3732 msgid "Multiple profiles have many benefits:"
3733 msgstr ""
3734
3735 #. type: itemize
3736 #: guix-git/doc/guix-cookbook.texi:2475
3737 msgid "Clean semantic separation of the various packages a user needs for different contexts."
3738 msgstr ""
3739
3740 #. type: itemize
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."
3743 msgstr ""
3744
3745 #. type: itemize
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."
3748 msgstr ""
3749
3750 #. type: itemize
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."
3753 msgstr ""
3754
3755 #. type: itemize
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."
3758 msgstr ""
3759
3760 #. type: itemize
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}."
3763 msgstr ""
3764
3765 #. type: itemize
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."
3768 msgstr ""
3769
3770 #. type: Plain text
3771 #: guix-git/doc/guix-cookbook.texi:2507
3772 msgid "Concretely, here follows some typical profiles:"
3773 msgstr ""
3774
3775 #. type: itemize
3776 #: guix-git/doc/guix-cookbook.texi:2511
3777 msgid "The dependencies of a project you are working on."
3778 msgstr ""
3779
3780 #. type: itemize
3781 #: guix-git/doc/guix-cookbook.texi:2514
3782 msgid "Your favourite programming language libraries."
3783 msgstr ""
3784
3785 #. type: itemize
3786 #: guix-git/doc/guix-cookbook.texi:2517
3787 msgid "Laptop-specific programs (like @samp{powertop}) that you don't need on a desktop."
3788 msgstr ""
3789
3790 #. type: itemize
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)."
3793 msgstr ""
3794
3795 #. type: itemize
3796 #: guix-git/doc/guix-cookbook.texi:2524
3797 msgid "Games."
3798 msgstr ""
3799
3800 #. type: Plain text
3801 #: guix-git/doc/guix-cookbook.texi:2527
3802 msgid "Let's dive in the set up!"
3803 msgstr ""
3804
3805 #. type: subsection
3806 #: guix-git/doc/guix-cookbook.texi:2528 guix-git/doc/guix-cookbook.texi:2529
3807 #, no-wrap
3808 msgid "Basic setup with manifests"
3809 msgstr ""
3810
3811 #. type: Plain text
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:"
3814 msgstr ""
3815
3816 #. type: lisp
3817 #: guix-git/doc/guix-cookbook.texi:2543
3818 #, no-wrap
3819 msgid ""
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"
3826 " ; ...\n"
3827 " \"package-N\"))\n"
3828 msgstr ""
3829
3830 #. type: Plain text
3831 #: guix-git/doc/guix-cookbook.texi:2547
3832 msgid "@pxref{Invoking guix package,,, guix, GNU Guix Reference Manual}, for the syntax details."
3833 msgstr ""
3834
3835 #. type: Plain text
3836 #: guix-git/doc/guix-cookbook.texi:2549
3837 msgid "We can create a manifest specification per profile and install them this way:"
3838 msgstr ""
3839
3840 #. type: example
3841 #: guix-git/doc/guix-cookbook.texi:2554
3842 #, no-wrap
3843 msgid ""
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"
3847 msgstr ""
3848
3849 #. type: Plain text
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."
3852 msgstr ""
3853
3854 #. type: Plain text
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}."
3857 msgstr ""
3858
3859 #. type: Plain text
3860 #: guix-git/doc/guix-cookbook.texi:2566
3861 msgid "Note that it's also possible to loop over the output of"
3862 msgstr ""
3863
3864 #. type: example
3865 #: guix-git/doc/guix-cookbook.texi:2569
3866 #, no-wrap
3867 msgid "guix package --list-profiles\n"
3868 msgstr ""
3869
3870 #. type: Plain text
3871 #: guix-git/doc/guix-cookbook.texi:2572
3872 msgid "although you'll probably have to filter out @file{~/.config/guix/current}."
3873 msgstr ""
3874
3875 #. type: Plain text
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):"
3878 msgstr ""
3879
3880 #. type: example
3881 #: guix-git/doc/guix-cookbook.texi:2584
3882 #, no-wrap
3883 msgid ""
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"
3889 " fi\n"
3890 " unset profile\n"
3891 "done\n"
3892 msgstr ""
3893
3894 #. type: Plain text
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."
3897 msgstr ""
3898
3899 #. type: Plain text
3900 #: guix-git/doc/guix-cookbook.texi:2591
3901 msgid "You can obviously choose to only enable a subset of them:"
3902 msgstr ""
3903
3904 #. type: example
3905 #: guix-git/doc/guix-cookbook.texi:2601
3906 #, no-wrap
3907 msgid ""
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"
3913 " fi\n"
3914 " unset profile\n"
3915 "done\n"
3916 msgstr ""
3917
3918 #. type: Plain text
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:"
3921 msgstr ""
3922
3923 #. type: example
3924 #: guix-git/doc/guix-cookbook.texi:2608
3925 #, no-wrap
3926 msgid "GUIX_PROFILE=\"path/to/my-project\" ; . \"$GUIX_PROFILE\"/etc/profile\n"
3927 msgstr ""
3928
3929 #. type: Plain text
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:"
3932 msgstr ""
3933
3934 #. type: example
3935 #: guix-git/doc/guix-cookbook.texi:2618
3936 #, no-wrap
3937 msgid "guix package --search-paths=prefix --profile=$my_profile\"\n"
3938 msgstr ""
3939
3940 #. type: Plain text
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."
3943 msgstr ""
3944
3945 #. type: Plain text
3946 #: guix-git/doc/guix-cookbook.texi:2624
3947 msgid "To upgrade a profile, simply install the manifest again:"
3948 msgstr ""
3949
3950 #. type: example
3951 #: guix-git/doc/guix-cookbook.texi:2627
3952 #, no-wrap
3953 msgid "guix package -m /path/to/guix-my-project-manifest.scm -p \"$GUIX_EXTRA_PROFILES\"/my-project/my-project\n"
3954 msgstr ""
3955
3956 #. type: Plain text
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:"
3959 msgstr ""
3960
3961 #. type: example
3962 #: guix-git/doc/guix-cookbook.texi:2638
3963 #, no-wrap
3964 msgid ""
3965 "for profile in \"$GUIX_EXTRA_PROFILES\"/*; do\n"
3966 " guix package --profile=\"$profile\" --manifest=\"$HOME/.guix-manifests/guix-$profile-manifest.scm\"\n"
3967 "done\n"
3968 msgstr ""
3969
3970 #. type: Plain text
3971 #: guix-git/doc/guix-cookbook.texi:2641
3972 msgid "Each profile has its own generations:"
3973 msgstr ""
3974
3975 #. type: example
3976 #: guix-git/doc/guix-cookbook.texi:2644
3977 #, no-wrap
3978 msgid "guix package -p \"$GUIX_EXTRA_PROFILES\"/my-project/my-project --list-generations\n"
3979 msgstr ""
3980
3981 #. type: Plain text
3982 #: guix-git/doc/guix-cookbook.texi:2647
3983 msgid "You can roll-back to any generation of a given profile:"
3984 msgstr ""
3985
3986 #. type: example
3987 #: guix-git/doc/guix-cookbook.texi:2650
3988 #, no-wrap
3989 msgid "guix package -p \"$GUIX_EXTRA_PROFILES\"/my-project/my-project --switch-generations=17\n"
3990 msgstr ""
3991
3992 #. type: Plain text
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:"
3995 msgstr ""
3996
3997 #. type: example
3998 #: guix-git/doc/guix-cookbook.texi:2658
3999 #, no-wrap
4000 msgid ""
4001 "env -i $(which bash) --login --noprofile --norc\n"
4002 ". my-project/etc/profile\n"
4003 msgstr ""
4004
4005 #. type: subsection
4006 #: guix-git/doc/guix-cookbook.texi:2660 guix-git/doc/guix-cookbook.texi:2661
4007 #, no-wrap
4008 msgid "Required packages"
4009 msgstr ""
4010
4011 #. type: Plain text
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."
4014 msgstr ""
4015
4016 #. type: emph{#1}
4017 #: guix-git/doc/guix-cookbook.texi:2669
4018 msgid "Note: Only the environmental variables of the packages that consume them will be set."
4019 msgstr ""
4020
4021 #. type: Plain text
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:"
4024 msgstr ""
4025
4026 #. type: itemize
4027 #: guix-git/doc/guix-cookbook.texi:2677
4028 msgid "Either export the variable manually, e.g."
4029 msgstr ""
4030
4031 #. type: example
4032 #: guix-git/doc/guix-cookbook.texi:2679
4033 #, no-wrap
4034 msgid "export MANPATH=/path/to/profile$@{MANPATH:+:@}$MANPATH\n"
4035 msgstr ""
4036
4037 #. type: itemize
4038 #: guix-git/doc/guix-cookbook.texi:2683
4039 msgid "Or include @samp{man-db} to the profile manifest."
4040 msgstr ""
4041
4042 #. type: Plain text
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."
4045 msgstr ""
4046
4047 #. type: subsection
4048 #: guix-git/doc/guix-cookbook.texi:2688 guix-git/doc/guix-cookbook.texi:2689
4049 #, no-wrap
4050 msgid "Default profile"
4051 msgstr ""
4052
4053 #. type: Plain text
4054 #: guix-git/doc/guix-cookbook.texi:2692
4055 msgid "What about the default profile that Guix keeps in @file{~/.guix-profile}?"
4056 msgstr ""
4057
4058 #. type: Plain text
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."
4061 msgstr ""
4062
4063 #. type: Plain text
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"
4066 msgstr ""
4067
4068 #. type: example
4069 #: guix-git/doc/guix-cookbook.texi:2703
4070 #, no-wrap
4071 msgid ""
4072 "guix install package-foo\n"
4073 "guix upgrade package-bar\n"
4074 msgstr ""
4075
4076 #. type: Plain text
4077 #: guix-git/doc/guix-cookbook.texi:2706
4078 msgid "without having to specify the path to a profile."
4079 msgstr ""
4080
4081 #. type: subsection
4082 #: guix-git/doc/guix-cookbook.texi:2707 guix-git/doc/guix-cookbook.texi:2708
4083 #, no-wrap
4084 msgid "The benefits of manifests"
4085 msgstr ""
4086
4087 #. type: Plain text
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."
4090 msgstr ""
4091
4092 #. type: Plain text
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."
4095 msgstr ""
4096
4097 #. type: Plain text
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."
4100 msgstr ""
4101
4102 #. type: Plain text
4103 #: guix-git/doc/guix-cookbook.texi:2723
4104 msgid "Manifests come with multiple benefits. In particular, they ease maintenance:"
4105 msgstr ""
4106
4107 #. type: itemize
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."
4110 msgstr ""
4111
4112 #. type: itemize
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."
4115 msgstr ""
4116
4117 #. type: itemize
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."
4120 msgstr ""
4121
4122 #. type: itemize
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}."
4125 msgstr ""
4126
4127 #. type: itemize
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)."
4130 msgstr ""
4131
4132 #. type: itemize
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}."
4135 msgstr ""
4136
4137 #. type: Plain text
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."
4140 msgstr ""
4141
4142 #. type: Plain text
4143 #: guix-git/doc/guix-cookbook.texi:2770
4144 msgid "Let's take an example:"
4145 msgstr ""
4146
4147 #. type: enumerate
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."
4150 msgstr ""
4151
4152 #. type: enumerate
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."
4155 msgstr ""
4156
4157 #. type: enumerate
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!"
4160 msgstr ""
4161
4162 #. type: Plain text
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."
4165 msgstr ""
4166
4167 #. type: Plain text
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."
4170 msgstr ""
4171
4172 #. type: subsection
4173 #: guix-git/doc/guix-cookbook.texi:2797 guix-git/doc/guix-cookbook.texi:2798
4174 #, no-wrap
4175 msgid "Reproducible profiles"
4176 msgstr ""
4177
4178 #. type: Plain text
4179 #: guix-git/doc/guix-cookbook.texi:2801
4180 msgid "To reproduce a profile bit-for-bit, we need two pieces of information:"
4181 msgstr ""
4182
4183 #. type: itemize
4184 #: guix-git/doc/guix-cookbook.texi:2805
4185 msgid "a manifest,"
4186 msgstr ""
4187
4188 #. type: itemize
4189 #: guix-git/doc/guix-cookbook.texi:2807
4190 msgid "a Guix channel specification."
4191 msgstr ""
4192
4193 #. type: Plain text
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."
4196 msgstr ""
4197
4198 #. type: Plain text
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}."
4201 msgstr ""
4202
4203 #. type: Plain text
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:"
4206 msgstr ""
4207
4208 #. type: example
4209 #: guix-git/doc/guix-cookbook.texi:2822
4210 #, no-wrap
4211 msgid ""
4212 "GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles\n"
4213 "GUIX_EXTRA=$HOME/.guix-extra\n"
4214 "\n"
4215 msgstr ""
4216
4217 #. type: example
4218 #: guix-git/doc/guix-cookbook.texi:2825
4219 #, no-wrap
4220 msgid ""
4221 "mkdir \"$GUIX_EXTRA\"/my-project\n"
4222 "guix pull --channels=channel-specs.scm --profile \"$GUIX_EXTRA/my-project/guix\"\n"
4223 "\n"
4224 msgstr ""
4225
4226 #. type: example
4227 #: guix-git/doc/guix-cookbook.texi:2828
4228 #, no-wrap
4229 msgid ""
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"
4232 msgstr ""
4233
4234 #. type: Plain text
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."
4237 msgstr ""
4238
4239 #. type: Plain text
4240 #: guix-git/doc/guix-cookbook.texi:2839
4241 msgid "Guix provides multiple tools to manage environment. This chapter demonstrate such utilities."
4242 msgstr ""
4243
4244 #. type: section
4245 #: guix-git/doc/guix-cookbook.texi:2842 guix-git/doc/guix-cookbook.texi:2844
4246 #: guix-git/doc/guix-cookbook.texi:2845
4247 #, no-wrap
4248 msgid "Guix environment via direnv"
4249 msgstr ""
4250
4251 #. type: menuentry
4252 #: guix-git/doc/guix-cookbook.texi:2842
4253 msgid "Setup Guix environment with direnv"
4254 msgstr ""
4255
4256 #. type: Plain text
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."
4259 msgstr ""
4260
4261 #. type: Plain text
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}."
4264 msgstr ""
4265
4266 #. type: Plain text
4267 #: guix-git/doc/guix-cookbook.texi:2858
4268 msgid "Create a @file{~/.direnvrc} with a Bash code:"
4269 msgstr ""
4270
4271 #. type: example
4272 #: guix-git/doc/guix-cookbook.texi:2876
4273 #, no-wrap
4274 msgid ""
4275 "# Thanks <https://github.com/direnv/direnv/issues/73#issuecomment-152284914>\n"
4276 "export_function()\n"
4277 "@{\n"
4278 " local name=$1\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"
4289 " fi\n"
4290 "@}\n"
4291 "\n"
4292 msgstr ""
4293
4294 #. type: example
4295 #: guix-git/doc/guix-cookbook.texi:2881
4296 #, no-wrap
4297 msgid ""
4298 "use_guix()\n"
4299 "@{\n"
4300 " # Set GitHub token.\n"
4301 " export GUIX_GITHUB_TOKEN=\"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n"
4302 "\n"
4303 msgstr ""
4304
4305 #. type: example
4306 #: guix-git/doc/guix-cookbook.texi:2884
4307 #, no-wrap
4308 msgid ""
4309 " # Unset 'GUIX_PACKAGE_PATH'.\n"
4310 " export GUIX_PACKAGE_PATH=\"\"\n"
4311 "\n"
4312 msgstr ""
4313
4314 #. type: example
4315 #: guix-git/doc/guix-cookbook.texi:2893
4316 #, no-wrap
4317 msgid ""
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"
4323 " then\n"
4324 " rm -v \"$gcroot\"\n"
4325 " fi\n"
4326 "\n"
4327 msgstr ""
4328
4329 #. type: example
4330 #: guix-git/doc/guix-cookbook.texi:2908
4331 #, no-wrap
4332 msgid ""
4333 " # Miscellaneous packages.\n"
4334 " PACKAGES_MAINTENANCE=(\n"
4335 " direnv\n"
4336 " git\n"
4337 " git:send-email\n"
4338 " git-cal\n"
4339 " gnupg\n"
4340 " guile-colorized\n"
4341 " guile-readline\n"
4342 " less\n"
4343 " ncurses\n"
4344 " openssh\n"
4345 " xdot\n"
4346 " )\n"
4347 "\n"
4348 msgstr ""
4349
4350 #. type: example
4351 #: guix-git/doc/guix-cookbook.texi:2911
4352 #, no-wrap
4353 msgid ""
4354 " # Environment packages.\n"
4355 " PACKAGES=(help2man guile-sqlite3 guile-gcrypt)\n"
4356 "\n"
4357 msgstr ""
4358
4359 #. type: example
4360 #: guix-git/doc/guix-cookbook.texi:2914
4361 #, no-wrap
4362 msgid ""
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"
4365 "\n"
4366 msgstr ""
4367
4368 #. type: example
4369 #: guix-git/doc/guix-cookbook.texi:2921
4370 #, no-wrap
4371 msgid ""
4372 " # Predefine configure flags.\n"
4373 " configure()\n"
4374 " @{\n"
4375 " ./configure --localstatedir=/var --prefix=\n"
4376 " @}\n"
4377 " export_function configure\n"
4378 "\n"
4379 msgstr ""
4380
4381 #. type: example
4382 #: guix-git/doc/guix-cookbook.texi:2932
4383 #, no-wrap
4384 msgid ""
4385 " # Run make and optionally build something.\n"
4386 " build()\n"
4387 " @{\n"
4388 " make -j 2\n"
4389 " if [ $# -gt 0 ]\n"
4390 " then\n"
4391 " ./pre-inst-env guix build \"$@@\"\n"
4392 " fi\n"
4393 " @}\n"
4394 " export_function build\n"
4395 "\n"
4396 msgstr ""
4397
4398 #. type: example
4399 #: guix-git/doc/guix-cookbook.texi:2939
4400 #, no-wrap
4401 msgid ""
4402 " # Predefine push Git command.\n"
4403 " push()\n"
4404 " @{\n"
4405 " git push --set-upstream origin\n"
4406 " @}\n"
4407 " export_function push\n"
4408 "\n"
4409 msgstr ""
4410
4411 #. type: example
4412 #: guix-git/doc/guix-cookbook.texi:2942
4413 #, no-wrap
4414 msgid ""
4415 " clear # Clean up the screen.\n"
4416 " git-cal --author='Your Name' # Show contributions calendar.\n"
4417 "\n"
4418 msgstr ""
4419
4420 #. type: example
4421 #: guix-git/doc/guix-cookbook.texi:2950
4422 #, no-wrap
4423 msgid ""
4424 " # Show commands help.\n"
4425 " echo \"\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"
4429 "\"\n"
4430 "@}\n"
4431 msgstr ""
4432
4433 #. type: Plain text
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."
4436 msgstr ""
4437
4438 #. type: Plain text
4439 #: guix-git/doc/guix-cookbook.texi:2956
4440 msgid "Run @command{direnv allow} to setup the environment for the first time."
4441 msgstr ""
4442
4443 #. type: Plain text
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."
4446 msgstr ""
4447
4448 #. type: Plain text
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."
4451 msgstr ""
4452
4453 #. type: Plain text
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!"
4456 msgstr ""
4457
4458 #. type: Plain text
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}."
4461 msgstr ""
4462
4463 #. type: cindex
4464 #: guix-git/doc/guix-cookbook.texi:2985
4465 #, no-wrap
4466 msgid "license, GNU Free Documentation License"
4467 msgstr ""
4468
4469 #. type: include
4470 #: guix-git/doc/guix-cookbook.texi:2986
4471 #, no-wrap
4472 msgid "fdl-1.3.texi"
4473 msgstr ""