doc: Document how to enable qemu binfmt service and how to use it.
[jackhill/guix/guix.git] / doc / guix.de.texi
CommitLineData
1e40e70b
JL
1\input texinfo
2@c ===========================================================================
3@c
4@c This file was generated with po4a. Translate the source file.
5@c
6@c ===========================================================================
7@c -*-texinfo-*-
8
9@c %**start of header
10@setfilename guix.de.info
11@documentencoding UTF-8
12@documentlanguage de
13@frenchspacing on
14@settitle Referenzhandbuch zu GNU Guix
15@c %**end of header
16
17@include version-de.texi
18
19@c Identifier of the OpenPGP key used to sign tarballs and such.
20@set OPENPGP-SIGNING-KEY-ID 3CE464558A84FDC69DB40CFB090B11993D9AEBB5
793dcd8c 21@set KEY-SERVER pool.sks-keyservers.net
1e40e70b
JL
22
23@copying
24Copyright @copyright{} 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic
25Courtès@* Copyright @copyright{} 2013, 2014, 2016 Andreas Enge@* Copyright
26@copyright{} 2013 Nikita Karetnikov@* Copyright @copyright{} 2014, 2015,
272016 Alex Kost@* Copyright @copyright{} 2015, 2016 Mathieu Lirzin@*
28Copyright @copyright{} 2014 Pierre-Antoine Rault@* Copyright @copyright{}
292015 Taylan Ulrich Bayırlı/Kammer@* Copyright @copyright{} 2015, 2016, 2017
30Leo Famulari@* Copyright @copyright{} 2015, 2016, 2017, 2018 Ricardo
31Wurmus@* Copyright @copyright{} 2016 Ben Woodcroft@* Copyright @copyright{}
322016, 2017, 2018 Chris Marusich@* Copyright @copyright{} 2016, 2017, 2018
33Efraim Flashner@* Copyright @copyright{} 2016 John Darrington@* Copyright
34@copyright{} 2016, 2017 Nils Gillmann@* Copyright @copyright{} 2016, 2017,
352018 Jan Nieuwenhuizen@* Copyright @copyright{} 2016 Julien Lepiller@*
36Copyright @copyright{} 2016 Alex ter Weele@* Copyright @copyright{} 2017,
793dcd8c 372018 Clément Lassieur@* Copyright @copyright{} 2017, 2018 Mathieu Othacehe@*
1e40e70b
JL
38Copyright @copyright{} 2017 Federico Beffa@* Copyright @copyright{} 2017,
392018 Carlo Zancanaro@* Copyright @copyright{} 2017 Thomas Danckaert@*
40Copyright @copyright{} 2017 humanitiesNerd@* Copyright @copyright{} 2017
41Christopher Allan Webber@* Copyright @copyright{} 2017, 2018 Marius Bakke@*
42Copyright @copyright{} 2017 Hartmut Goebel@* Copyright @copyright{} 2017
43Maxim Cournoyer@* Copyright @copyright{} 2017, 2018 Tobias Geerinckx-Rice@*
44Copyright @copyright{} 2017 George Clemmer@* Copyright @copyright{} 2017
45Andy Wingo@* Copyright @copyright{} 2017, 2018 Arun Isaac@* Copyright
46@copyright{} 2017 nee@* Copyright @copyright{} 2018 Rutger Helling@*
47Copyright @copyright{} 2018 Oleg Pykhalov@* Copyright @copyright{} 2018 Mike
48Gerwitz@* Copyright @copyright{} 2018 Pierre-Antoine Rouby@* Copyright
49@copyright{} 2018 Gábor Boskovits@* Copyright @copyright{} 2018 Florian
793dcd8c
LC
50Pelz@* Copyright @copyright{} 2018 Laura Lazzati@* Copyright @copyright{}
512018 Alex Vong@*
1e40e70b
JL
52
53Es ist Ihnen gestattet, dieses Dokument zu vervielfältigen, weiterzugeben
54und/oder zu verändern, unter den Bedingungen der GNU Free Documentation
55License, entweder gemäß Version 1.3 der Lizenz oder (nach Ihrer Option)
56einer späteren Version, die von der Free Software Foundation veröffentlicht
57wurde, ohne unveränderliche Abschnitte, ohne vorderen Umschlagtext und ohne
58hinteren Umschlagtext. Eine Kopie der Lizenz finden Sie im Abschnitt mit dem
59Titel »GNU Free Documentation License«.
60@end copying
61
62@dircategory Systemadministration
63@direntry
64* Guix: (guix.de). Installierte Software und Systemkonfigurationen
65 verwalten.
66* guix package: (guix.de)guix package aufrufen. Pakete installieren,
67 entfernen und
68 aktualisieren.
69* guix gc: (guix.de)guix gc aufrufen. Unbenutzten Plattenspeicher wieder
70 freigeben.
71* guix pull: (guix.de)guix pull aufrufen. Die Liste verfügbarer Pakete
72 aktualisieren.
73* guix system: (guix.de)guix system aufrufen. Die
74 Betriebssystemkonfiguration
75 verwalten.
76@end direntry
77
78@dircategory Softwareentwicklung
79@direntry
80* guix environment: (guix.de)guix environment aufrufen. Umgebungen für
81 Entwickler
82 erstellen
83* guix build: (guix.de)guix build aufrufen. Erstellen von Paketen.
84* guix pack: (guix.de)guix pack aufrufen. Bündel aus Binärdateien
85 erstellen.
86@end direntry
87
88@titlepage
89@title Referenzhandbuch zu GNU Guix
90@subtitle Den funktionalen Paketmanager GNU Guix benutzen
91@author Die GNU-Guix-Entwickler
92
93@page
94@vskip 0pt plus 1filll
95Edition @value{EDITION} @* @value{UPDATED} @*
96
97@insertcopying
98@end titlepage
99
100@contents
101
102@c *********************************************************************
103@node Top
104@top GNU Guix
105
106Dieses Dokument beschreibt GNU Guix, Version @value{VERSION}, ein
107funktionales Paketverwaltungswerkzeug, das für das GNU-System geschrieben
108wurde.
109
110@c TRANSLATORS: You can replace the following paragraph with information on
111@c how to join your own translation team and how to report issues with the
112@c translation.
113This manual is also available in French (@pxref{Top,,, guix.fr, Manuel de
793dcd8c
LC
114référence de GNU Guix}) and German (@pxref{Top,,, guix.de, Referenzhandbuch
115zu GNU Guix}). If you would like to translate it in your native language,
116consider joining the
1e40e70b
JL
117@uref{https://translationproject.org/domain/guix-manual.html, Translation
118Project}.
119
120@menu
121* Einführung:: Was ist Guix überhaupt?
122* Installation:: Guix installieren.
123* Paketverwaltung:: Pakete installieren, aktualisieren usw.
124* Programmierschnittstelle:: Guix in Scheme verwenden.
125* Zubehör:: Befehle zur Paketverwaltung.
126* GNU-Distribution:: Software für Ihr freundliches GNU-System.
127* Mitwirken:: Ihre Hilfe ist nötig!
128
129* Danksagungen:: Danke!
130* GNU-Lizenz für freie Dokumentation:: Die Lizenz dieses Handbuchs.
131* Konzeptverzeichnis:: Konzepte.
132* Programmierverzeichnis:: Datentypen, Funktionen und Variable.
133
134@detailmenu
135 --- Detaillierte Liste der Knoten ---
136
137
138
139Installation
140
141
142
143* Aus Binärdatei installieren:: Guix installieren, ohne Zeit zu verlieren!
144* Voraussetzungen:: Zum Erstellen und Benutzen von Guix nötige
145 Software.
146* Die Testsuite laufen lassen:: Guix testen.
147* Den Daemon einrichten:: Wie man die Umgebung des Erstellungs-Daemons
148 einrichtet.
149* Aufruf des guix-daemon:: Den Erstellungs-Daemon laufen lassen.
150* Anwendungen einrichten:: Anwendungsspezifische Einstellungen.
151
152Den Daemon einrichten
153
154
155
156* Einrichten der Erstellungsumgebung:: Die isolierte Umgebung zum Erstellen
157 vorbereiten.
158* Auslagern des Daemons einrichten:: Erstellungen auf entfernte Maschinen
159 auslagern.
160* SELinux-Unterstützung:: Wie man eine SELinux-Richtlinie für den Daemon
161 einrichtet.
162
163Paketverwaltung
164
165
166
167* Funktionalitäten:: Wie Guix Ihr Leben schöner machen wird.
168* Aufruf von guix package:: Pakete installieren, entfernen usw.
169* Substitute:: Vorerstelle Binärdateien herunterladen.
170* Pakete mit mehreren Ausgaben.:: Ein Quellpaket, mehrere Ausgaben.
171* Aufruf von guix gc:: Den Müllsammler laufen lassen.
172* Aufruf von guix pull:: Das neueste Guix samt Distribution laden.
173* Channels:: Customizing the package collection.
174* Inferiors:: Interacting with another revision of Guix.
175* Invoking guix describe:: Display information about your Guix revision.
176* Aufruf von guix pack:: Software-Bündel erstellen.
177* Aufruf von guix archive:: Import und Export von Store-Dateien.
178
179Substitute
180
181
182
183* Offizieller Substitut-Server:: Eine besondere Quelle von Substituten.
184* Substitut-Server autorisieren:: Wie man Substitute an- und abschaltet.
185* Substitutauthentifizierung:: Wie Guix Substitute verifiziert.
186* Proxy-Einstellungen:: Wie Sie Substitute über einen Proxy beziehen.
187* Fehler bei der Substitution:: Was passiert, wenn die Substitution
188 fehlschlägt.
189* Vom Vertrauen gegenüber Binärdateien:: Wie können Sie diesem binären
190 Blob trauen?
191
192Programmierschnittstelle
193
194
195
196* Pakete definieren:: Wie Sie neue Pakete definieren.
197* Erstellungssysteme:: Angeben, wie Pakete erstellt werden.
198* Der Store:: Den Paket-Store verändern.
199* Ableitungen:: Systemnahe Schnittstelle für Paketableitungen.
200* Die Store-Monade:: Rein funktionale Schnittstelle zum Store.
201* G-Ausdrücke:: Erstellungsausdrücke verarbeiten.
202* Invoking guix repl:: Fiddling with Guix interactively.
203
204Pakete definieren
205
206
207
208* „package“-Referenz:: Der Datentyp für Pakete.
209* „origin“-Referenz:: Datentyp für Paketursprünge.
210
211Zubehör
212
213
214
215* Aufruf von guix build:: Pakete aus der Befehlszeile heraus erstellen.
216* Aufruf von guix edit:: Paketdefinitionen bearbeiten.
217* Aufruf von guix download:: Herunterladen einer Datei und Ausgabe ihres
218 Hashes.
219* Aufruf von guix hash:: Den kryptographischen Hash einer Datei
220 berechnen.
221* Aufruf von guix import:: Paketdefinitionen importieren.
222* Aufruf von guix refresh:: Paketdefinitionen aktualisieren.
223* Aufruf von guix lint:: Fehler in Paketdefinitionen finden.
224* Aufruf von guix size:: Plattenverbrauch profilieren.
225* Aufruf von guix graph:: Den Paketgraphen visualisieren.
226* Aufruf von guix environment:: Entwicklungsumgebungen einrichten.
227* Aufruf von guix publish:: Substitute teilen.
228* Aufruf von guix challenge:: Die Substitut-Server anfechten.
229* Aufruf von guix copy:: Mit einem entfernten Store Dateien austauschen.
230* Aufruf von guix container:: Prozesse isolieren.
231* Aufruf von guix weather:: Die Verfügbarkeit von Substituten
232 einschätzen.
233* Invoking guix processes:: Listing client processes.
234
235Aufruf von @command{guix build}
236
237
238
239* Gemeinsame Erstellungsoptionen:: Erstellungsoptionen für die meisten
240 Befehle.
241* Paketumwandlungsoptionen:: Varianten von Paketen erzeugen.
242* Zusätzliche Erstellungsoptionen:: Optionen spezifisch für »guix
243 build«.
244* Fehlschläge beim Erstellen untersuchen:: Praxiserfahrung bei der
245 Paketerstellung.
246
247GNU-Distribution
248
249
250
251* Systeminstallation:: Das ganze Betriebssystem installieren.
252* Systemkonfiguration:: Das Betriebssystem konfigurieren.
253* Dokumentation:: Wie man Nutzerhandbücher von Software liest.
254* Dateien zur Fehlersuche installieren:: Womit man seinen Debugger
255 füttert.
256* Sicherheitsaktualisierungen:: Sicherheits-Patches schnell einspielen.
257* Paketmodule:: Pakete aus Sicht des Programmierers.
258* Paketrichtlinien:: Die Distribution wachsen lassen.
259* Bootstrapping:: GNU/Linux von Grund auf selbst erstellen.
260* Portierung:: Guix auf andere Plattformen und Kernels
261 bringen.
262
263Systeminstallation
264
265
266
267* Einschränkungen:: Was Sie erwarten dürfen.
268* Hardware-Überlegungen:: Unterstützte Hardware.
269* Installation von USB-Stick oder DVD:: Das Installationsmedium
270 vorbereiten.
271* Vor der Installation:: Netzwerkanbindung, Partitionierung etc.
272* Fortfahren mit der Installation:: Die Hauptsache.
273* GuixSD in einer VM installieren:: Ein GuixSD-Spielplatz.
274* Ein Abbild zur Installation erstellen:: Wie ein solches entsteht.
275
276Systemkonfiguration
277
278
279
793dcd8c 280* Das Konfigurationssystem nutzen:: Ihr GNU-System anpassen.
1e40e70b
JL
281* „operating-system“-Referenz:: Details der
282 Betriebssystem-Deklarationen.
283* Dateisysteme:: Die Dateisystemeinbindungen konfigurieren.
793dcd8c 284* Abgebildete Geräte:: Näheres zu blockorientierten Speichermedien.
1e40e70b 285* Benutzerkonten:: Benutzerkonten festlegen.
793dcd8c 286* Locales:: Sprache und kulturelle Konventionen.
1e40e70b 287* Dienste:: Systemdienste festlegen.
793dcd8c 288* Setuid-Programme:: Mit Administratorrechten startende Programme.
1e40e70b
JL
289* X.509-Zertifikate:: HTTPS-Server authentifizieren.
290* Name Service Switch:: Den Name Service Switch von libc konfigurieren.
291* Initiale RAM-Disk:: Linux-libre hochfahren.
292* Bootloader-Konfiguration:: Den Bootloader konfigurieren.
793dcd8c 293* Aufruf von guix system:: Instanzierung einer Systemkonfiguration.
1e40e70b
JL
294* GuixSD in einer VM starten:: Wie man GuixSD in einer virtuellen Maschine
295 startet.
296* Dienste definieren:: Neue Dienstdefinitionen hinzufügen.
297
298Dienste
299
300
301
793dcd8c 302* Basisdienste:: Essenzielle Systemdienste.
1e40e70b
JL
303* Geplante Auftragsausführung:: Der mcron-Dienst.
304* Log-Rotation:: Der rottlog-Dienst.
305* Netzwerkdienste:: Netzwerkeinrichtung, SSH-Daemon etc.
306* X Window:: Graphische Anzeige.
307* Druckdienste:: Unterstützung für lokale und entfernte
308 Drucker.
309* Desktop-Dienste:: D-Bus- und Desktop-Dienste.
793dcd8c 310* Sound Services:: ALSA and Pulseaudio services.
1e40e70b
JL
311* Datenbankdienste:: SQL-Datenbanken, Schlüssel-Wert-Speicher etc.
312* Mail-Dienste:: IMAP, POP3, SMTP und so weiter.
313* Kurznachrichtendienste:: Dienste für Kurznachrichten.
314* Telefondienste:: Telefoniedienste.
315* Überwachungsdienste:: Dienste zur Systemüberwachung.
316* Kerberos-Dienste:: Kerberos-Dienste.
317* Web-Dienste:: Web-Server.
318* Zertifikatsdienste:: TLS-Zertifikate via Let’s Encrypt.
319* DNS-Dienste:: DNS-Daemons.
320* VPN-Dienste:: VPN-Daemons.
321* Network File System:: Dienste mit Bezug zum Netzwerkdateisystem.
793dcd8c 322* Kontinuierliche Integration:: Der Cuirass-Dienst.
1e40e70b
JL
323* Power Management Services:: Extending battery life.
324* Audio-Dienste:: Der MPD.
325* Virtualisierungsdienste:: Dienste für virtuelle Maschinen.
326* Versionskontrolldienste:: Entfernten Zugang zu Git-Repositorys bieten.
327* Spieldienste:: Spielserver.
328* Verschiedene Dienste:: Andere Dienste.
329
330Dienste definieren
331
332
333
334* Dienstkompositionen:: Wie Dienste zusammengestellt werden.
335* Diensttypen und Dienste:: Typen und Dienste.
793dcd8c 336* Service-Referenz:: Referenz zur Programmierschnittstelle.
1e40e70b
JL
337* Shepherd-Dienste:: Eine spezielle Art von Dienst.
338
339Paketrichtlinien
340
341
342
343* Software-Freiheit:: Was in die Distribution aufgenommen werden
344 darf.
345* Paketbenennung:: Was macht einen Namen aus?
346* Versionsnummern:: Wenn der Name noch nicht genug ist.
347* Zusammenfassungen und Beschreibungen:: Den Nutzern helfen, das richtige
348 Paket zu finden.
349* Python-Module:: Ein Touch britischer Comedy.
350* Perl-Module:: Kleine Perlen.
351* Java-Pakete:: Kaffeepause.
352* Schriftarten:: Schriften verschriftlicht.
353
354Mitwirken
355
356
357
358* Erstellung aus dem Git:: Das Neueste und Beste.
359* Guix vor der Installation ausführen:: Hacker-Tricks.
360* Perfekt eingerichtet:: Die richtigen Werkzeuge.
361* Code-Stil:: Wie Mitwirkende hygienisch arbeiten.
362* Einreichen von Patches:: Teilen Sie Ihre Arbeit.
363
364Code-Stil
365
366
367
368* Programmierparadigmen:: Wie Sie Ihre Elemente zusammenstellen.
369* Module:: Wo Sie Ihren Code unterbringen.
370* Datentypen und Mustervergleich:: Implementierung von Datenstrukturen.
371* Formatierung von Code:: Schreibkonventionen.
372
373@end detailmenu
374@end menu
375
376@c *********************************************************************
377@node Einführung
378@chapter Einführung
379
380@cindex Zweck
381GNU Guix@footnote{»Guix« wird wie »geeks« ausgesprochen, also als »ɡiːks« in
382der Notation des Internationalen Phonetischen Alphabets (IPA).} ist ein
383Werkzeug zur Paketverwaltung für das GNU-System. Guix macht es
384unprivilegierten Nutzern leicht, Pakete zu installieren, zu aktualisieren
385oder zu entfernen, zu einem vorherigen Satz von Paketen zurückzuwechseln,
386Pakete aus ihrem Quellcode heraus zu erstellen und hilft allgemein bei der
387Schöpfung und Wartung von Software-Umgebungen.
388
389@cindex Benutzeroberflächen
793dcd8c 390Guix bietet eine befehlszeilenbasierte Paketverwaltungsschnittstelle
1e40e70b
JL
391(@pxref{Aufruf von guix package}), einen Satz Befehlszeilenwerkzeuge
392(@pxref{Zubehör}) sowie Schnittstellen zur Programmierung in Scheme
393(@pxref{Programmierschnittstelle}).
394@cindex Erstellungs-Daemon
395Der @dfn{Erstellungs-Daemon} ist für das Erstellen von Paketen im Auftrag
396von Nutzern verantwortlich (@pxref{Den Daemon einrichten}) und für das
397Herunterladen vorerstellter Binärdateien aus autorisierten Quellen
398(@pxref{Substitute}).
399
400@cindex Erweiterbarkeit der Distribution
401@cindex Anpassung, von Paketen
402Guix enthält Paketdefinitionen für viele Pakete, von GNU und nicht von GNU,
403die alle @uref{https://www.gnu.org/philosophy/free-sw.html, die Freiheit des
404Computernutzers respektieren}. Es ist @emph{erweiterbar}: Nutzer können ihre
405eigenen Paketdefinitionen schreiben (@pxref{Pakete definieren}) und sie als
406unabhängige Paketmodule verfügbar machen (@pxref{Paketmodule}). Es ist
407auch @emph{anpassbar}: Nutzer können spezialisierte Paketdefinitionen aus
408bestehenden @emph{ableiten}, auch von der Befehlszeile (@pxref{Paketumwandlungsoptionen}).
409
410@cindex Guix System Distribution
411@cindex GuixSD
412Sie können GNU@tie{}Guix auf ein bestehendes GNU/Linux-System aufsetzen, wo
413es die bereits verfügbaren Werkzeuge ergänzt, ohne zu stören
414(@pxref{Installation}), oder Sie können es eigenständig als Teil der
415@dfn{Guix System Distribution}, kurz GuixSD (@pxref{GNU-Distribution}),
416verwenden. Mit GNU@tie{}GuixSD @emph{deklarieren} Sie alle Aspekte der
417Betriebssystemkonfiguration und Guix kümmert sich darum, die Konfiguration
793dcd8c 418auf transaktionsbasierte, reproduzierbare und zustandslose Weise zu
1e40e70b
JL
419instanzieren (@pxref{Systemkonfiguration}).
420
421@cindex funktionale Paketverwaltung
793dcd8c 422@cindex isolation
1e40e70b
JL
423Intern implementiert Guix die Disziplin der @dfn{funktionalen
424Paketverwaltung}, zu der Nix schon die Pionierarbeit geleistet hat
425(@pxref{Danksagungen}). In Guix wird der Prozess, ein Paket zu erstellen
426und zu installieren, als eine @emph{Funktion} im mathematischen Sinn
427aufgefasst. Diese Funktion hat Eingaben, wie zum Beispiel
428Erstellungs-Skripts, einen Compiler und Bibliotheken, und liefert ein
429installiertes Paket. Als eine reine Funktion hängt sein Ergebnis allein von
430seinen Eingaben ab — zum Beispiel kann er nicht auf Software oder Skripts
431Bezug nehmen, die nicht ausdrücklich als Eingaben übergeben wurden. Eine
432Erstellungsfunktion führt immer zum selben Ergebnis, wenn ihr die gleiche
433Menge an Eingaben übergeben wurde. Sie kann die Umgebung des laufenden
434Systems auf keine Weise beeinflussen, zum Beispiel kann sie keine Dateien
435außerhalb ihrer Erstellungs- und Installationsverzeichnisse verändern. Um
436dies zu erreichen, laufen Erstellungsprozesse in isolieren Umgebungen
437(sogenannte @dfn{Container}), wo nur ausdrückliche Eingaben sichtbar sind.
438
439@cindex Store
440Das Ergebnis von Paketerstellungsfunktionen wird im Dateisystem
441@dfn{zwischengespeichert} in einem besonderen Verzeichnis, was als @dfn{der
442Store} bezeichnet wird (@pxref{Der Store}). Jedes Paket wird in sein eigenes
443Verzeichnis im Store installiert — standardmäßig ist er unter
444@file{/gnu/store} zu finden. Der Verzeichnisname enthält einen Hash aller
445Eingaben, anhand derer das Paket erzeugt wurde, somit hat das Ändern einer
446Eingabe einen völlig anderen Verzeichnisnamen zur Folge.
447
448Dieses Vorgehen ist die Grundlage für die Guix auszeichnenden
449Funktionalitäten: Unterstützung transaktionsbasierter Paketaktualisierungen
450und -rückstufungen, Installation von Paketen als einfacher Nutzer sowie
451Garbage Collection für Pakete (@pxref{Funktionalitäten}).
452
453
454@c *********************************************************************
455@node Installation
456@chapter Installation
457
458@cindex Guix installieren
793dcd8c 459@cindex official website
1e40e70b
JL
460GNU Guix kann von seiner Webseite unter
461@url{http://www.gnu.org/software/guix/} heruntergeladen werden. Dieser
462Abschnitt beschreibt die Software-Voraussetzungen von Guix und wie man es
463installiert, so dass man es benutzen kann.
464
465Beachten Sie, dass es in diesem Abschnitt um die Installation des
466Paketverwaltungswerkzeugs geht, welche auf einem laufenden GNU/Linux-System
467vollzogen werden kann. Falls Sie stattdessen das vollständige
468GNU-Betriebssystem installieren möchten, werfen Sie einen Blick in den
469Abschnitt @pxref{Systeminstallation}.
470
471@cindex Fremddistribution
793dcd8c
LC
472@cindex directories related to foreign distro
473
1e40e70b
JL
474Wenn es auf ein bestehendes GNU/Linux-System installiert wird — im Folgenden
475als @dfn{Fremddistribution} bezeichnet —, ergänzt GNU@tie{}Guix die
476verfügbaren Werkzeuge, ohne dass sie sich gegenseitig stören. Guix’ Daten
477befinden sich ausschließlich in zwei Verzeichnissen, üblicherweise
478@file{/gnu/store} und @file{/var/guix}; andere Dateien auf Ihrem System wie
479@file{/etc} bleiben unberührt.
480
481Sobald es installiert ist, kann Guix durch Ausführen von @command{guix pull}
482aktualisiert werden (@pxref{Aufruf von guix pull}).
483
484@menu
485* Aus Binärdatei installieren:: Guix installieren, ohne Zeit zu verlieren!
486* Voraussetzungen:: Zum Erstellen und Benutzen von Guix nötige
487 Software.
488* Die Testsuite laufen lassen:: Guix testen.
489* Den Daemon einrichten:: Wie man die Umgebung des Erstellungs-Daemons
490 einrichtet.
491* Aufruf des guix-daemon:: Den Erstellungs-Daemon laufen lassen.
492* Anwendungen einrichten:: Anwendungsspezifische Einstellungen.
493@end menu
494
495@node Aus Binärdatei installieren
496@section Aus Binärdatei installieren
497
498@cindex Guix aus Binärdateien installieren
793dcd8c 499@cindex installer script
1e40e70b
JL
500Dieser Abschnitt beschreibt, wie sich Guix auf einem beliebigen System aus
501einem alle Komponenten umfassenden Tarball installieren lässt, der
502Binärdateien für Guix und all seine Abhängigkeiten liefert. Dies geht in der
793dcd8c
LC
503Regel schneller, als Guix aus seinen Quelldateien zu installieren, was in
504den nächsten Abschnitten beschrieben wird. Vorausgesetzt wird hier
505lediglich, dass GNU@tie{}tar und Xz verfügbar sind.
1e40e70b
JL
506
507Wir bieten ein
508@uref{https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh,
509Installations-Skript für die Shell}, welches Guix automatisch herunterlädt,
510installiert und eine erste Konfiguration von Guix mit sich bringt. Es sollte
511als der Administratornutzer (als »root«) ausgeführt werden.
512
513Die Installation läuft so ab:
514
515@enumerate
516@item
517@cindex Guix-Binärdatei herunterladen
518Download the binary tarball from
519@indicateurl{https://alpha.gnu.org/gnu/guix/guix-binary-@value{VERSION}.@var{system}.tar.xz},
520where @var{system} is @code{x86_64-linux} for an @code{x86_64} machine
521already running the kernel Linux, and so on.
522
523@c The following is somewhat duplicated in ``System Installation''.
524Achten Sie darauf, auch die zugehörige @file{.sig}-Datei herunterzuladen und
525verifizieren Sie damit die Authentizität des Tarballs, ungefähr so:
526
527@example
528$ wget https://alpha.gnu.org/gnu/guix/guix-binary-@value{VERSION}.@var{system}.tar.xz.sig
529$ gpg --verify guix-binary-@value{VERSION}.@var{system}.tar.xz.sig
530@end example
531
532Falls dieser Befehl fehlschlägt, weil Sie nicht über den nötigen
533öffentlichen Schlüssel verfügen, können Sie ihn mit diesem Befehl
534importieren:
535
536@example
793dcd8c
LC
537$ gpg --keyserver @value{KEY-SERVER} \
538 --recv-keys @value{OPENPGP-SIGNING-KEY-ID}
1e40e70b
JL
539@end example
540
541@noindent
542@c end authentication part
543und den Befehl @code{gpg --verify} erneut ausführen.
544
545@item
546Nun müssen Sie zum Administratornutzer @code{root} wechseln. Abhängig von
547Ihrer Distribution müssen Sie dazu etwa @code{su -} oder @code{sudo -i}
548ausführen. Danach führen Sie als @code{root}-Nutzer aus:
549
550@example
551# cd /tmp
552# tar --warning=no-timestamp -xf \
553 guix-binary-@value{VERSION}.@var{system}.tar.xz
554# mv var/guix /var/ && mv gnu /
555@end example
556
557Dadurch wird @file{/gnu/store} (@pxref{Der Store}) und @file{/var/guix}
793dcd8c
LC
558erzeugt. Letzteres enthält ein fertiges Guix-Profil für den
559Administratornutzer @code{root} (wie im nächsten Schritt beschrieben).
1e40e70b
JL
560
561Entpacken Sie den Tarball @emph{nicht} auf einem schon funktionierenden
562Guix-System, denn es würde seine eigenen essenziellen Dateien überschreiben.
563
564Die Befehlszeilenoption @code{--warning=no-timestamp} stellt sicher, dass
565GNU@tie{}tar nicht vor »unplausibel alten Zeitstempeln« warnt (solche
566Warnungen traten bei GNU@tie{}tar 1.26 und älter auf, neue Versionen machen
793dcd8c 567keine Probleme). Sie treten auf, weil alle Dateien im Archiv als
1e40e70b
JL
568Änderungszeitpunkt null eingetragen bekommen haben (das bezeichnet den
5691. Januar 1970). Das ist Absicht, damit der Inhalt des Archivs nicht davon
570abhängt, wann es erstellt wurde, und es somit reproduzierbar wird.
571
572@item
793dcd8c
LC
573Make the profile available under @file{~root/.config/guix/current}, which is
574where @command{guix pull} will install updates (@pxref{Aufruf von guix pull}):
1e40e70b
JL
575
576@example
793dcd8c
LC
577# mkdir -p ~root/.config/guix
578# ln -sf /var/guix/profiles/per-user/root/current-guix \
579 ~root/.config/guix/current
1e40e70b
JL
580@end example
581
582»Sourcen« Sie @file{etc/profile}, um @code{PATH} und andere relevante
583Umgebungsvariable zu ergänzen:
584
585@example
793dcd8c 586# GUIX_PROFILE="`echo ~root`/.config/guix/current" ; \
1e40e70b
JL
587 source $GUIX_PROFILE/etc/profile
588@end example
589
590@item
591Erzeugen Sie Nutzergruppe und Nutzerkonten für die Erstellungs-Benutzer wie
592folgt (@pxref{Einrichten der Erstellungsumgebung}).
593
594@item
595Führen Sie den Daemon aus, und lassen Sie ihn automatisch bei jedem
596Hochfahren starten.
597
598Wenn Ihre Wirts-Distribution systemd als »init«-System verwendet, können Sie
599das mit folgenden Befehlen veranlassen:
600
601@c Versions of systemd that supported symlinked service files are not
602@c yet widely deployed, so we should suggest that users copy the service
603@c files into place.
604@c
605@c See this thread for more information:
606@c http://lists.gnu.org/archive/html/guix-devel/2017-01/msg01199.html
607
608@example
793dcd8c
LC
609# cp ~root/.config/guix/current/lib/systemd/system/guix-daemon.service \
610 /etc/systemd/system/
1e40e70b
JL
611# systemctl start guix-daemon && systemctl enable guix-daemon
612@end example
613
614Wenn Ihre Wirts-Distribution als »init«-System Upstart verwendet:
615
616@example
617# initctl reload-configuration
793dcd8c
LC
618# cp ~root/.config/guix/current/lib/upstart/system/guix-daemon.conf \
619 /etc/init/
1e40e70b
JL
620# start guix-daemon
621@end example
622
623Andernfalls können Sie den Daemon immer noch manuell starten, mit:
624
625@example
793dcd8c
LC
626# ~root/.config/guix/current/bin/guix-daemon \
627 --build-users-group=guixbuild
1e40e70b
JL
628@end example
629
630@item
631Stellen Sie den @command{guix}-Befehl auch anderen Nutzern Ihrer Maschine
632zur Verfügung, zum Beispiel so:
633
634@example
635# mkdir -p /usr/local/bin
636# cd /usr/local/bin
793dcd8c 637# ln -s /var/guix/profiles/per-user/root/current-guix/bin/guix
1e40e70b
JL
638@end example
639
640Es ist auch eine gute Idee, die Info-Version dieses Handbuchs ebenso
641verfügbar zu machen:
642
643@example
644# mkdir -p /usr/local/share/info
645# cd /usr/local/share/info
793dcd8c 646# for i in /var/guix/profiles/per-user/root/current-guix/share/info/* ;
1e40e70b
JL
647 do ln -s $i ; done
648@end example
649
650Auf diese Art wird, unter der Annahme, dass bei Ihnen
651@file{/usr/local/share/info} im Suchpfad eingetragen ist, das Ausführen von
652@command{info guix} dieses Handbuch öffnen (@pxref{Other Info Directories,,,
653texinfo, GNU Texinfo} hat weitere Details, wie Sie den Info-Suchpfad ändern
654können).
655
656@item
657@cindex Substitute, deren Autorisierung
658Um Substitute von @code{hydra.gnu.org} oder einem Spiegelserver davon zu
659benutzen (@pxref{Substitute}), müssen sie erst autorisiert werden:
660
661@example
793dcd8c
LC
662# guix archive --authorize < \
663 ~root/.config/guix/current/share/guix/hydra.gnu.org.pub
1e40e70b
JL
664@end example
665
666@item
667Alle Nutzer müssen womöglich ein paar zusätzliche Schritte ausführen, damit
668ihre Guix-Umgebung genutzt werden kann, siehe @pxref{Anwendungen einrichten}.
669@end enumerate
670
793dcd8c 671Voilà, die Installation ist fertig!
1e40e70b
JL
672
673Sie können nachprüfen, dass Guix funktioniert, indem Sie ein Beispielpaket
674in das root-Profil installieren:
675
676@example
677# guix package -i hello
678@end example
679
680The @code{guix} package must remain available in @code{root}'s profile, or
681it would become subject to garbage collection---in which case you would find
682yourself badly handicapped by the lack of the @command{guix} command. In
683other words, do not remove @code{guix} by running @code{guix package -r
684guix}.
685
686Der Tarball zur Installation aus einer Binärdatei kann einfach durch
687Ausführung des folgenden Befehls im Guix-Quellbaum (re-)produziert und
688verifiziert werden:
689
690@example
691make guix-binary.@var{system}.tar.xz
692@end example
693
694@noindent
793dcd8c 695...@: which, in turn, runs:
1e40e70b
JL
696
697@example
793dcd8c
LC
698guix pack -s @var{system} --localstatedir \
699 --profile-name=current-guix guix
1e40e70b
JL
700@end example
701
702Siehe @xref{Aufruf von guix pack} für weitere Informationen zu diesem
703praktischen Werkzeug.
704
705@node Voraussetzungen
706@section Voraussetzungen
707
708Dieser Abschnitt listet Voraussetzungen auf, um Guix aus seinem Quellcode zu
709erstellen. Der Erstellungsprozess für Guix ist derselbe wie für andere
710GNU-Software und wird hier nicht beschrieben. Bitte lesen Sie die Dateien
711@file{README} und @file{INSTALL} im Guix-Quellbaum, um weitere Details zu
712erfahren.
713
714GNU Guix hat folgende Pakete als Abhängigkeiten:
715
716@itemize
717@item @url{http://gnu.org/software/guile/, GNU Guile}, Version 2.0.13 oder
718neuer, einschließlich 2.2.x,
719@item @url{https://notabug.org/cwebber/guile-gcrypt, Guile-Gcrypt}, version
7200.1.0 or later;
721@item
722@uref{http://gnutls.org/, GnuTLS}, im Speziellen dessen Bindungen für Guile
723(@pxref{Guile Preparations, how to install the GnuTLS bindings for Guile,,
724gnutls-guile, GnuTLS-Guile}),
725@item
793dcd8c
LC
726@uref{https://notabug.org/guile-sqlite3/guile-sqlite3, Guile-SQLite3},
727version 0.1.0 or later;
1e40e70b
JL
728@item
729@c FIXME: Specify a version number once a release has been made.
730@uref{https://gitlab.com/guile-git/guile-git, Guile-Git}, vom August 2017
731oder neuer,
732@item @url{http://zlib.net, zlib},
733@item @url{http://www.gnu.org/software/make/, GNU Make}.
734@end itemize
735
736Folgende Abhängigkeiten sind optional:
737
738@itemize
739@item
740Wenn Sie @url{http://savannah.nongnu.org/projects/guile-json/, Guile-JSON}
741installieren, können Sie den Befehl @command{guix import pypi} benutzen
742(@pxref{Aufruf von guix import}). Das spielt hauptsächlich für Entwickler und
743nicht für Gelegenheitsnutzer eine Rolle.
744
745@item
746@c Note: We need at least 0.10.2 for 'channel-send-eof'.
747Unterstützung für das Auslagern von Erstellungen (@pxref{Auslagern des Daemons einrichten}) und @command{guix copy} (@pxref{Aufruf von guix copy}) hängt von
748@uref{https://github.com/artyom-poptsov/guile-ssh, Guile-SSH}, Version
7490.10.2 oder neuer, ab.
750
751@item
752Wenn @url{http://www.bzip.org, libbz2} verfügbar ist, kann
753@command{guix-daemon} damit Erstellungsprotokolle komprimieren.
754@end itemize
755
756Sofern nicht @code{--disable-daemon} beim Aufruf von @command{configure}
757übergeben wurde, benötigen Sie auch folgende Pakete:
758
759@itemize
760@item @url{http://gnupg.org/, GNU libgcrypt},
761@item @url{http://sqlite.org, SQLite 3},
762@item @url{http://gcc.gnu.org, GCC's g++} mit Unterstützung für den
763C++11-Standard.
764@end itemize
765
766@cindex Zustandsverzeichnis
767Sollten Sie Guix auf einem System konfigurieren, auf dem Guix bereits
768installiert ist, dann stellen Sie sicher, dasselbe Zustandsverzeichnis wie
769für die bestehende Installation zu verwenden. Benutzen Sie dazu die
770Befehlszeilenoption @code{--localstatedir} des @command{configure}-Skripts
771(@pxref{Directory Variables, @code{localstatedir},, standards, GNU Coding
772Standards}). Das @command{configure}-Skript schützt vor ungewollter
773Fehlkonfiguration der @var{localstatedir}, damit sie nicht versehentlich
774Ihren Store verfälschen (@pxref{Der Store}).
775
776@cindex Nix, Kompatibilität
777Wenn eine funktionierende Installation of @url{http://nixos.org/nix/, the
778Nix package manager} verfügbar ist, können Sie Guix stattdessen mit
779@code{--disable-daemon} konfigurieren. In diesem Fall ersetzt Nix die drei
793dcd8c 780oben genannten Abhängigkeiten.
1e40e70b
JL
781
782Guix ist mit Nix kompatibel, daher ist es möglich, denselben Store für beide
783zu verwenden. Dazu müssen Sie an @command{configure} nicht nur denselben
784Wert für @code{--with-store-dir} übergeben, sondern auch denselben Wert für
785@code{--localstatedir}. Letzterer ist deswegen essenziell, weil er unter
786Anderem angibt, wo die Datenbank liegt, in der sich die Metainformationen
787über den Store befinden. Für Nix sind die Werte standardmäßig
788@code{--with-store-dir=/nix/store} und
789@code{--localstatedir=/nix/var}. Beachten Sie, dass @code{--disable-daemon}
790nicht erforderlich ist, wenn Sie die Absicht haben, den Store mit Nix zu
791teilen.
792
793@node Die Testsuite laufen lassen
794@section Die Testsuite laufen lassen
795
796@cindex Testkatalog
797Nachdem @command{configure} und @code{make} erfolgreich durchgelaufen sind,
798ist es ratsam, den Testkatalog auszuführen. Er kann dabei helfen, Probleme
799mit der Einrichtung oder Systemumgebung zu finden, oder auch Probleme in
800Guix selbst — und Testfehler zu melden ist eine wirklich gute Art und Weise,
801bei der Verbesserung von Guix mitzuhelfen. Um den Testkatalog auszuführen,
802geben Sie Folgendes ein:
803
804@example
805make check
806@end example
807
808Testfälle können parallel ausgeführt werden. Sie können die
809Befehlszeiltenoption @code{-j} von GNU@tie{}make benutzen, damit es
810schneller geht. Der erste Durchlauf kann auf neuen Maschinen ein paar
811Minuten dauern, nachfolgende Ausführungen werden schneller sein, weil der
812für die Tests erstellte Store schon einige Dinge zwischengespeichert haben
813wird.
814
815Es ist auch möglich, eine Teilmenge der Tests laufen zu lassen, indem Sie
816die @code{TESTS}-Variable des Makefiles ähnlich wie in diesem Beispiel
817definieren:
818
819@example
820make check TESTS="tests/store.scm tests/cpio.scm"
821@end example
822
823Standardmäßig werden Testergebnisse pro Datei angezeigt. Um die Details
824jedes einzelnen Testfalls zu sehen, können Sie wie in diesem Beispiel die
825@code{SCM_LOG_DRIVER_FLAGS}-Variable des Makefiles definieren:
826
827@example
828make check TESTS="tests/base64.scm" SCM_LOG_DRIVER_FLAGS="--brief=no"
829@end example
830
793dcd8c 831Kommt es zum Fehlschlag, senden Sie bitte eine E-Mail an
1e40e70b 832@email{bug-guix@@gnu.org} und fügen Sie die Datei @file{test-suite.log} als
793dcd8c
LC
833Anhang bei. Bitte geben Sie dabei in Ihrer Nachricht die benutzte Version
834von Guix an sowie die Versionsnummern der Abhängigkeiten
835(@pxref{Voraussetzungen}).
1e40e70b
JL
836
837Guix wird auch mit einem Testkatalog für das ganze System ausgeliefert, der
838vollständige Instanzen des GuixSD-Betriebssystems testet. Er kann nur auf
839Systemen benutzt werden, auf denen Guix bereits installiert ist, mit
840folgendem Befehl:
841
842@example
843make check-system
844@end example
845
846@noindent
847Oder, auch hier, indem Sie @code{TESTS} definieren, um eine Teilmenge der
848auszuführenden Tests anzugeben:
849
850@example
851make check-system TESTS="basic mcron"
852@end example
853
854Diese Systemtests sind in den @code{(gnu tests @dots{})}-Modulen
855definiert. Sie funktionieren, indem Sie das getestete Betriebssystem mitsamt
856schlichter Instrumentierung in einer virtuellen Maschine (VM) ausführen. Die
857Tests können aufwendige Berechnungen durchführen oder sie günstig umgehen,
858je nachdem, ob für ihre Abhängigkeiten Substitute zur Verfügung stehen
859(@pxref{Substitute}). Manche von ihnen nehmen viel Speicherplatz in
860Anspruch, um die VM-Abbilder zu speichern.
861
862Auch hier gilt: Falls Testfehler auftreten, senden Sie bitte alle Details an
863@email{bug-guix@@gnu.org}.
864
865@node Den Daemon einrichten
866@section Den Daemon einrichten
867
868@cindex Daemon
869Operationen wie das Erstellen eines Pakets oder Laufenlassen des
870Müllsammlers werden alle durch einen spezialisierten Prozess durchgeführt,
793dcd8c
LC
871den @dfn{Erstellungs-Daemon}, im Auftrag seiner Kunden (den Clients). Nur
872der Daemon darf auf den Store und seine zugehörige Datenbank
873zugreifen. Daher wird jede den Store verändernde Operation durch den Daemon
874durchgeführt. Zum Beispiel kommunizieren Befehlszeilenwerkzeuge wie
875@command{guix package} und @command{guix build} mit dem Daemon (mittels
876entfernter Prozeduraufrufe), um ihm Anweisungen zu geben, was er tun soll.
1e40e70b
JL
877
878Folgende Abschnitte beschreiben, wie Sie die Umgebung des
879Erstellungs-Daemons ausstatten sollten. Siehe auch @ref{Substitute} für
880Informationen darüber, wie Sie es dem Daemon ermöglichen, vorerstellte
881Binärdateien herunterzuladen.
882
883@menu
884* Einrichten der Erstellungsumgebung:: Die isolierte Umgebung zum Erstellen
885 vorbereiten.
886* Auslagern des Daemons einrichten:: Erstellungen auf entfernte Maschinen
887 auslagern.
888* SELinux-Unterstützung:: Wie man eine SELinux-Richtlinie für den Daemon
889 einrichtet.
890@end menu
891
892@node Einrichten der Erstellungsumgebung
893@subsection Einrichten der Erstellungsumgebung
894
895@cindex Erstellungsumgebung
896In einem normalen Mehrbenutzersystem werden Guix und sein Daemon — das
897Programm @command{guix-daemon} — vom Systemadministrator installiert;
898@file{/gnu/store} gehört @code{root} und @command{guix-daemon} läuft als
899@code{root}. Nicht mit erweiterten Rechten ausgestattete Nutzer können
900Guix-Werkzeuge benutzen, um Pakete zu erstellen oder anderweitig auf den
901Store zuzugreifen, und der Daemon wird dies für sie erledigen und dabei
902sicherstellen, dass der Store in einem konsistenten Zustand verbleibt und
903sich die Nutzer erstellte Pakete teilen.
904
905@cindex Erstellungsbenutzer
906Wenn @command{guix-daemon} als Administratornutzer @code{root} läuft, wollen
907Sie aber vielleicht dennoch nicht, dass Paketerstellungsprozesse auch als
908@code{root} ablaufen, aus offensichtlichen Sicherheitsgründen. Um dies zu
909vermeiden, sollte ein besonderer Pool aus @dfn{Erstellungsbenutzern}
910geschaffen werden, damit vom Daemon gestartete Erstellungsprozesse ihn
911benutzen. Diese Erstellungsbenutzer müssen weder eine Shell noch einen
912Persönlichen Ordner zugewiesen bekommen, sie werden lediglich benutzt, wenn
913der Daemon @code{root}-Rechte in Erstellungsprozessen ablegt. Mehrere solche
914Benutzer zu haben, ermöglicht es dem Daemon, verschiedene
915Erstellungsprozessen unter verschiedenen Benutzeridentifikatoren (UIDs) zu
916starten, was garantiert, dass sie einander nicht stören — eine essenzielle
917Funktionalität, da Erstellungen als reine Funktionen angesehen werden
918(@pxref{Einführung}).
919
920Auf einem GNU/Linux-System kann ein Pool von Erstellungsbenutzern wie folgt
921erzeugt werden (mit Bash-Syntax und den Befehlen von @code{shadow}):
922
923@c See http://lists.gnu.org/archive/html/bug-guix/2013-01/msg00239.html
924@c for why `-G' is needed.
925@example
926# groupadd --system guixbuild
927# for i in `seq -w 1 10`;
928 do
929 useradd -g guixbuild -G guixbuild \
930 -d /var/empty -s `which nologin` \
931 -c "Guix-Erstellungsbenutzer $i" --system \
932 guixbuilder$i;
933 done
934@end example
935
936@noindent
937Die Anzahl der Erstellungsbenutzer entscheidet, wieviele Erstellungsaufträge
938parallel ausgeführt werden können, wie es mit der Befehlszeilenoption
793dcd8c 939@option{--max-jobs} vorgegeben werden kann (@pxref{Aufruf des guix-daemon,
1e40e70b
JL
940@option{--max-jobs}}). Um @command{guix system vm} und ähnliche Befehle
941nutzen zu können, müssen Sie die Erstellungsbenutzer unter Umständen zur
942@code{kvm}-Benutzergruppe hinzufügen, damit sie Zugriff auf @file{/dev/kvm}
943haben, mit @code{-G guixbuild,kvm} statt @code{-G guixbuild}
944(@pxref{Aufruf von guix system}).
945
946Das Programm @code{guix-daemon} kann mit dem folgenden Befehl als
947@code{root} gestartet werden@footnote{Wenn Ihre Maschine systemd als
948»init«-System verwendet, genügt es, die Datei
949@file{@var{prefix}/lib/systemd/system/guix-daemon.service} in
950@file{/etc/systemd/system} zu platzieren, damit @command{guix-daemon}
951automatisch gestartet wird. Ebenso können Sie, wenn Ihre Maschine Upstart
952als »init«-System benutzt, die Datei
953@file{@var{prefix}/lib/upstart/system/guix-daemon.conf} in @file{/etc/init}
954platzieren.}:
955
956@example
957# guix-daemon --build-users-group=guixbuild
958@end example
959
960@cindex chroot
961@noindent
962Auf diese Weise startet der Daemon Erstellungsprozesse in einem chroot als
963einer der @code{guixbuilder}-Benutzer. Auf GNU/Linux enthält die
964chroot-Umgebung standardmäßig nichts außer:
965
966@c Keep this list in sync with libstore/build.cc! -----------------------
967@itemize
968@item
969einem minimalen @code{/dev}-Verzeichnis, was größtenteils vom @code{/dev}
970des Wirtssystems unabhängig erstellt wurde@footnote{»Größtenteils«, denn
971obwohl die Menge an Dateien, die im @code{/dev} des chroots vorkommen, fest
972ist, können die meisten dieser Dateien nur dann erstellt werden, wenn das
973Wirtssystem sie auch hat.},
974
975@item
976dem @code{/proc}-Verzeichnis, es zeigt nur die Prozesse des Containers, weil
977ein separater Namensraum für Prozess-IDs (PIDs) benutzt wird,
978
979@item
980@file{/etc/passwd} mit einem Eintrag für den aktuellen Benutzer und einem
981Eintrag für den Benutzer @file{nobody},
982
983@item
984@file{/etc/group} mit einem Eintrag für die Gruppe des Benutzers,
985
986@item
987@file{/etc/hosts} mit einem Eintrag, der @code{localhost} auf
988@code{127.0.0.1} abbildet,
989
990@item
991einem @file{/tmp}-Verzeichnis mit Schreibrechten.
992@end itemize
993
994Sie können beeinflussen, in welchem Verzeichnis der Daemon Erstellungsbäume
995unterbringt, indem sie den Wert der Umgebungsvariablen @code{TMPDIR}
996ändern. Allerdings heißt innerhalb des chroots der Erstellungsbaum immer
997@file{/tmp/guix-build-@var{name}.drv-0}, wobei @var{name} der Ableitungsname
998ist — z.B. @code{coreutils-8.24}. Dadurch hat der Wert von @code{TMPDIR}
999keinen Einfluss auf die Erstellungsumgebung, wodurch Unterschiede vermieden
1000werden, falls Erstellungsprozesse den Namen ihres Erstellungsbaumes
1001einfangen.
1002
1003@vindex http_proxy
1004Der Daemon befolgt außerdem den Wert der Umgebungsvariablen
1005@code{http_proxy} für von ihm durchgeführte HTTP-Downloads, sei es für
1006Ableitungen mit fester Ausgabe (@pxref{Ableitungen}) oder für Substitute
1007(@pxref{Substitute}).
1008
1009Wenn Sie Guix als ein Benutzer ohne erweiterte Rechte installieren, ist es
1010dennoch möglich, @command{guix-daemon} auszuführen, sofern Sie
1011@code{--disable-chroot} übergeben. Allerdings können Erstellungsprozesse
1012dann nicht voneinander und vom Rest des Systems isoliert werden. Daher
1013können sich Erstellungsprozesse gegenseitig stören und auf Programme,
1014Bibliotheken und andere Dateien zugreifen, die dem restlichen System zur
793dcd8c 1015Verfügung stehen — was es deutlich schwerer macht, sie als @emph{reine}
1e40e70b
JL
1016Funktionen aufzufassen.
1017
1018
1019@node Auslagern des Daemons einrichten
1020@subsection Nutzung der Auslagerungsfunktionalität
1021
1022@cindex auslagern
1023@cindex Build-Hook
1024Wenn erwünscht kann der Erstellungs-Daemon Ableitungserstellungen
1025@dfn{auslagern} auf andere Maschinen, auf denen Guix läuft, mit Hilfe des
1026@code{offload}-»@dfn{Build-Hooks}«@footnote{Diese Funktionalität ist nur
1027verfügbar, wenn @uref{https://github.com/artyom-poptsov/guile-ssh,
1028Guile-SSH} vorhanden ist.}. Wenn diese Funktionalität aktiviert ist, wird
1029eine nutzerspezifizierte Liste von Erstellungsmaschinen aus
1030@file{/etc/guix/machines.scm} gelesen. Wann immer eine Erstellung angefragt
1031wird, zum Beispiel durch @code{guix build}, versucht der Daemon, sie an eine
1032der Erstellungsmaschinen auszulagern, die die Einschränkungen der Ableitung
1033erfüllen, insbesondere ihren Systemtyp — z.B. @file{x86_64-linux}. Fehlende
1034Voraussetzungen für die Erstellung werden über SSH auf die Zielmaschine
1035kopiert, welche dann mit der Erstellung weitermacht. Hat sie Erfolg damit,
1036so werden die Ausgabe oder Ausgaben der Erstellung zurück auf die
1037ursprüngliche Maschine kopiert.
1038
1039Die Datei @file{/etc/guix/machines.scm} sieht normalerweise so aus:
1040
1041@example
1042(list (build-machine
1043 (name "eightysix.example.org")
1044 (system "x86_64-linux")
1045 (host-key "ssh-ed25519 AAAAC3Nza@dots{}")
1046 (user "bob")
1047 (speed 2.)) ;unglaublich schnell!
1048
1049 (build-machine
1050 (name "meeps.example.org")
1051 (system "mips64el-linux")
1052 (host-key "ssh-rsa AAAAB3Nza@dots{}")
1053 (user "alice")
1054 (private-key
1055 (string-append (getenv "HOME")
1056 "/.ssh/identität-für-guix"))))
1057@end example
1058
1059@noindent
1060Im obigen Beispiel geben wir eine Liste mit zwei Erstellungsmaschinen vor,
1061eine für die @code{x86_64}-Architektur und eine für die
1062@code{mips64el}-Architektur.
1063
1064Tatsächlich ist diese Datei — wenig überraschend! — eine Scheme-Datei, die
1065ausgewertet wird, wenn der @code{offload}-Hook gestartet wird. Der Wert, den
1066sie zurückliefert, muss eine Liste von @code{build-machine}-Objekten
1067sein. Obwohl dieses Beispiel eine feste Liste von Erstellungsmaschinen
1068zeigt, könnte man auch auf die Idee kommen, etwa mit DNS-SD eine Liste
1069möglicher im lokalen Netzwerk entdeckter Erstellungsmaschinen zu liefern
1070(@pxref{Einführung, Guile-Avahi,, guile-avahi, Using Avahi in Guile Scheme
1071Programs}). Der Datentyp @code{build-machine} wird im Folgenden weiter
1072ausgeführt.
1073
1074@deftp {Datentyp} build-machine
1075Dieser Datentyp repräsentiert Erstellungsmaschinen, an die der Daemon
1076Erstellungen auslagern darf. Die wichtigen Felder sind:
1077
1078@table @code
1079
1080@item name
1081Der Hostname der entfernten Maschine.
1082
1083@item system
1084Der Systemtyp der entfernten Maschine — z.B. @code{"x86_64-linux"}.
1085
1086@item user
1087Das Benutzerkonto, mit dem eine Verbindung zur entfernten Maschine über SSH
793dcd8c
LC
1088aufgebaut werden soll. Beachten Sie, dass das SSH-Schlüsselpaar @emph{nicht}
1089durch eine Passphrase geschützt sein darf, damit nicht-interaktive
1090Anmeldungen möglich sind.
1e40e70b
JL
1091
1092@item host-key
1093Dies muss der @dfn{öffentliche SSH-Host-Schlüssel} der Maschine im
1094OpenSSH-Format sein. Er wird benutzt, um die Identität der Maschine zu
1095prüfen, wenn wir uns mit ihr verbinden. Er ist eine lange Zeichenkette, die
1096ungefähr so aussieht:
1097
1098@example
1099ssh-ed25519 AAAAC3NzaC@dots{}mde+UhL hint@@example.org
1100@end example
1101
1102Wenn auf der Maschine der OpenSSH-Daemon, @command{sshd}, läuft, ist der
1103Host-Schlüssel in einer Datei wie @file{/etc/ssh/ssh_host_ed25519_key.pub}
1104zu finden.
1105
1106Wenn auf der Maschine der SSH-Daemon von GNU@tie{}lsh, nämlich
1107@command{lshd}, läuft, befindet sich der Host-Schlüssel in
1108@file{/etc/lsh/host-key.pub} oder einer ähnlichen Datei. Er kann ins
1109OpenSSH-Format umgewandelt werden durch @command{lsh-export-key}
1110(@pxref{Converting keys,,, lsh, LSH Manual}):
1111
1112@example
1113$ lsh-export-key --openssh < /etc/lsh/host-key.pub
1114ssh-rsa AAAAB3NzaC1yc2EAAAAEOp8FoQAAAQEAs1eB46LV@dots{}
1115@end example
1116
1117@end table
1118
1119Eine Reihe optionaler Felder kann festgelegt werden:
1120
1121@table @asis
1122
1123@item @code{port} (Vorgabe: @code{22})
1124Portnummer des SSH-Servers auf der Maschine.
1125
1126@item @code{private-key} (Vorgabe: @file{~root/.ssh/id_rsa})
1127The SSH private key file to use when connecting to the machine, in OpenSSH
1128format. This key must not be protected with a passphrase.
1129
1130Beachten Sie, dass als Vorgabewert der private Schlüssel @emph{des
1131root-Benutzers} genommen wird. Vergewissern Sie sich, dass er existiert,
1132wenn Sie die Standardeinstellung verwenden.
1133
1134@item @code{compression} (Vorgabe: @code{"zlib@@openssh.com,zlib"})
1135@itemx @code{compression-level} (Vorgabe: @code{3})
1136Die Kompressionsmethoden auf SSH-Ebene und das angefragte
1137Kompressionsniveau.
1138
1139Beachten Sie, dass Auslagerungen SSH-Kompression benötigen, um beim
1140Übertragen von Dateien an Erstellungsmaschinen und zurück weniger Bandbreite
1141zu benutzen.
1142
1143@item @code{daemon-socket} (Vorgabe: @code{"/var/guix/daemon-socket/socket"})
1144Dateiname des Unix-Sockets, auf dem @command{guix-daemon} auf der Maschine
1145lauscht.
1146
1147@item @code{parallel-builds} (Vorgabe: @code{1})
1148Die Anzahl der Erstellungen, die auf der Maschine parallel ausgeführt werden
1149können.
1150
1151@item @code{speed} (Vorgabe: @code{1.0})
1152Ein »relativer Geschwindigkeitsfaktor«. Der Auslagerungsplaner gibt
1153tendenziell Maschinen mit höherem Geschwindigkeitsfaktor den Vorrang.
1154
1155@item @code{features} (Vorgabe: @code{'()})
1156Eine Liste von Zeichenketten, die besondere von der Maschine unterstützte
1157Funktionalitäten bezeichnen. Ein Beispiel ist @code{"kvm"} für Maschinen,
1158die über die KVM-Linux-Module zusammen mit entsprechender
1159Hardware-Unterstützung verfügen. Ableitungen können Funktionalitäten dem
1160Namen nach anfragen und werden dann auf passenden Erstellungsmaschinen
1161eingeplant.
1162
1163@end table
1164@end deftp
1165
1166Der Befehl @code{guile} muss sich im Suchpfad der Erstellungsmaschinen
1167befinden. Zusätzlich müssen die Guix-Module im @code{$GUILE_LOAD_PATH} auf
1168den Erstellungsmaschinen zu finden sein — um dies nachzuprüfen, können Sie
1169Folgendes ausführen:
1170
1171@example
1172ssh build-machine guile -c "'(use-modules (guix config))'"
1173@end example
1174
1175Es gibt noch eine weitere Sache zu tun, sobald @file{machines.scm}
1176eingerichtet ist. Wie zuvor erklärt, werden beim Auslagern Dateien zwischen
1177den Stores der Maschinen hin- und hergeschickt. Damit das funktioniert,
1178müssen Sie als Erstes ein Schlüsselpaar auf jeder Maschine erzeugen, damit
1179der Daemon signierte Archive mit den Dateien aus dem Store versenden kann
1180(@pxref{Aufruf von guix archive}):
1181
1182@example
1183# guix archive --generate-key
1184@end example
1185
1186@noindent
1187Jede Erstellungsmaschine muss den Schlüssel der Hauptmaschine autorisieren,
1188damit diese Store-Objekte von der Hauptmaschine empfangen kann:
1189
1190@example
1191# guix archive --authorize < öffentlicher-schlüssel-hauptmaschine.txt
1192@end example
1193
1194@noindent
1195Andersherum muss auch die Hauptmaschine den jeweiligen Schlüssel jeder
1196Erstellungsmaschine autorisieren.
1197
1198Der ganze Umstand mit den Schlüsseln soll ausdrücken, dass sich Haupt- und
1199Erstellungsmaschinen paarweise gegenseitig vertrauen. Konkret kann der
1200Erstellungs-Daemon auf der Hauptmaschine die Echtheit von den
1201Erstellungsmaschinen empfangener Dateien gewährleisten (und umgekehrt), und
1202auch dass sie nicht sabotiert wurden und mit einem autorisierten Schlüssel
1203signiert wurden.
1204
1205@cindex Auslagerung testen
1206Um zu testen, ob Ihr System funktioniert, führen Sie diesen Befehl auf der
1207Hauptmaschine aus:
1208
1209@example
1210# guix offload test
1211@end example
1212
1213Dadurch wird versucht, zu jeder Erstellungsmaschine eine Verbindung
1214herzustellen, die in @file{/etc/guix/machines.scm} angegeben wurde,
1215sichergestellt, dass auf jeder Guile und die Guix-Module nutzbar sind, und
1216jeweils versucht, etwas auf die Erstellungsmaschine zu exportieren und von
1217dort zu imporieren. Dabei auftretende Fehler werden gemeldet.
1218
1219Wenn Sie stattdessen eine andere Maschinendatei verwenden möchten, geben Sie
1220diese einfach auf der Befehlszeile an:
1221
1222@example
1223# guix offload test maschinen-qualif.scm
1224@end example
1225
1226Letztendlich können Sie hiermit nur die Teilmenge der Maschinen testen,
1227deren Name zu einem regulären Ausdruck passt:
1228
1229@example
1230# guix offload test maschinen.scm '\.gnu\.org$'
1231@end example
1232
1233@cindex Auslagerungs-Lagebericht
1234Um die momentane Auslastung aller Erstellungs-Hosts anzuzeigen, führen Sie
1235diesen Befehl auf dem Hauptknoten aus:
1236
1237@example
1238# guix offload status
1239@end example
1240
1241
1242@node SELinux-Unterstützung
1243@subsection SELinux-Unterstützung
1244
1245@cindex SELinux, Policy für den Daemon
1246@cindex Mandatory Access Control, SELinux
1247@cindex Sicherheit, des guix-daemon
1248Guix enthält eine SELinux-Richtliniendatei (»Policy«) unter
1249@file{etc/guix-daemon.cil}, die auf einem System installiert werden
1250kann, auf dem SELinux aktiviert ist, damit Guix-Dateien gekennzeichnet
1251sind, und um das erwartete Verhalten des Daemons anzugeben. Da GuixSD
1252keine Grundrichtlinie (»Base Policy«) für SELinux bietet, kann diese
1253Richtlinie für den Daemon auf GuixSD nicht benutzt werden.
1254
1255@subsubsection Installieren der SELinux-Policy
1256@cindex SELinux, Policy installieren
1257Um die Richtlinie (Policy) zu installieren, führen Sie folgenden Befehl mit
1258Administratorrechten aus:
1259
1260@example
1261semodule -i etc/guix-daemon.cil
1262@end example
1263
1264Kennzeichnen Sie dann das Dateisystem neu mit @code{restorecon} oder einem
1265anderen, von Ihrem System angebotenen Mechanismus.
1266
1267Sobald die Richtlinie installiert ist, das Dateisystem neu gekennzeichnet
1268wurde und der Daemon neugestartet wurde, sollte er im Kontext
1269@code{guix_daemon_t} laufen. Sie können dies mit dem folgenden Befehl
1270nachprüfen:
1271
1272@example
1273ps -Zax | grep guix-daemon
1274@end example
1275
1276Beobachten Sie die Protokolldateien von SELinux, wenn Sie einen Befehl wie
1277@code{guix build hello} ausführen, um sich zu überzeugen, dass SELinux alle
1278notwendigen Operationen gestattet.
1279
1280@subsubsection Einschränkungen
1281@cindex SELinux, Einschränkungen
1282
1283Diese Richtlinie ist nicht perfekt. Im Folgenden finden Sie eine Liste von
793dcd8c 1284Einschränkungen oder merkwürdigen Verhaltensweisen, die bedacht werden
1e40e70b
JL
1285sollten, wenn man die mitgelieferte SELinux-Richtlinie für den Guix-Daemon
1286einspielt.
1287
1288@enumerate
1289@item
1290@code{guix_daemon_socket_t} wird nicht wirklich benutzt. Keine der
1291Socket-Operationen benutzt Kontexte, die irgendetwas mit
1292@code{guix_daemon_socket_t} zu tun haben. Es schadet nicht, diese ungenutzte
1293Kennzeichnung zu haben, aber es wäre besser, für die Kennzeichnung auch
1294Socket-Regeln festzulegen.
1295
1296@item
1297@code{guix gc} kann nicht auf beliebige Verknüpfungen zu Profilen
1298zugreifen. Die Kennzeichnung des Ziels einer symbolischen Verknüpfung ist
1299notwendigerweise unabhängig von der Dateikennzeichnung der
1300Verknüpfung. Obwohl alle Profile unter $localstatedir gekennzeichnet sind,
1301erben die Verknüpfungen auf diese Profile die Kennzeichnung desjenigen
1302Verzeichnisses, in dem sie sich befinden. Für Verknüpfungen im Persönlichen
1303Ordner des Benutzers ist das @code{user_home_t}, aber Verknüpfungen aus dem
1304Persönlichen Ordner des Administratornutzers, oder @file{/tmp}, oder das
1305Arbeitsverzeichnis des HTTP-Servers, etc., funktioniert das
1306nicht. @code{guix gc} würde es nicht gestattet, diese Verknüpfungen
1307auszulesen oder zu verfolgen.
1308
1309@item
1310Die vom Daemon gebotene Funktionalität, auf TCP-Verbindungen zu lauschen,
1311könnte nicht mehr funktionieren. Dies könnte zusätzliche Regeln brauchen,
1312weil SELinux Netzwerk-Sockets anders behandelt als Dateien.
1313
1314@item
1315Derzeit wird allen Dateien mit einem Namen, der zum regulären Ausdruck
1316@code{/gnu/store/.+-(guix-.+|profile)/bin/guix-daemon} passt, die
793dcd8c
LC
1317Kennzeichnung @code{guix_daemon_exec_t} zugewiesen, wodurch @emph{jede
1318beliebige} Datei mit diesem Namen in irgendeinem Profil gestattet wäre, in
1e40e70b
JL
1319der Domäne @code{guix_daemon_t} ausgeführt zu werden. Das ist nicht
1320ideal. Ein Angreifer könnte ein Paket erstellen, dass solch eine ausführbare
1321Datei enthält, und den Nutzer überzeugen, es zu installieren und
1322auszuführen. Dadurch käme es in die Domäne @code{guix_daemon_t}. Ab diesem
1323Punkt könnte SELinux nicht mehr verhindern, dass es auf Dateien zugreift,
1324auf die Prozesse in dieser Domäne zugreifen dürfen.
1325
1326Wir könnten zum Zeitpunkt der Installation eine wesentlich restriktivere
1327Richtlinie generieren, für die nur @emph{genau derselbe} Dateiname des
1328gerade installierten @code{guix-daemon}-Programms als
1329@code{guix_daemon_exec_t} gekennzeichnet würde, statt einen vieles
1330umfassenden regulären Ausdruck zu benutzen. Aber dann müsste der
1331Administratornutzer zum Zeitpunkt der Installation jedes Mal die Richtlinie
1332installieren oder aktualisieren müssen, sobald das Guix-Paket aktualisiert
1333wird, dass das tatsächlich in Benutzung befindliche
1334@code{guix-daemon}-Programm enthält.
1335@end enumerate
1336
1337@node Aufruf des guix-daemon
1338@section Aufruf von @command{guix-daemon}
1339
1340Das Programm @command{guix-daemon} implementiert alle Funktionalitäten, um
1341auf den Store zuzugreifen. Dazu gehört das Starten von Erstellungsprozessen,
1342das Ausführen des Müllsammlers, das Abfragen, ob ein Erstellungsergebnis
1343verfügbar ist, etc. Normalerweise wird er so als Administratornutzer
1344(@code{root}) gestartet:
1345
1346@example
1347# guix-daemon --build-users-group=guixbuild
1348@end example
1349
1350@noindent
1351Details, wie Sie ihn einrichten, finden Sie im Abschnitt @pxref{Den Daemon einrichten}.
1352
1353@cindex chroot
1354@cindex Container, Erstellungsumgebung
1355@cindex Erstellungsumgebung
1356@cindex Reproduzierbare Erstellungen
1357Standardmäßig führt @command{guix-daemon} Erstellungsprozesse mit
1358unterschiedlichen UIDs aus, die aus der Erstellungsgruppe stammen, deren
1359Name mit @code{--build-users-group} übergeben wurde. Außerdem läuft jeder
1360Erstellungsprozess in einer chroot-Umgebung, die nur die Teilmenge des
1361Stores enthält, von der der Erstellungsprozess abhängt, entsprechend seiner
1362Ableitung (@pxref{Programmierschnittstelle, derivation}), und ein paar
1363bestimmte Systemverzeichnisse, darunter standardmäßig auch @file{/dev} und
1364@file{/dev/pts}. Zudem ist die Erstellungsumgebung auf GNU/Linux ein
1365@dfn{Container}: Nicht nur hat er seinen eigenen Dateisystembaum, er hat
1366auch einen separaten Namensraum zum Einhängen von Dateisystemen, seinen
1367eigenen Namensraum für PIDs, für Netzwerke, etc. Dies hilft dabei,
1368reproduzierbare Erstellungen zu garantieren (@pxref{Funktionalitäten}).
1369
1370When the daemon performs a build on behalf of the user, it creates a build
1371directory under @file{/tmp} or under the directory specified by its
793dcd8c
LC
1372@code{TMPDIR} environment variable. This directory is shared with the
1373container for the duration of the build, though within the container, the
1374build tree is always called @file{/tmp/guix-build-@var{name}.drv-0}.
1e40e70b
JL
1375
1376Nach Abschluss der Erstellung wird das Erstellungsverzeichnis automatisch
1377entfernt, außer wenn die Erstellung fehlgeschlagen ist und der Client
1378@option{--keep-failed} angegeben hat (@pxref{Aufruf von guix build,
1379@option{--keep-failed}}).
1380
1381The daemon listens for connections and spawns one sub-process for each
1382session started by a client (one of the @command{guix} sub-commands.) The
1383@command{guix processes} command allows you to get an overview of the
1384activity on your system by viewing each of the active sessions and clients.
1385@xref{Invoking guix processes}, for more information.
1386
1387Die folgenden Befehlszeilenoptionen werden unterstützt:
1388
1389@table @code
1390@item --build-users-group=@var{Gruppe}
1391Verwende die Benutzerkonten aus der @var{Gruppe}, um Erstellungsprozesse
1392auszuführen (@pxref{Den Daemon einrichten, build users}).
1393
1394@item --no-substitutes
1395@cindex Substitute
1396Benutze keine Substitute für Erstellungsergebnisse. Das heißt, dass alle
1397Objekte lokal erstellt werden müssen, und kein Herunterladen von vorab
1398erstellten Binärdateien erlaubt ist (@pxref{Substitute}).
1399
1400Wenn der Daemon mit @code{--no-substitutes} ausgeführt wird, können Clients
1401trotzdem Substitute explizit aktivieren über den entfernten Prozeduraufruf
1402@code{set-build-options} (@pxref{Der Store}).
1403
1404@item --substitute-urls=@var{URLs}
1405@anchor{daemon-substitute-urls}
1406Benutze @var{URLs} als standardmäßige, leerzeichengetrennte Liste der
1407Quell-URLs für Substitute. Wenn diese Befehlszeilenoption nicht angegeben
1408wird, wird @indicateurl{https://mirror.hydra.gnu.org https://hydra.gnu.org}
1409verwendet (@code{mirror.hydra.gnu.org} ist ein Spiegelserver für
1410@code{hydra.gnu.org}).
1411
1412Das hat zur Folge, dass Substitute von den @var{URLs} heruntergeladen werden
1413können, solange sie mit einer Signatur versehen sind, der vertraut wird
1414(@pxref{Substitute}).
1415
1416@cindex Build-Hook
1417@item --no-build-hook
1418Den »@dfn{Build-Hook}« nicht benutzen.
1419
1420»Build-Hook« ist der Name eines Hilfsprogramms, das der Daemon starten kann
1421und an das er Erstellungsanfragen übermittelt. Durch diesen Mechanismus
1422können Erstellungen an andere Maschinen ausgelagert werden (@pxref{Auslagern des Daemons einrichten}).
1423
1424@item --cache-failures
1425Fehler bei der Erstellung zwischenspeichern. Normalerweise werden nur
1426erfolgreiche Erstellungen gespeichert.
1427
1428Wenn diese Befehlszeilenoption benutzt wird, kann @command{guix gc
1429--list-failures} benutzt werden, um die Menge an Store-Objekten abzufragen,
1430die als Fehlschläge markiert sind; @command{guix gc --clear-failures}
1431entfernt Store-Objekte aus der Menge zwischengespeicherter
1432Fehlschläge. @xref{Aufruf von guix gc}.
1433
1434@item --cores=@var{n}
1435@itemx -c @var{n}
1436@var{n} CPU-Kerne zum Erstellen jeder Ableitung benutzen; @code{0} heißt, so
1437viele wie verfügbar sind.
1438
1439Der Vorgabewert ist @code{0}, jeder Client kann jedoch eine abweichende
1440Anzahl vorgeben, zum Beispiel mit der Befehlszeilenoption @code{--cores} von
1441@command{guix build} (@pxref{Aufruf von guix build}).
1442
1443Dadurch wird die Umgebungsvariable @code{NIX_BUILD_CORES} im
1444Erstellungsprozess definiert, welcher sie benutzen kann, um intern parallele
1445Ausführungen zuzulassen — zum Beispiel durch Nutzung von @code{make
1446-j$NIX_BUILD_CORES}.
1447
1448@item --max-jobs=@var{n}
1449@itemx -M @var{n}
1450Höchstenss @var{n} Erstellungsaufträge parallel bearbeiten. Der Vorgabewert
1451liegt bei @code{1}. Wird er auf @code{0} gesetzt, werden keine Erstellungen
1452lokal durchgeführt, stattdessen lagert der Daemon sie nur aus (@pxref{Auslagern des Daemons einrichten}) oder sie schlagen einfach fehl.
1453
1454@item --max-silent-time=@var{Sekunden}
1455Wenn der Erstellungs- oder Substitutionsprozess länger als
1456@var{Sekunden}-lang keine Ausgabe erzeugt, wird er abgebrochen und ein
1457Fehler beim Erstellen gemeldet.
1458
1459Der Vorgabewert ist @code{0}, was bedeutet, dass es keine Zeitbeschränkung
1460gibt.
1461
1462Clients können einen anderen Wert als den hier angegebenen verwenden lassen
1463(@pxref{Gemeinsame Erstellungsoptionen, @code{--max-silent-time}}).
1464
1465@item --timeout=@var{Sekunden}
1466Entsprechend wird hier der Erstellungs- oder Substitutionsprozess
1467abgebrochen und als Fehlschlag gemeldet, wenn er mehr als
1468@var{Sekunden}-lang dauert.
1469
1470Der Vorgabewert ist @code{0}, was bedeutet, dass es keine Zeitbeschränkung
1471gibt.
1472
1473Clients können einen anderen Wert verwenden lassen (@pxref{Gemeinsame Erstellungsoptionen, @code{--timeout}}).
1474
1475@item --rounds=@var{N}
1476Jede Ableitung @var{n}-mal hintereinander erstellen und einen Fehler melden,
1477wenn nacheinander ausgewertete Erstellungsergebnisse nicht Bit für Bit
1478identisch sind. Beachten Sie, dass Clients wie @command{guix build} einen
1479anderen Wert verwenden lassen können (@pxref{Aufruf von guix build}).
1480
1481Wenn dies zusammen mit @option{--keep-failed} benutzt wird, bleiben die sich
1482unterscheidenden Ausgaben im Store unter dem Namen
1483@file{/gnu/store/@dots{}-check}. Dadurch können Unterschiede zwischen den
1484beiden Ergebnissen leicht erkannt werden.
1485
1486@item --debug
1487Informationen zur Fehlersuche ausgeben.
1488
1489Dies ist nützlich, um Probleme beim Starten des Daemons nachzuvollziehen;
1490Clients könn aber auch ein abweichenden Wert verwenden lassen, zum Beispiel
1491mit der Befehlszeilenoption @code{--verbosity} von @command{guix build}
1492(@pxref{Aufruf von guix build}).
1493
1494@item --chroot-directory=@var{Verzeichnis}
1495Füge das @var{Verzeichnis} zum chroot von Erstellungen hinzu.
1496
1497Dadurch kann sich das Ergebnis von Erstellungsprozessen ändern — zum
1498Beispiel, wenn diese optionale Abhängigkeiten aus dem @var{Verzeichnis}
1499verwenden, wenn sie verfügbar sind, und nicht, wenn es fehlt. Deshalb ist es
793dcd8c 1500nicht empfohlen, dass Sie diese Befehlszeilenoption verwenden, besser
1e40e70b
JL
1501sollten Sie dafür sorgen, dass jede Ableitung alle von ihr benötigten
1502Eingabgen deklariert.
1503
1504@item --disable-chroot
1505Erstellungen ohne chroot durchführen.
1506
1507Diese Befehlszeilenoption zu benutzen, wird nicht empfohlen, denn auch
1508dadurch bekämen Erstellungsprozesse Zugriff auf nicht deklarierte
1509Abhängigkeiten. Sie ist allerdings unvermeidlich, wenn @command{guix-daemon}
1510auf einem Benutzerkonto ohne ausreichende Berechtigungen ausgeführt wird.
1511
1512@item --log-compression=@var{Typ}
1513Erstellungsprotokolle werden entsprechend dem @var{Typ} komprimiert, der
1514entweder @code{gzip}, @code{bzip2} oder @code{none} (für keine Kompression)
1515sein muss.
1516
1517Sofern nicht @code{--lose-logs} angegeben wurde, werden alle
1518Erstellungsprotokolle in der @var{localstatedir} gespeichert. Um Platz zu
1519sparen, komprimiert sie der Daemon standardmäßig automatisch mit bzip2.
1520
1521@item --disable-deduplication
1522@cindex Deduplizieren
1523Automatische Dateien-»Deduplizierung« im Store ausschalten.
1524
1525Standardmäßig werden zum Store hinzugefügte Objekte automatisch
1526»dedupliziert«: Wenn eine neue Datei mit einer anderen im Store
1527übereinstimmt, wird die neue Datei stattdessen als harte Verknüpfung auf die
1528andere Datei angelegt. Dies reduziert den Speicherverbrauch auf der Platte
1529merklich, jedoch steigt andererseits die Auslastung bei der Ein-/Ausgabe im
1530Erstellungsprozess geringfügig. Durch diese Option wird keine solche
1531Optimierung durchgeführt.
1532
1533@item --gc-keep-outputs[=yes|no]
1534Gibt an, ob der Müllsammler (Garbage Collector, GC) die Ausgaben lebendiger
1535Ableitungen behalten muss (»yes«) oder nicht (»no«).
1536
1537@cindex GC-Wurzeln
1538@cindex Müllsammlerwurzeln
1539When set to ``yes'', the GC will keep the outputs of any live derivation
1540available in the store---the @code{.drv} files. The default is ``no'',
1541meaning that derivation outputs are kept only if they are reachable from a
1542GC root. @xref{Aufruf von guix gc}, for more on GC roots.
1543
1544@item --gc-keep-derivations[=yes|no]
1545Gibt an, ob der Müllsammler (GC) Ableitungen behalten muss (»yes«), wenn sie
1546lebendige Ausgaben haben, oder nicht (»no«).
1547
1548Für »yes«, den Vorgabewert, behält der Müllsammler Ableitungen —
1549z.B. @code{.drv}-Dateien —, solange zumindest eine ihrer Ausgaben lebendig
1550ist. Dadurch können Nutzer den Ursprung der Dateien in ihrem Store
1551nachvollziehen. Setzt man den Wert auf »no«, wird ein bisschen weniger
1552Speicher auf der Platte verbraucht.
1553
1554In this way, setting @code{--gc-keep-derivations} to ``yes'' causes liveness
1555to flow from outputs to derivations, and setting @code{--gc-keep-outputs} to
1556``yes'' causes liveness to flow from derivations to outputs. When both are
1557set to ``yes'', the effect is to keep all the build prerequisites (the
1558sources, compiler, libraries, and other build-time tools) of live objects in
1559the store, regardless of whether these prerequisites are reachable from a GC
1560root. This is convenient for developers since it saves rebuilds or
1561downloads.
1562
1563@item --impersonate-linux-2.6
1564Auf Linux-basierten Systemen wird hiermit vorgetäuscht, dass es sich um
1565Linux 2.6 handeln würde, indem der Kernel für einen
1566@code{uname}-Systemaufruf als Version der Veröffentlichung mit 2.6
1567antwortet.
1568
1569Dies kann hilfreich sein, um Programme zu erstellen, die (normalerweise zu
1570Unrecht) von der Kernel-Versionsnummer abhängen.
1571
1572@item --lose-logs
1573Keine Protokolle der Erstellungen vorhalten. Normalerweise würden solche in
1574@code{@var{localstatedir}/guix/log} gespeichert.
1575
1576@item --system=@var{System}
1577Verwende @var{System} als aktuellen Systemtyp. Standardmäßig ist dies das
1578Paar aus Befehlssatz und Kernel, welches beim Aufruf von @code{configure}
1579erkannt wurde, wie zum Beispiel @code{x86_64-linux}.
1580
1581@item --listen=@var{Endpunkt}
1582Lausche am @var{Endpunkt} auf Verbindungen. Dabei wird der @var{Endpunkt}
1583als Dateiname eines Unix-Sockets verstanden, wenn er mit einem @code{/}
1584(Schrägstrich) beginnt. Andernfalls wird der @var{Endpunkt} als Hostname
1585oder als Hostname-Port-Paar verstanden, auf dem gelauscht wird. Hier sind
1586ein paar Beispiele:
1587
1588@table @code
1589@item --listen=/gnu/var/daemon
1590Lausche auf Verbindungen am Unix-Socket @file{/gnu/var/daemon}, falls nötig
1591wird er dazu erstellt.
1592
1593@item --listen=localhost
1594@cindex Daemon, Fernzugriff
1595@cindex Fernzugriff auf den Daemon
1596@cindex Daemon, Einrichten auf Clustern
1597@cindex Cluster, Einrichtung des Daemons
1598Lausche auf TCP-Verbindungen an der Netzwerkschnittstelle, die
1599@code{localhost} entspricht, auf Port 44146.
1600
1601@item --listen=128.0.0.42:1234
1602Lausche auf TCP-Verbindungen an der Netzwerkschnittstelle, die
1603@code{128.0.0.42} entspricht, auf Port 1234.
1604@end table
1605
1606Diese Befehlszeilenoption kann mehrmals wiederholt werden. In diesem Fall
1607akzeptiert @command{guix-daemon} Verbindungen auf allen angegebenen
1608Endpunkten. Benutzer können bei Client-Befehlen angeben, mit welchem
1609Endpunkt sie sich verbinden möchten, indem sie die Umgebungsvariable
1610@code{GUIX_DAEMON_SOCKET} festlegen (@pxref{Der Store,
1611@code{GUIX_DAEMON_SOCKET}}).
1612
1613@quotation Anmerkung
1614Das Daemon-Protokoll ist @emph{weder authentifiziert noch
1615verschlüsselt}. Die Benutzung von @code{--listen=@var{Host}} eignet sich für
1616lokale Netzwerke, wie z.B. in Rechen-Clustern, wo sich nur solche Knoten mit
1617dem Daemon verbinden, denen man vertraut. In Situationen, wo ein Fernzugriff
1618auf den Daemon durchgeführt wird, empfehlen wir, über Unix-Sockets in
1619Verbindung mit SSH zuzugreifen.
1620@end quotation
1621
1622Wird @code{--listen} nicht angegeben, lauscht @command{guix-daemon} auf
1623Verbindungen auf dem Unix-Socket, der sich unter
1624@file{@var{localstatedir}/guix/daemon-socket/socket} befindet.
1625@end table
1626
1627
1628@node Anwendungen einrichten
1629@section Anwendungen einrichten
1630
1631@cindex Fremddistribution
1632Läuft Guix aufgesetzt auf einer GNU/Linux-Distribution außer GuixSD — einer
1633sogenannten @dfn{Fremddistribution} —, so sind ein paar zusätzliche Schritte
1634bei der Einrichtung nötig. Hier finden Sie manche davon.
1635
1636@subsection Locales
1637
1638@anchor{locales-and-locpath}
1639@cindex Locales, nicht auf GuixSD
1640@vindex LOCPATH
1641@vindex GUIX_LOCPATH
1642Über Guix installierte Pakete benutzen nicht die Daten zu Regions- und
1643Spracheinstellungen (Locales) des Wirtssystems. Stattdessen müssen Sie erst
1644eines der Locale-Pakete installieren, die für Guix verfügbar sind, und dann
1645den Wert Ihrer Umgebungsvariablen @code{GUIX_LOCPATH} passend festlegen:
1646
1647@example
1648$ guix package -i glibc-locales
1649$ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale
1650@end example
1651
1652Beachten Sie, dass das Paket @code{glibc-locales} Daten für alle von
1653GNU@tie{}libc unterstützten Locales enthält und deswegen um die 110@tie{}MiB
1654wiegt. Alternativ gibt es auch @code{glibc-utf8-locales}, was kleiner, aber
1655auf ein paar UTF-8-Locales beschränkt ist.
1656
1657Die Variable @code{GUIX_LOCPATH} spielt eine ähnliche Rolle wie
1658@code{LOCPATH} (@pxref{Locale Names, @code{LOCPATH},, libc, The GNU C
1659Library Reference Manual}). Es gibt jedoch zwei wichtige Unterschiede:
1660
1661@enumerate
1662@item
1663@code{GUIX_LOCPATH} wird nur von der libc in Guix beachtet und nicht der von
1664Fremddistributionen bereitgestellten libc. Mit @code{GUIX_LOCPATH} können
1665Sie daher sicherstellen, dass die Programme der Fremddistribution keine
1666inkompatiblen Locale-Daten von Guix laden.
1667
1668@item
1669libc hängt an jeden @code{GUIX_LOCPATH}-Eintrag @code{/X.Y} an, wobei
1670@code{X.Y} die Version von libc ist — z.B. @code{2.22}. Sollte Ihr
1671Guix-Profil eine Mischung aus Programmen enthalten, die an verschiedene
1672libc-Versionen gebunden sind, wird jede nur die Locale-Daten im richtigen
1673Format zu laden versuchen.
1674@end enumerate
1675
1676Das ist wichtig, weil das Locale-Datenformat verschiedener libc-Versionen
1677inkompatibel sein könnte.
1678
1679@subsection Name Service Switch
1680
1681@cindex Name Service Switch, glibc
1682@cindex NSS (Name Service Switch), glibc
1683@cindex nscd (Name Service Caching Daemon)
1684@cindex Name Service Caching Daemon (nscd)
1685Wenn Sie Guix auf einer Fremddistribution verwenden, @emph{empfehlen wir
1686stärkstens}, dass Sie den @dfn{Name Service Cache Daemon} der
1687GNU-C-Bibliothek, @command{nscd}, laufen lassen, welcher auf dem Socket
1688@file{/var/run/nscd/socket} lauschen sollte. Wenn Sie das nicht tun, könnten
1689mit Guix installierte Anwendungen Probleme beim Auflösen von Hostnamen oder
793dcd8c 1690Benutzerkonten haben, oder sogar abstürzen. Die nächsten Absätze erklären
1e40e70b
JL
1691warum.
1692
1693@cindex @file{nsswitch.conf}
1694Die GNU-C-Bibliothek implementiert einen @dfn{Name Service Switch} (NSS),
1695welcher einen erweiterbaren Mechanismus zur allgemeinen »Namensauflösung«
1696darstellt: Hostnamensauflösung, Benutzerkonten und weiteres (@pxref{Name Service Switch,,, libc, The GNU C Library Reference Manual}).
1697
1698@cindex Network Information Service (NIS)
1699@cindex NIS (Network Information Service)
1700Für die Erweiterbarkeit unterstützt der NSS @dfn{Plugins}, welche neue
1701Implementierungen zur Namensauflösung bieten: Zum Beispiel ermöglicht das
1702Plugin @code{nss-mdns} die Namensauflösung für @code{.local}-Hostnamen, das
1703Plugin @code{nis} gestattet die Auflösung von Benutzerkonten über den
1704Network Information Service (NIS) und so weiter. Diese zusätzlichen
1705»Auflösungsdienste« werden systemweit konfiguriert in
1706@file{/etc/nsswitch.conf} und alle auf dem System laufenden Programme halten
1707sich an diese Einstellungen (@pxref{NSS Configuration File,,, libc, The GNU
1708C Reference Manual}).
1709
1710Wenn sie eine Namensauflösung durchführen — zum Beispiel, indem sie die
1711@code{getaddrinfo}-Funktion in C aufrufen — versuchen die Anwendungen als
1712Erstes, sich mit dem nscd zu verbinden; ist dies erfolgreich, führt nscd für
1713sie die weiteren Namensauflösungen durch. Falls nscd nicht läuft, führen sie
1714selbst die Namensauflösungen durch, indem sie die Namensauflösungsdienste in
1715ihren eigenen Adressraum laden und ausführen. Diese Namensauflösungsdienste
1716— die @file{libnss_*.so}-Dateien — werden mit @code{dlopen} geladen, aber
1717sie kommen von der C-Bibliothek des Wirtssystems und nicht von der
1718C-Bibliothek, mit der die Anwendung gebunden wurde (also der C-Bibliothek
1719von Guix).
1720
1721Und hier kommt es zum Problem: Wenn die Anwendung mit der C-Bibliothek von
1722Guix (etwa glibc 2.24) gebunden wurde und die NSS-Plugins von einer anderen
1723C-Bibliothek (etwa @code{libnss_mdns.so} für glibc 2.22) zu laden versucht,
1724wird sie vermutlich abstürzen oder die Namensauflösungen werden unerwartet
1725fehlschlagen.
1726
1727Durch das Ausführen von @command{nscd} auf dem System wird, neben anderen
1728Vorteilen, dieses Problem der binären Inkompatibilität vermieden, weil diese
1729@code{libnss_*.so}-Dateien vom @command{nscd}-Prozess geladen werden, nicht
1730in den Anwendungen selbst.
1731
1732@subsection X11-Schriftarten
1733
1734@cindex Schriftarten
1735Die Mehrheit der graphischen Anwendungen benutzen Fontconfig zum Finden und
1736Laden von Schriftarten und für die Darstellung im X11-Client. Im Paket
1737@code{fontconfig} in Guix werden Schriftarten standardmäßig in
1738@file{$HOME/.guix-profile} gesucht. Um es graphischen Anwendungen, die mit
1739Guix installiert wurden, zu ermöglichen, Schriftarten anzuzeigen, müssen Sie
1740die Schriftarten auch mit Guix installieren. Essenzielle Pakete für
1741Schriftarten sind unter Anderem @code{gs-fonts}, @code{font-dejavu} und
1742@code{font-gnu-freefont-ttf}.
1743
1744Um auf Chinesisch, Japanisch oder Koreanisch verfassten Text in graphischen
1745Anwendungen anzeigen zu können, möchten Sie vielleicht
1746@code{font-adobe-source-han-sans} oder @code{font-wqy-zenhei}
1747installieren. Ersteres hat mehrere Ausgaben, für jede Sprachfamilie eine
1748(@pxref{Pakete mit mehreren Ausgaben.}). Zum Beispiel installiert folgender
1749Befehl Schriftarten für chinesische Sprachen:
1750
1751@example
1752guix package -i font-adobe-source-han-sans:cn
1753@end example
1754
1755@cindex @code{xterm}
1756Ältere Programme wie @command{xterm} benutzen kein Fontconfig, sondern
1757X-Server-seitige Schriftartendarstellung. Solche Programme setzen voraus,
1758dass der volle Name einer Schriftart mit XLFD (X Logical Font Description)
1759angegeben wird, z.B. so:
1760
1761@example
1762-*-dejavu sans-medium-r-normal-*-*-100-*-*-*-*-*-1
1763@end example
1764
1765Um solche vollen Namen für die in Ihrem Guix-Profil installierten
1766TrueType-Schriftarten zu verwenden, müssen Sie den Pfad für Schriftarten
1767(Font Path) des X-Servers anpassen:
1768
1769@c Note: 'xset' does not accept symlinks so the trick below arranges to
1770@c get at the real directory. See <https://bugs.gnu.org/30655>.
1771@example
1772xset +fp $(dirname $(readlink -f ~/.guix-profile/share/fonts/truetype/fonts.dir))
1773@end example
1774
1775@cindex @code{xlsfonts}
1776Danach können Sie den Befehl @code{xlsfonts} ausführen (aus dem Paket
1777@code{xlsfonts}), um sicherzustellen, dass dort Ihre TrueType-Schriftarten
1778aufgeführt sind.
1779
1780@cindex @code{fc-cache}
1781@cindex Font-Cache
1782Nach der Installation der Schriftarten müssen Sie unter Umständen den
1783Schriftarten-Zwischenspeicher (Font-Cache) erneuern, um diese in Anwendungen
1784benutzen zu können. Gleiches gilt, wenn mit Guix installierte Anwendungen
1785anscheinend keine Schriftarten finden können. Um das Erneuern des
1786Font-Caches zu erzwingen, führen Sie @code{fc-cache -f} aus. Der Befehl
1787@code{fc-cache} wird vom Paket @code{fontconfig} angeboten.
1788
1789@subsection X.509-Zertifikate
1790
1791@cindex @code{nss-certs}
1792Das Paket @code{nss-certs} bietet X.509-Zertifikate, womit Programme die
1793Identität von Web-Servern authentifizieren können, auf die über HTTPS
1794zugegriffen wird.
1795
1796Wenn Sie Guix auf einer Fremddistribution verwenden, können Sie dieses Paket
1797installieren und die relevanten Umgebungsvariablen festlegen, damit Pakete
1798wissen, wo sie Zertifikate finden. In @xref{X.509-Zertifikate} stehen
1799genaue Informationen.
1800
1801@subsection Emacs-Pakete
1802
1803@cindex @code{emacs}
1804Wenn Sie mit Guix Pakete für Emacs installieren, werden deren elisp-Dateien
1805entweder in @file{$HOME/.guix-profile/share/emacs/site-lisp/} oder in
1806Unterverzeichnissen von
1807@file{$HOME/.guix-profile/share/emacs/site-lisp/guix.d/}
1808gespeichert. Letzteres Verzeichnis gibt es, weil es Tausende von
1809Emacs-Paketen gibt und sie alle im selben Verzeichnis zu speichern
1810vielleicht nicht verlässlich funktioniert (wegen Namenskonflikten). Daher
1811halten wir es für richtig, für jedes Paket ein anderes Verzeichnis zu
1812benutzen. Das Emacs-Paketsystem organisiert die Dateistruktur ähnlich
1813(@pxref{Package Files,,, emacs, The GNU Emacs Manual}).
1814
1815Standardmäßig »weiß« Emacs (wenn er mit Guix installiert wurde), wo diese
793dcd8c 1816Pakete liegen, Sie müssen also nichts selbst konfigurieren. Wenn Sie aber
1e40e70b
JL
1817aus irgendeinem Grund mit Guix installierte Pakete nicht automatisch laden
1818lassen möchten, können Sie Emacs mit der Befehlszeilenoption
1819@code{--no-site-file} starten (@pxref{Init File,,, emacs, The GNU Emacs
1820Manual}).
1821
1822@subsection GCC-Toolchain
1823
1824@cindex GCC
1825@cindex ld-wrapper
1826
1827Guix bietet individuelle Compiler-Pakete wie etwa @code{gcc}, aber wenn Sie
1828einen vollständigen Satz an Werkzeugen zum Kompilieren und Binden von
1829Quellcode brauchen, werden Sie eigentlich das Paket @code{gcc-toolchain}
1830haben wollen. Das Paket bietet eine vollständige GCC-Toolchain für die
1831Entwicklung mit C/C++, einschließlich GCC selbst, der GNU-C-Bibliothek
1832(Header-Dateien und Binärdateien samt Symbolen zur Fehlersuche/Debugging in
1833der @code{debug}-Ausgabe), Binutils und einen Wrapper für den Binder/Linker.
1834
1835@cindex Versuch, unreine Bibliothek zu benutzen, Fehlermeldung
1836
1837Der Zweck des Wrappers ist, die an den Binder übergebenen
1838Befehlszeilenoptionen mit @code{-L} und @code{-l} zu überprüfen und jeweils
1839passende Argumente mit @code{-rpath} anzufügen, womit dann der echte Binder
1840aufgerufen wird. Standardmäßig weigert sich der Binder-Wrapper, mit
1841Bibliotheken außerhalb des Stores zu binden, um »Reinheit« zu
1842gewährleisten. Das kann aber stören, wenn man die Toolchain benutzt, um mit
1843lokalen Bibliotheken zu binden. Um Referenzen auf Bibliotheken außerhalb des
1844Stores zu erlauben, müssen Sie die Umgebungsvariable
1845@code{GUIX_LD_WRAPPER_ALLOW_IMPURITIES} setzen.
1846
1847@c TODO What else?
1848
1849@c *********************************************************************
1850@node Paketverwaltung
1851@chapter Paketverwaltung
1852
1853@cindex Pakete
1854Der Zweck von GNU Guix ist, Benutzern die leichte Installation,
1855Aktualisierung und Entfernung von Software-Paketen zu ermöglichen, ohne dass
1856sie ihre Erstellungsprozeduren oder Abhängigkeiten kennen müssen. Guix kann
1857natürlich noch mehr als diese offensichtlichen Funktionalitäten.
1858
1859Dieses Kapitel beschreibt die Hauptfunktionalitäten von Guix, sowie die von
1860Guix angebotenen Paketverwaltungswerkzeuge. Zusätzlich von den im Folgenden
1861beschriebenen Befehlszeilen-Benutzerschnittstellen (@pxref{Aufruf von guix package, @code{guix package}}) können Sie auch mit der
1862Emacs-Guix-Schnittstelle (@pxref{Top,,, emacs-guix, The Emacs-Guix Reference
1863Manual}) arbeiten, nachdem Sie das Paket @code{emacs-guix} installiert haben
1864(führen Sie zum Einstieg in Emacs-Guix den Emacs-Befehl @kbd{M-x guix-help}
1865aus):
1866
1867@example
1868guix package -i emacs-guix
1869@end example
1870
1871@menu
1872* Funktionalitäten:: Wie Guix Ihr Leben schöner machen wird.
1873* Aufruf von guix package:: Pakete installieren, entfernen usw.
1874* Substitute:: Vorerstelle Binärdateien herunterladen.
1875* Pakete mit mehreren Ausgaben.:: Ein Quellpaket, mehrere Ausgaben.
1876* Aufruf von guix gc:: Den Müllsammler laufen lassen.
1877* Aufruf von guix pull:: Das neueste Guix samt Distribution laden.
1878* Channels:: Customizing the package collection.
1879* Inferiors:: Interacting with another revision of Guix.
1880* Invoking guix describe:: Display information about your Guix revision.
1881* Aufruf von guix pack:: Software-Bündel erstellen.
1882* Aufruf von guix archive:: Import und Export von Store-Dateien.
1883@end menu
1884
1885@node Funktionalitäten
1886@section Funktionalitäten
1887
1888Wenn Sie Guix benutzen, landet jedes Paket schließlich im @dfn{Paket-Store}
1889in seinem eigenen Verzeichnis — der Name ist ähnlich wie
1890@file{/gnu/store/xxx-package-1.2}, wobei @code{xxx} eine Zeichenkette in
1891Base32-Darstellung ist.
1892
1893Statt diese Verzeichnisse direkt anzugeben, haben Nutzer ihr eigenes
1894@dfn{Profil}, welches auf diejenigen Pakete zeigt, die sie tatsächlich
1895benutzen wollen. Diese Profile sind im Persönlichen Ordner des jeweiligen
1896Nutzers gespeichert als @code{$HOME/.guix-profile}.
1897
1898Zum Beispiel installiert @code{alice} GCC 4.7.2. Dadurch zeigt dann
1899@file{/home/alice/.guix-profile/bin/gcc} auf
1900@file{/gnu/store/@dots{}-gcc-4.7.2/bin/gcc}. Auf demselben Rechner hat
793dcd8c 1901@code{bob} bereits GCC 4.8.0 installiert. Das Profil von @code{bob} zeigt
1e40e70b
JL
1902dann einfach weiterhin auf @file{/gnu/store/@dots{}-gcc-4.8.0/bin/gcc} —
1903d.h. beide Versionen von GCC koexistieren auf demselben System, ohne sich zu
1904stören.
1905
1906Der Befehl @command{guix package} ist das zentrale Werkzeug, um Pakete zu
1907verwalten (@pxref{Aufruf von guix package}). Es arbeitet auf dem eigenen
1908Profil jedes Nutzers und kann @emph{mit normalen Benutzerrechten} ausgeführt
1909werden.
1910
1911@cindex Transaktionen
1912Der Befehl stellt die offensichtlichen Installations-, Entfernungs- und
1913Aktualisierungsoperationen zur Verfügung. Jeder Aufruf ist tatsächlich eine
1914eigene @emph{Transaktion}: Entweder die angegebene Operation wird
1915erfolgreich durchgeführt, oder gar nichts passiert. Wenn also der Prozess
1916von @command{guix package} während der Transaktion beendet wird, oder es zum
1917Stromausfall während der Transaktion kommt, dann bleibt der alte, nutzbare
1918Zustands des Nutzerprofils erhalten.
1919
1920Zudem kann jede Pakettransaktion @emph{zurückgesetzt} werden
793dcd8c 1921(Rollback). Wird also zum Beispiel durch eine Aktualisierung eine neue
1e40e70b
JL
1922Version eines Pakets installiert, die einen schwerwiegenden Fehler zur Folge
1923hat, können Nutzer ihr Profil einfach auf die vorherige Profilinstanz
1924zurücksetzen, von der sie wissen, dass sie gut lief. Ebenso unterliegt auf
1925GuixSD auch die globale Systemkonfiguration transaktionellen
793dcd8c 1926Aktualisierungen und Rücksetzungen (@pxref{Das Konfigurationssystem nutzen}).
1e40e70b
JL
1927
1928Alle Pakete im Paket-Store können vom @emph{Müllsammler} (Garbage Collector)
1929gelöscht werden. Guix ist in der Lage, festzustellen, welche Pakete noch
1930durch Benutzerprofile referenziert werden, und entfernt nur diese, die
1931nachweislich nicht mehr referenziert werden (@pxref{Aufruf von guix gc}). Benutzer können auch ausdrücklich alte Generationen ihres Profils
1932löschen, damit die zugehörigen Pakete vom Müllsammler gelöscht werden
1933können.
1934
1935@cindex Reproduzierbarkeit
1936@cindex Reproduzierbare Erstellungen
1937Guix takes a @dfn{purely functional} approach to package management, as
1938described in the introduction (@pxref{Einführung}). Each
1939@file{/gnu/store} package directory name contains a hash of all the inputs
1940that were used to build that package---compiler, libraries, build scripts,
1941etc. This direct correspondence allows users to make sure a given package
1942installation matches the current state of their distribution. It also helps
1943maximize @dfn{build reproducibility}: thanks to the isolated build
1944environments that are used, a given build is likely to yield bit-identical
1945files when performed on different machines (@pxref{Aufruf des guix-daemon,
1946container}).
1947
1948@cindex Substitute
1949Auf dieser Grundlage kann Guix @dfn{transparent Binär- oder Quelldateien
1950ausliefern}. Wenn eine vorerstellte Binärdatei für ein
1951@file{/gnu/store}-Objekt von einer externen Quelle verfügbar ist — ein
1952@dfn{Substitut} —, lädt Guix sie einfach herunter und entpackt sie,
1953andernfalls erstellt Guix das Paket lokal aus seinem Quellcode
1954(@pxref{Substitute}). Weil Erstellungsergebnisse normalerweise Bit für Bit
1955reproduzierbar sind, müssen die Nutzer den Servern, die Substitute anbieten,
1956nicht blind vertrauen; sie können eine lokale Erstellung erzwingen und
1957Substitute @emph{anfechten} (@pxref{Aufruf von guix challenge}).
1958
1959Kontrolle über die Erstellungsumgebung ist eine auch für Entwickler
1960nützliche Funktionalität. Der Befehl @command{guix environment} ermöglicht
1961es Entwicklern eines Pakets, schnell die richtige Entwicklungsumgebung für
1962ihr Paket einzurichten, ohne manuell die Abhängigkeiten des Pakets in ihr
1963Profil installieren zu müssen (@pxref{Aufruf von guix environment}).
1964
1965@cindex replication, of software environments
1966@cindex provenance tracking, of software artifacts
1967All of Guix and its package definitions is version-controlled, and
1968@command{guix pull} allows you to ``travel in time'' on the history of Guix
1969itself (@pxref{Aufruf von guix pull}). This makes it possible to replicate a
1970Guix instance on a different machine or at a later point in time, which in
1971turn allows you to @emph{replicate complete software environments}, while
1972retaining precise @dfn{provenance tracking} of the software.
1973
1974@node Aufruf von guix package
1975@section Invoking @command{guix package}
1976
1977@cindex Installieren von Paketen
1978@cindex Entfernen von Paketen
1979@cindex Paketinstallation
1980@cindex Paketentfernung
1981Der Befehl @command{guix package} ist ein Werkzeug, womit Nutzer Pakete
1982installieren, aktualisieren, entfernen und auf vorherige Konfigurationen
1983zurücksetzen können. Dabei wird nur das eigene Profil des Nutzers verwendet,
1984und es funktioniert mit normalen Benutzerrechten, ohne Administratorrechte
1985(@pxref{Funktionalitäten}). Die Syntax ist:
1986
1987@example
1988guix package @var{Optionen}
1989@end example
1990@cindex Transaktionen
1991In erster Linie geben die @var{Optionen} an, welche Operationen in der
1992Transaktion durchgeführt werden sollen. Nach Abschluss wird ein neues Profil
1993erzeugt, aber vorherige @dfn{Generationen} des Profils bleiben verfügbar,
1994falls der Benutzer auf sie zurückwechseln will.
1995
1996Um zum Beispiel @code{lua} zu entfernen und @code{guile} und
1997@code{guile-cairo} in einer einzigen Transaktion zu installieren:
1998
1999@example
2000guix package -r lua -i guile guile-cairo
2001@end example
2002
2003@command{guix package} unterstützt auch ein @dfn{deklaratives Vorgehen},
2004wobei der Nutzer die genaue Menge an Paketen, die verfügbar sein sollen,
2005festlegt und über die Befehlszeilenoption @option{--manifest} übergibt
2006(@pxref{profile-manifest, @option{--manifest}}).
2007
2008@cindex Profil
2009Für jeden Benutzer wird automatisch eine symbolische Verknüpfung zu seinem
2010Standardprofil angelegt als @file{$HOME/.guix-profile}. Diese symbolische
2011Verknüpfung zeigt immer auf die aktuelle Generation des Standardprofils des
2012Benutzers. Somit können Nutzer @file{$HOME/.guix-profile/bin} z.B. zu ihrer
2013Umgebungsvariablen @code{PATH} hinzufügen.
2014@cindex Suchpfade
2015Wenn Sie nicht die Guix System Distribution benutzen, sollten Sie in
2016Betracht ziehen, folgende Zeilen zu Ihrem @file{~/.bash_profile}
2017hinzuzufügen (@pxref{Bash Startup Files,,, bash, The GNU Bash Reference
2018Manual}), damit in neu erzeugten Shells alle Umgebungsvariablen richtig
2019definiert werden:
2020
2021@example
2022GUIX_PROFILE="$HOME/.guix-profile" ; \
2023source "$HOME/.guix-profile/etc/profile"
2024@end example
2025
2026Ist Ihr System für mehrere Nutzer eingerichtet, werden Nutzerprofile an
2027einem Ort gespeichert, der als @dfn{Müllsammlerwurzel} registriert ist, auf
2028die @file{$HOME/.guix-profile} zeigt (@pxref{Aufruf von guix gc}). Dieses
2029Verzeichnis ist normalerweise
2030@code{@var{localstatedir}/guix/profiles/per-user/@var{Benutzer}}, wobei
2031@var{localstatedir} der an @code{configure} als @code{--localstatedir}
2032übergebene Wert ist und @var{Benutzer} für den jeweiligen Benutzernamen
2033steht. Das @file{per-user}-Verzeichnis wird erstellt, wenn
2034@command{guix-daemon} gestartet wird, und das Unterverzeichnis
2035@var{Benutzer} wird durch @command{guix package} erstellt.
2036
2037Als @var{Optionen} kann vorkommen:
2038
2039@table @code
2040
2041@item --install=@var{Paket} @dots{}
2042@itemx -i @var{Paket} @dots{}
2043Die angegebenen @var{Paket}e installieren.
2044
2045Jedes @var{Paket} kann entweder einfach durch seinen Paketnamen aufgeführt
2046werden, wie @code{guile}, oder als Paketname gefolgt von einem At-Zeichen @@
2047und einer Versionsnummer, wie @code{guile@@1.8.8} oder auch nur
2048@code{guile@@1.8} (in letzterem Fall wird die neueste Version mit Präfix
2049@code{1.8} ausgewählt.)
2050
2051Wird keine Versionsnummer angegeben, wird die neueste verfügbare Version
2052ausgewählt. Zudem kann im @var{Paket} ein Doppelpunkt auftauchen, gefolgt
2053vom Namen einer der Ausgaben des Pakets, wie @code{gcc:doc} oder
2054@code{binutils@@2.22:lib} (@pxref{Pakete mit mehreren Ausgaben.}). Pakete
2055mit zugehörigem Namen (und optional der Version) werden unter den Modulen
2056der GNU-Distribution gesucht (@pxref{Paketmodule}).
2057
2058@cindex propagierte Eingaben
2059Manchmal haben Pakete @dfn{propagierte Eingaben}: Als solche werden
2060Abhängigkeiten bezeichnet, die automatisch zusammen mit dem angeforderten
2061Paket installiert werden (im Abschnitt @pxref{package-propagated-inputs,
2062@code{propagated-inputs} in @code{package} objects} sind weitere
2063Informationen über propagierte Eingaben in Paketdefinitionen zu finden).
2064
2065@anchor{package-cmd-propagated-inputs}
2066Ein Beispiel ist die GNU-MPC-Bibliothek: Ihre C-Headerdateien verweisen auf
2067die der GNU-MPFR-Bibliothek, welche wiederum auf die der GMP-Bibliothek
2068verweisen. Wenn also MPC installiert wird, werden auch die MPFR- und
2069GMP-Bibliotheken in das Profil installiert; entfernt man MPC, werden auch
2070MPFR und GMP entfernt — außer sie wurden noch auf andere Art ausdrücklich
2071vom Nutzer installiert.
2072
2073Abgesehen davon setzen Pakete manchmal die Definition von Umgebungsvariablen
2074für ihre Suchpfade voraus (siehe die Erklärung von @code{--search-paths}
2075weiter unten). Alle fehlenden oder womöglich falschen Definitionen von
2076Umgebungsvariablen werden hierbei gemeldet.
2077
2078@item --install-from-expression=@var{Ausdruck}
2079@itemx -e @var{Ausdruck}
2080Das Paket installieren, zu dem der @var{Ausdruck} ausgewertet wird.
2081
2082Beim @var{Ausdruck} muss es sich um einen Scheme-Ausdruck handeln, der zu
2083einem @code{<package>}-Objekt ausgewertet wird. Diese Option ist besonders
2084nützlich, um zwischen gleichnamigen Varianten eines Pakets zu unterscheiden,
2085durch Ausdrücke wie @code{(@@ (gnu packages base) guile-final)}.
2086
2087Beachten Sie, dass mit dieser Option die erste Ausgabe des angegebenen
2088Pakets installiert wird, was unzureichend sein kann, wenn eine bestimmte
2089Ausgabe eines Pakets mit mehreren Ausgaben gewünscht ist.
2090
2091@item --install-from-file=@var{Datei}
2092@itemx -f @var{Datei}
2093Das Paket installieren, zu dem der Code in der @var{Datei} ausgewertet wird.
2094
2095Zum Beispiel könnte die @var{Datei} eine Definition wie diese enthalten
2096(@pxref{Pakete definieren}):
2097
2098@example
2099@verbatiminclude package-hello.scm
2100@end example
2101
2102Entwickler könnten es für nützlich erachten, eine solche
2103@file{guix.scm}-Datei im Quellbaum ihres Projekts abzulegen, mit der
2104Zwischenstände der Entwicklung getestet und reproduzierbare
2105Erstellungsumgebungen aufgebaut werden können (@pxref{Aufruf von guix environment}).
2106
2107@item --remove=@var{Paket} @dots{}
2108@itemx -r @var{Paket} @dots{}
2109Die angegebenen @var{Paket}e entfernen.
2110
2111Wie auch bei @code{--install} kann jedes @var{Paket} neben dem Paketnamen
2112auch eine Versionsnummer und/oder eine Ausgabe benennen. Zum Beispiel würde
2113@code{-r glibc:debug} die @code{debug}-Ausgabe von @code{glibc} aus dem
2114Profil entfernen.
2115
2116@item --upgrade[=@var{Regexp} @dots{}]
2117@itemx -u [@var{Regexp} @dots{}]
2118@cindex Pakete aktualisieren
2119Alle installierten Pakete aktualisieren. Wenn einer oder mehr reguläre
2120Ausdrücke (Regexps) angegeben wurden, werden nur diejenigen installierten
2121Pakete aktualisiert, deren Name zu einer der @var{Regexp}s passt. Siehe auch
2122weiter unten die Befehlszeilenoption @code{--do-not-upgrade}.
2123
2124Beachten Sie, dass das Paket so auf die neueste Version unter den Paketen
2125gebracht wird, die in der aktuell installierten Distribution vorliegen. Um
2126jedoch Ihre Distribution zu aktualisieren, sollten Sie regelmäßig
2127@command{guix pull} ausführen (@pxref{Aufruf von guix pull}).
2128
2129@item --do-not-upgrade[=@var{Regexp} @dots{}]
2130In Verbindung mit der Befehlszeilenoption @code{--upgrade}, führe
2131@emph{keine} Aktualisierung von Paketen durch, deren Name zum regulären
2132Ausdruck @var{Regexp} passt. Um zum Beispiel alle Pakete im aktuellen Profil
2133zu aktualisieren mit Ausnahme derer, die »emacs« im Namen haben:
2134
2135@example
2136$ guix package --upgrade . --do-not-upgrade emacs
2137@end example
2138
2139@item @anchor{profile-manifest}--manifest=@var{Datei}
2140@itemx -m @var{Datei}
2141@cindex Profildeklaration
2142@cindex Profilmanifest
2143Erstellt eine neue Generation des Profils aus dem vom Scheme-Code in
2144@var{Datei} gelieferten Manifest-Objekt.
2145
2146Dadurch könnrn Sie den Inhalt des Profils @emph{deklarieren}, statt ihn
2147durch eine Folge von Befehlen wie @code{--install} u.Ä. zu generieren. Der
2148Vorteil ist, dass die @var{Datei} unter Versionskontrolle gestellt werden
2149kann, auf andere Maschinen zum Reproduzieren desselben Profils kopiert
2150werden kann und Ähnliches.
2151
2152@c FIXME: Add reference to (guix profile) documentation when available.
2153Der Code in der @var{Datei} muss ein @dfn{Manifest}-Objekt liefern, was
2154ungefähr einer Liste von Paketen entspricht:
2155
2156@findex packages->manifest
2157@example
2158(use-package-modules guile emacs)
2159
2160(packages->manifest
2161 (list emacs
2162 guile-2.0
2163 ;; Eine bestimmte Paketausgabe nutzen.
2164 (list guile-2.0 "debug")))
2165@end example
2166
2167@findex specifications->manifest
2168In diesem Beispiel müssen wir wissen, welche Module die Variablen
2169@code{emacs} und @code{guile-2.0} definieren, um die richtige Angabe mit
2170@code{use-package-modules} machen zu können, was umständlich sein kann. Wir
2171können auch normale Paketnamen angeben und sie durch
2172@code{specifications->manifest} zu den entsprechenden Paketobjekten
2173auflösen, zum Beispiel so:
2174
2175@example
2176(specifications->manifest
2177 '("emacs" "guile@@2.2" "guile@@2.2:debug"))
2178@end example
2179
2180@item --roll-back
2181@cindex rücksetzen
2182@cindex Zurücksetzen von Transaktionen
2183@cindex Transaktionen, zurücksetzen
793dcd8c 2184Wechselt zur vorherigen @dfn{Generation} des Profils zurück — d.h. macht die
1e40e70b
JL
2185letzte Transaktion rückgängig.
2186
2187In Verbindung mit Befehlszeilenoptionen wie @code{--install} wird zuerst
2188zurückgesetzt, bevor andere Aktionen durchgeführt werden.
2189
2190Ein Rücksetzen der ersten Generation, die installierte Pakete enthält,
2191wechselt das Profil zur @dfn{nullten Generation}, die keinerlei Dateien
2192enthält, abgesehen von Metadaten über sich selbst.
2193
2194Nach dem Zurücksetzen überschreibt das Installieren, Entfernen oder
2195Aktualisieren von Paketen vormals zukünftige Generationen, d.h. der Verlauf
2196der Generationen eines Profils ist immer linear.
2197
2198@item --switch-generation=@var{Muster}
2199@itemx -S @var{Muster}
2200@cindex Generationen
2201Wechselt zu der bestimmten Generation, die durch das @var{Muster} bezeichnet
2202wird.
2203
2204Als @var{Muster} kann entweder die Nummer einer Generation oder eine Nummer
2205mit vorangestelltem »+« oder »-« dienen. Letzteres springt die angegebene
2206Anzahl an Generationen vor oder zurück. Zum Beispiel kehrt
2207@code{--switch-generation=+1} nach einem Zurücksetzen wieder zur neueren
2208Generation zurück.
2209
2210Der Unterschied zwischen @code{--roll-back} und
2211@code{--switch-generation=-1} ist, dass @code{--switch-generation} keine
2212nullte Generation erzeugen wird; existiert die angegebene Generation nicht,
2213bleibt schlicht die aktuelle Generation erhalten.
2214
2215@item --search-paths[=@var{Art}]
2216@cindex Suchpfade
2217Führe die Definitionen von Umgebungsvariablen auf, in Bash-Syntax, die nötig
2218sein könnten, um alle installierten Pakete nutzen zu können. Diese
2219Umgebungsvariablen werden benutzt, um die @dfn{Suchpfade} für Dateien
2220festzulegen, die von einigen installierten Paketen benutzt werden.
2221
2222Zum Beispiel braucht GCC die Umgebungsvariablen @code{CPATH} und
2223@code{LIBRARY_PATH}, um zu wissen, wo sich im Benutzerprofil Header und
2224Bibliotheken befinden (@pxref{Environment Variables,,, gcc, Using the GNU
2225Compiler Collection (GCC)}). Wenn GCC und, sagen wir, die C-Bibliothek im
2226Profil installiert sind, schlägt @code{--search-paths} also vor, diese
2227Variablen jeweils auf @code{@var{profile}/include} und
2228@code{@var{profile}/lib} verweisen zu lassen.
2229
2230Die typische Nutzung ist, in der Shell diese Variablen zu definieren:
2231
2232@example
2233$ eval `guix package --search-paths`
2234@end example
2235
2236Als @var{Art} kann entweder @code{exact}, @code{prefix} oder @code{suffix}
2237gewählt werden, wodurch die gelieferten Definitionen der Umgebungsvariablen
2238entweder exakt die Einstellungen für Guix meldet, oder sie als Präfix oder
2239Suffix an den aktuellen Wert dieser Variablen anhängt. Gibt man keine
2240@var{Art} an, wird der Vorgabewert @code{exact} verwendet.
2241
2242Diese Befehlszeilenoption kann auch benutzt werden, um die
2243@emph{kombinierten} Suchpfade mehrerer Profile zu berechnen. Betrachten Sie
2244dieses Beispiel:
2245
2246@example
2247$ guix package -p foo -i guile
2248$ guix package -p bar -i guile-json
2249$ guix package -p foo -p bar --search-paths
2250@end example
2251
2252Der letzte Befehl oben meldet auch die Definition der Umgebungsvariablen
2253@code{GUILE_LOAD_PATH}, obwohl für sich genommen weder @file{foo} noch
2254@file{bar} zu dieser Empfehlung führen würden.
2255
2256
2257@item --profile=@var{Profil}
2258@itemx -p @var{Profil}
2259Auf @var{Profil} anstelle des Standardprofils des Benutzers arbeiten.
2260
2261@cindex Kollisionen, in einem Profil
2262@cindex Paketkollisionen in Profilen
2263@cindex Profilkollisionen
2264@item --allow-collisions
2265Kollidierende Pakete im neuen Profil zulassen. Benutzung auf eigene Gefahr!
2266
2267Standardmäßig wird @command{guix package} @dfn{Kollisionen} als Fehler
2268auffassen und melden. Zu Kollisionen kommt es, wenn zwei oder mehr
2269verschiedene Versionen oder Varianten desselben Pakets im Profil landen.
2270
2271@item --verbose
2272Erzeugt ausführliche Textausgaben. Insbesondere wird auch das
2273Erstellungsprotokoll der Umgebung auf dem Standard-Fehler-Port (stderr)
2274ausgegeben.
2275
2276@item --bootstrap
2277Erstellt das Profil mit dem Bootstrap-Guile. Diese Option ist nur für
2278Entwickler der Distribution nützlich.
2279
2280@end table
2281
2282Zusätzlich zu diesen Aktionen unterstützt @command{guix package} folgende
2283Befehlszeilenoptionen, um den momentanen Zustand eines Profils oder die
2284Verfügbarkeit von Paketen nachzulesen:
2285
2286@table @option
2287
2288@item --search=@var{Regexp}
2289@itemx -s @var{Regexp}
2290@cindex Suche nach Paketen
793dcd8c 2291Führt alle verfügbaren Pakete auf, deren Name, Zusammenfassung oder
1e40e70b
JL
2292Beschreibung zum regulären Ausdruck @var{Regexp} passt, sortiert nach ihrer
2293Relevanz. Alle Metadaten passender Pakete werden im @code{recutils}-Format
2294geliefert (@pxref{Top, GNU recutils databases,, recutils, GNU recutils
2295manual}).
2296
2297So können bestimmte Felder mit dem Befehl @command{recsel} extrahiert
2298werden, zum Beispiel:
2299
2300@example
2301$ guix package -s malloc | recsel -p name,version,relevance
2302name: jemalloc
2303version: 4.5.0
2304relevance: 6
2305
2306name: glibc
2307version: 2.25
2308relevance: 1
2309
2310name: libgc
2311version: 7.6.0
2312relevance: 1
2313@end example
2314
2315Ebenso kann der Name aller zu den Bedingungen der GNU@tie{}LGPL, Version 3,
2316verfügbaren Pakete ermittelt werden:
2317
2318@example
2319$ guix package -s "" | recsel -p name -e 'license ~ "LGPL 3"'
2320name: elfutils
2321
2322name: gmp
2323@dots{}
2324@end example
2325
2326Es ist auch möglich, Suchergebnisse näher einzuschränken, indem Sie
2327@code{-s} mehrmals übergeben. Zum Beispiel liefert folgender Befehl eines
2328Liste von Brettspielen:
2329
2330@example
2331$ guix package -s '\<board\>' -s game | recsel -p name
2332name: gnubg
2333@dots{}
2334@end example
2335
2336Würden wir @code{-s game} weglassen, bekämen wir auch Software-Pakete
2337aufgelistet, die mit »printed circuit boards« (elektronischen Leiterplatten)
2338zu tun haben; ohne die spitzen Klammern um @code{board} bekämen wir auch
2339Pakete, die mit »keyboards« (Tastaturen, oder musikalischen Keyboard) zu tun
2340haben.
2341
2342Es ist Zeit für ein komplexeres Beispiel. Folgender Befehl sucht
2343kryptographische Bibliotheken, filtert Haskell-, Perl-, Python- und
2344Ruby-Bibliotheken heraus und gibt Namen und Zusammenfassung passender Pakete
2345aus:
2346
2347@example
2348$ guix package -s crypto -s library | \
2349 recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis
2350@end example
2351
2352@noindent
2353@xref{Selection Expressions,,, recutils, GNU recutils manual} enthält
2354weitere Informationen über @dfn{Auswahlausdrücke} mit @code{recsel -e}.
2355
2356@item --show=@var{Paket}
2357Zeigt Details über das @var{Paket} aus der Liste verfügbarer Pakete, im
2358@code{recutils}-Format (@pxref{Top, GNU recutils databases,, recutils, GNU
2359recutils manual}).
2360
2361@example
2362$ guix package --show=python | recsel -p name,version
2363name: python
2364version: 2.7.6
2365
2366name: python
2367version: 3.3.5
2368@end example
2369
2370Sie können auch den vollständigen Namen eines Pakets angeben, um Details nur
2371über diese Version angezeigt zu bekommen:
2372@example
2373$ guix package --show=python@@3.4 | recsel -p name,version
2374name: python
2375version: 3.4.3
2376@end example
2377
2378
2379
2380@item --list-installed[=@var{Regexp}]
2381@itemx -I [@var{Regexp}]
2382Listet die derzeit installierten Pakete im angegebenen Profil auf, die
2383zuletzt installierten Pakete zuletzt. Wenn ein regulärer Ausdruck
2384@var{Regexp} angegeben wird, werden nur installierte Pakete aufgeführt,
2385deren Name zu @var{Regexp} passt.
2386
2387Zu jedem installierten Paket werden folgende Informationen angezeigt, durch
2388Tabulatorzeichen getrennt: der Paketname, die Version als Zeichenkette,
2389welche Teile des Pakets installiert sind (zum Beispiel @code{out}, wenn die
2390Standard-Paketausgabe installiert ist, @code{include}, wenn seine Header
2391installiert sind, usw.) und an welchem Pfad das Paket im Store zu finden
2392ist.
2393
2394@item --list-available[=@var{Regexp}]
2395@itemx -A [@var{Regexp}]
2396Listet Pakete auf, die in der aktuell installierten Distribution dieses
2397Systems verfügbar sind (@pxref{GNU-Distribution}). Wenn ein regulärer
2398Ausdruck @var{Regexp} angegeben wird, werden nur Pakete aufgeführt, deren
2399Name zum regulären Ausdruck @var{Regexp} passt.
2400
2401Zu jedem Paket werden folgende Informationen getrennt durch Tabulatorzeichen
2402ausgegeben: der Name, die Version als Zeichenkette, die Teile des Programms
2403(@pxref{Pakete mit mehreren Ausgaben.}) und die Stelle im Quellcode, an der
2404das Paket definiert ist.
2405
2406@item --list-generations[=@var{Muster}]
2407@itemx -l [@var{Muster}]
2408@cindex Generationen
2409Liefert eine Liste der Generationen zusammen mit dem Datum, an dem sie
2410erzeugt wurden; zu jeder Generation werden zudem die installierten Pakete
2411angezeigt, zuletzt installierte Pakete zuletzt. Beachten Sie, dass die
2412nullte Generation niemals angezeigt wird.
2413
2414Zu jedem installierten Paket werden folgende Informationen durch
2415Tabulatorzeichen getrennt angezeigt: der Name des Pakets, die Version als
2416Zeichenkette, welcher Teil des Pakets installiert ist (@pxref{Pakete mit mehreren Ausgaben.}) und an welcher Stelle sich das Paket im Store befindet.
2417
2418Wenn ein @var{Muster} angegeben wird, liefert der Befehl nur dazu passende
2419Generationen. Gültige Muster sind zum Beispiel:
2420
2421@itemize
2422@item @emph{Ganze Zahlen und kommagetrennte ganze Zahlen}. Beide Muster bezeichnen
2423Generationsnummern. Zum Beispiel liefert @code{--list-generations=1} die
2424erste Generation.
2425
2426Durch @code{--list-generations=1,8,2} werden drei Generationen in der
2427angegebenen Reihenfolge angezeigt. Weder Leerzeichen noch ein Komma am
2428Schluss der Liste ist erlaubt.
2429
2430@item @emph{Bereiche}. @code{--list-generations=2..9} gibt die
2431angegebenen Generationen und alles dazwischen aus. Beachten Sie, dass der
2432Bereichsanfang eine kleinere Zahl als das Bereichsende sein muss.
2433
2434Sie können auch kein Bereichsende angeben, zum Beispiel liefert
2435@code{--list-generations=2..} alle Generationen ab der zweiten.
2436
2437@item @emph{Zeitdauern}. Sie können auch die letzten @emph{N}@tie{}Tage, Wochen
2438or months by passing an integer along with the first letter of the
2439duration. For example, @code{--list-generations=20d} lists generations that
2440are up to 20 days old.
2441@end itemize
2442
2443@item --delete-generations[=@var{Muster}]
2444@itemx -d [@var{Muster}]
2445Wird kein @var{Muster} angegeben, werden alle Generationen außer der
2446aktuellen entfernt.
2447
2448Dieser Befehl akzeptiert dieselben Muster wie
2449@option{--list-generations}. Wenn ein @var{Muster} angegeben wird, werden
2450die passenden Generationen gelöscht. Wenn das @var{Muster} für eine
2451Zeitdauer steht, werden diejenigen Generationen gelöscht, die @emph{älter}
2452als die angegebene Dauer sind. Zum Beispiel löscht
2453@code{--delete-generations=1m} die Generationen, die mehr als einen Monat
2454alt sind.
2455
2456Falls die aktuelle Generation zum Muster passt, wird sie @emph{nicht}
2457gelöscht. Auch die nullte Generation wird niemals gelöscht.
2458
2459Beachten Sie, dass Sie auf gelöschte Generationen nicht zurückwechseln
2460können. Dieser Befehl sollte also nur mit Vorsicht benutzt werden.
2461
2462@end table
2463
2464Zu guter Letzt können Sie, da @command{guix package} Erstellungsprozesse zu
2465starten vermag, auch alle gemeinsamen Erstellungsoptionen (@pxref{Gemeinsame Erstellungsoptionen}) verwenden. Auch Paketumwandlungsoptionen wie
2466@option{--with-source} sind möglich (@pxref{Paketumwandlungsoptionen}). Beachten Sie jedoch, dass die verwendeten
2467Paketumwandlungsoptionen verloren gehen, nachdem Sie die Pakete aktualisiert
2468haben. Damit Paketumwandlungen über Aktualisierungen hinweg erhalten
2469bleiben, sollten Sie Ihre eigene Paketvariante in einem Guile-Modul
2470definieren und zur Umgebungsvariablen @code{GUIX_PACKAGE_PATH} hinzufügen
2471(@pxref{Pakete definieren}).
2472
2473@node Substitute
2474@section Substitute
2475
2476@cindex Substitute
2477@cindex vorerstellte Binärdateien
2478Guix kann transparent Binär- oder Quelldateien ausliefern. Das heißt, Dinge
2479können sowohl lokal erstellt, als auch als vorerstellte Objekte von einem
2480Server heruntergeladen werden, oder beides gemischt. Wir bezeichnen diese
2481vorerstellten Objekte als @dfn{Substitute} — sie substituieren lokale
2482Erstellungsergebnisse. In vielen Fällen geht das Herunterladen eines
2483Substituts wesentlich schneller, als Dinge lokal zu erstellen.
2484
2485Substitute können alles sein, was das Ergebnis einer Ableitungserstellung
2486ist (@pxref{Ableitungen}). Natürlich sind sie üblicherweise vorerstellte
2487Paket-Binärdateien, aber wenn zum Beispiel ein Quell-Tarball das Ergebnis
2488einer Ableitungserstellung ist, kann auch er als Substitut verfügbar sein.
2489
2490@menu
2491* Offizieller Substitut-Server:: Eine besondere Quelle von Substituten.
2492* Substitut-Server autorisieren:: Wie man Substitute an- und abschaltet.
2493* Substitutauthentifizierung:: Wie Guix Substitute verifiziert.
2494* Proxy-Einstellungen:: Wie Sie Substitute über einen Proxy beziehen.
2495* Fehler bei der Substitution:: Was passiert, wenn die Substitution
2496 fehlschlägt.
2497* Vom Vertrauen gegenüber Binärdateien:: Wie können Sie diesem binären
2498 Blob trauen?
2499@end menu
2500
2501@node Offizieller Substitut-Server
2502@subsection Offizieller Substitut-Server
2503
2504@cindex Hydra
2505@cindex Build-Farm
2506Der Server @code{mirror.hydra.gnu.org} ist die Façade für eine offizielle
2507»Build-Farm«, ein Erstellungswerk, das kontinuierlich Guix-Pakete für einige
2508Prozessorarchitekturen erstellt und sie als Substitute zur Verfügung
2509stellt. Dies ist die standardmäßige Quelle von Substituten; durch Übergeben
2510der Befehlszeilenoption @option{--substitute-urls} an entweder den
2511@command{guix-daemon} (@pxref{daemon-substitute-urls,, @code{guix-daemon
2512--substitute-urls}}) oder Client-Werkzeuge wie @command{guix package}
2513(@pxref{client-substitute-urls,, client @option{--substitute-urls} option})
2514kann eine abweichende Einstellung benutzt werden.
2515
2516Substitut-URLs können entweder HTTP oder HTTPS sein. HTTPS wird empfohlen,
2517weil die Kommunikation verschlüsselt ist; umgekehrt kann bei HTTP die
2518Kommunikation belauscht werden, wodurch der Angreifer zum Beispiel erfahren
2519könnte, ob Ihr System über noch nicht behobene Sicherheitsschwachstellen
2520verfügt.
2521
2522Substitute von der offiziellen Build-Farm sind standardmäßig erlaubt, wenn
793dcd8c 2523Sie die Guix-System-Distribution verwenden (@pxref{GNU-Distribution}). Auf
1e40e70b
JL
2524Fremddistributionen sind sie allerdings standardmäßig ausgeschaltet, solange
2525Sie sie nicht ausdrücklich in einem der empfohlenen Installationsschritte
2526erlaubt haben (@pxref{Installation}). Die folgenden Absätze beschreiben, wie
2527Sie Substitute für die offizielle Build-Farm an- oder ausschalten; dieselbe
2528Prozedur kann auch benutzt werden, um Substitute für einen beliebigen
2529anderen Substitutsserver zu erlauben.
2530
2531@node Substitut-Server autorisieren
2532@subsection Substitut-Server autorisieren
2533
2534@cindex Sicherheit
2535@cindex Substitute, deren Autorisierung
2536@cindex Access Control List (ACL), für Substitute
2537@cindex ACL (Access Control List), für Substitute
2538Um es Guix zu gestatten, Substitute von @code{hydra.gnu.org} oder einem
2539Spiegelserver davon herunterzuladen, müssen Sie den zugehörigen öffentlichen
2540Schlüssel zur Access Control List (ACL, Zugriffssteuerungsliste) für
2541Archivimporte hinzufügen, mit Hilfe des Befehls @command{guix archive}
2542(@pxref{Aufruf von guix archive}). Dies impliziert, dass Sie darauf vertrauen,
2543dass @code{hydra.gnu.org} nicht kompromittiert wurde und echte Substitute
2544liefert.
2545
2546Der öffentliche Schlüssel für @code{hydra.gnu.org} wird zusammen mit Guix
2547installiert, in das Verzeichnis
2548@code{@var{prefix}/share/guix/hydra.gnu.org.pub}, wobei @var{prefix} das
2549Installationspräfix von Guix ist. Wenn Sie Guix aus seinem Quellcode heraus
2550installieren, stellen Sie sicher, dass Sie die GPG-Signatur von
2551@file{guix-@value{VERSION}.tar.gz} prüfen, worin sich dieser öffentliche
2552Schlüssel befindet. Dann können Sie so etwas wie hier ausführen:
2553
2554@example
2555# guix archive --authorize < @var{prefix}/share/guix/hydra.gnu.org.pub
2556@end example
2557
2558@quotation Anmerkung
2559Genauso enthält die Datei @file{berlin.guixsd.org.pub} den öffentlichen
2560Schlüssel für die neue Build-Farm des Guix-Projekts, die unter
2561@indicateurl{https://berlin.guixsd.org} erreichbar ist.
2562
2563Derzeit, als dieser Text geschrieben wurde, wird @code{berlin.guixsd.org}
2564ausgebaut, um besser skalieren zu können, aber Sie könnten es
2565ausprobieren. Dahinter stecken 20 x86_64-/i686-Erstellungsknoten, die
2566Substitute früher anbieten könnten als @code{mirror.hydra.gnu.org}.
2567@end quotation
2568
2569Sobald es eingerichtet wurde, sollte sich die Ausgabe eines Befehls wie
2570@code{guix build} von so etwas:
2571
2572@example
2573$ guix build emacs --dry-run
793dcd8c 2574Folgende Ableitungen würden erstellt:
1e40e70b
JL
2575 /gnu/store/yr7bnx8xwcayd6j95r2clmkdl1qh688w-emacs-24.3.drv
2576 /gnu/store/x8qsh1hlhgjx6cwsjyvybnfv2i37z23w-dbus-1.6.4.tar.gz.drv
2577 /gnu/store/1ixwp12fl950d15h2cj11c73733jay0z-alsa-lib-1.0.27.1.tar.bz2.drv
2578 /gnu/store/nlma1pw0p603fpfiqy7kn4zm105r5dmw-util-linux-2.21.drv
2579@dots{}
2580@end example
2581
2582@noindent
2583in so etwas verwandeln:
2584
2585@example
2586$ guix build emacs --dry-run
793dcd8c 2587112.3 MB würden heruntergeladen:
1e40e70b
JL
2588 /gnu/store/pk3n22lbq6ydamyymqkkz7i69wiwjiwi-emacs-24.3
2589 /gnu/store/2ygn4ncnhrpr61rssa6z0d9x22si0va3-libjpeg-8d
2590 /gnu/store/71yz6lgx4dazma9dwn2mcjxaah9w77jq-cairo-1.12.16
2591 /gnu/store/7zdhgp0n1518lvfn8mb96sxqfmvqrl7v-libxrender-0.9.7
2592@dots{}
2593@end example
2594
2595@noindent
2596Das zeigt an, dass Substitute von @code{hydra.gnu.org} nutzbar sind und für
793dcd8c 2597zukünftige Erstellungen heruntergeladen werden, wann immer es möglich ist.
1e40e70b
JL
2598
2599@cindex Substitute, wie man sie ausschaltet
2600Der Substitutsmechanismus kann global ausgeschaltet werden, indem Sie dem
2601@code{guix-daemon} beim Starten die Befehlszeilenoption
2602@code{--no-substitutes} übergeben (@pxref{Aufruf des guix-daemon}). Er kann
2603auch temporär ausgeschaltet werden, indem Sie @code{--no-substitutes} an
2604@command{guix package}, @command{guix build} und andere
2605Befehlszeilenwerkzeuge übergeben.
2606
2607@node Substitutauthentifizierung
2608@subsection Substitutauthentifizierung
2609
2610@cindex digitale Signaturen
2611Guix erkennt, wenn ein verfälschtes Substitut benutzt würde, und meldet
2612einen Fehler. Ebenso werden Substitute ignoriert, die nich signiert sind,
2613oder nicht mit einem in der ACL aufgelisteten Schlüssel signiert sind.
2614
2615Es gibt nur eine Ausnahme: Wenn ein unautorisierter Server Substitute
793dcd8c
LC
2616anbietet, die @emph{Bit für Bit identisch} mit denen von einem autorisierten
2617Server sind, können sie auch vom unautorisierten Server heruntergeladen
2618werden. Zum Beispiel, angenommen wir haben zwei Substitutserver mit dieser
2619Befehlszeilenoption ausgewählt:
1e40e70b
JL
2620
2621@example
2622--substitute-urls="https://a.example.org https://b.example.org"
2623@end example
2624
2625@noindent
2626@cindex Reproduzierbare Erstellungen
2627Wenn in der ACL nur der Schlüssel für @code{b.example.org} aufgeführt wurde,
2628aber @code{a.example.org} @emph{exakt dieselben} Substitute anbietet, wird
2629Guix auch Substitute von @code{a.example.org} herunterladen, weil es in der
2630Liste zuerst kommt und als Spiegelserver für @code{b.example.org} aufgefasst
2631werden kann. In der Praxis haben unabhängige Maschinen bei der Erstellung
2632normalerweise dieselben Binärdateien als Ergebnis, dank bit-reproduzierbarer
2633Erstellungen (siehe unten).
2634
2635Wenn Sie HTTPS benutzen, wird das X.509-Zertifikat des Servers @emph{nicht}
2636validiert (mit anderen Worten, die Identität des Servers wird nicht
2637authentifiziert), entgegen dem, was HTTPS-Clients wie Web-Browser
2638normalerweise tun. Da Guix Substitutinformationen selbst überprüft, wie oben
2639erklärt, wäre es unnötig (wohingegen mit X.509-Zertifikaten geprüft wird, ob
2640ein Domain-Name zu öffentlichen Schlüsseln passt).
2641
2642@node Proxy-Einstellungen
2643@subsection Proxy-Einstellungen
2644
2645@vindex http_proxy
2646Substitute werden über HTTP oder HTTPS heruntergeladen. Die
2647Umgebungsvariable @code{http_proxy} kann in der Umgebung von
2648@command{guix-daemon} definiert werden und wirkt sich dann auf das
2649Herunterladen von Substituten aus. Beachten Sie, dass der Wert von
2650@code{http_proxy} in der Umgebung, in der @command{guix build},
2651@command{guix package} und andere Client-Befehle ausgeführt werden,
2652@emph{keine Rolle spielt}.
2653
2654@node Fehler bei der Substitution
2655@subsection Fehler bei der Substitution
2656
2657Selbst wenn ein Substitut für eine Ableitung verfügbar ist, schlägt die
2658versuchte Substitution manchmal fehl. Das kann aus vielen Gründen geschehen:
2659die Substitutsserver könnten offline sein, das Substitut könnte kürzlich
2660gelöscht worden sein, die Netzwerkverbindunge könnte unterbrochen worden
2661sein, usw.
2662
2663Wenn Substitute aktiviert sind und ein Substitut für eine Ableitung zwar
2664verfügbar ist, aber die versuchte Substitution fehlschlägt, kann Guix
2665versuchen, die Ableitung lokal zu erstellen, je nachdem, ob
2666@code{--fallback} übergeben wurde (@pxref{fallback-option,, common build
2667option @code{--fallback}}). Genauer gesagt, wird keine lokale Erstellung
2668durchgeführt, solange kein @code{--fallback} angegeben wurde, und die
2669Ableitung wird als Fehlschlag angesehen. Wenn @code{--fallback} übergeben
2670wurde, wird Guix versuchen, die Ableitung lokal zu erstellen, und ob die
2671Ableitung erfolgreich ist oder nicht, hängt davon ab, ob die lokale
2672Erstellung erfolgreich ist oder nicht. Beachten Sie, dass, falls Substitute
2673ausgeschaltet oder erst gar kein Substitut verfügbar ist, @emph{immer} eine
2674lokale Erstellung durchgeführt wird, egal ob @code{--fallback} übergeben
2675wurde oder nicht.
2676
2677Um eine Vorstellung zu bekommen, wieviele Substitute gerade verfügbar sind,
2678können Sie den Befehl @command{guix weather} benutzen (@pxref{Aufruf von guix weather}). Dieser Befehl zeigt Statistiken darüber an, wie es um die von
2679einem Server verfügbaren Substitute steht.
2680
2681@node Vom Vertrauen gegenüber Binärdateien
2682@subsection Vom Vertrauen gegenüber Binärdateien
2683
2684@cindex Vertrauen, gegenüber vorerstellten Binärdateien
2685Derzeit hängt die Kontrolle jedes Individuums über seine Rechner von
793dcd8c
LC
2686Institutionen, Unternehmen und solchen Gruppierungen ab, die über genug
2687Macht und Entschlusskraft verfügen, die Rechnerinfrastruktur zu sabotieren
2688und ihre Schwachstellen auszunutzen. Auch wenn es bequem ist, Substitute von
1e40e70b
JL
2689@code{hydra.gnu.org} zu benutzen, ermuntern wir Nutzer, auch selbst
2690Erstellungen durchzuführen oder gar ihre eigene Build-Farm zu betreiben,
2691damit @code{hydra.gnu.org} ein weniger interessantes Ziel wird. Eine Art,
2692uns zu helfen, ist, die von Ihnen erstellte Software mit dem Befehl
2693@command{guix publish} zu veröffentlichen, damit andere eine größere Auswahl
2694haben, von welchem Server sie Substitute beziehen möchten (@pxref{Aufruf von guix publish}).
2695
2696Guix hat die richtigen Grundlagen, um die Reproduzierbarkeit von
2697Erstellungen zu maximieren (@pxref{Funktionalitäten}). In den meisten Fällen sollten
2698unabhängige Erstellungen eines bestimmten Pakets zu bitweise identischen
2699Ergebnissen führen. Wir können also mit Hilfe einer vielschichtigen Menge an
2700unabhängigen Paketerstellungen die Integrität unseres Systems besser
2701gewährleisten. Der Befehl @command{guix challenge} hat das Ziel, Nutzern zu
793dcd8c
LC
2702ermöglichen, Substitutserver zu beurteilen, und Entwickler dabei zu
2703unterstützen, nichtdeterministische Paketerstellungen zu finden
2704(@pxref{Aufruf von guix challenge}). Ebenso ermöglicht es die
2705Befehlszeilenoption @option{--check} von @command{guix build}, dass Nutzer
2706bereits installierte Substitute auf Echtheit zu prüfen, indem sie lokal
2707nachgebaut werden (@pxref{build-check, @command{guix build --check}}).
2708
2709In Zukunft wollen wir, dass Guix Binärdateien an und von Nutzern
2710peer-to-peer veröffentlichen kann. Wenn Sie mit uns dieses Projekt
1e40e70b
JL
2711diskuttieren möchten, kommen Sie auf unsere Mailing-Liste
2712@email{guix-devel@@gnu.org}.
2713
2714@node Pakete mit mehreren Ausgaben.
2715@section Pakete mit mehreren Ausgaben.
2716
2717@cindex mehrere Ausgaben, bei Paketen
2718@cindex Paketausgaben
2719@cindex Ausgaben
2720
2721Oft haben in Guix definierte Pakete eine einzige @dfn{Ausgabe} — d.h. aus
2722dem Quellpaket entsteht genau ein Verzeichnis im Store. Wenn Sie
2723@command{guix package -i glibc} ausführen, wird die Standard-Paketausgabe
2724des GNU-libc-Pakets installiert; die Standardausgabe wird @code{out}
2725genannt, aber ihr Name kann weggelassen werden, wie sie an obigem Befehl
2726sehen. In diesem speziellen Fall enthält die Standard-Paketausgabe von
2727@code{glibc} alle C-Headerdateien, gemeinsamen Bibliotheken (»Shared
2728Libraries«), statische Bibliotheken (»Static Libraries«), Dokumentation für
2729Info sowie andere zusätzliche Dateien.
2730
2731Manchmal ist es besser, die verschiedenen Arten von Dateien, die aus einem
2732einzelnen Quellpaket hervorgehen, in getrennte Ausgaben zu unterteilen. Zum
2733Beispiel installiert die GLib-C-Bibliothek (die von GTK+ und damit
2734zusammenhängenden Paketen benutzt wird) mehr als 20 MiB an HTML-Seiten mit
2735Referenzdokumentation. Um den Nutzern, die das nicht brauchen, Platz zu
2736sparen, wird die Dokumentation in einer separaten Ausgabe abgelegt, genannt
2737@code{doc}. Um also die Hauptausgabe von GLib zu installieren, zu der alles
2738außer der Dokumentation gehört, ist der Befehl:
2739
2740@example
2741guix package -i glib
2742@end example
2743
2744@cindex Dokumentation
2745Der Befehl, um die Dokumentation zu installieren, ist:
2746
2747@example
2748guix package -i glib:doc
2749@end example
2750
2751Manche Pakete installieren Programme mit unterschiedlich großem
2752»Abhängigkeiten-Fußabdruck«. Zum Beispiel installiert das Paket WordNet
2753sowohl Befehlszeilenwerkzeuge als auch grafische Benutzerschnittstellen
2754(GUIs). Erstere hängen nur von der C-Bibliothek ab, während Letztere auch
2755von Tcl/Tk und den zu Grunde liegenden X-Bibliotheken abhängen. Jedenfalls
2756belassen wir deshalb die Befehlszeilenwerkzeuge in der
2757Standard-Paketausgabe, während sich die GUIs in einer separaten Ausgabe
2758befinden. So können Benutzer, die die GUIs nicht brauchen, Platz sparen. Der
2759Befehl @command{guix size} kann dabei helfen, solche Situationen zu erkennen
2760(@pxref{Aufruf von guix size}). @command{guix graph} kann auch helfen
2761(@pxref{Aufruf von guix graph}).
2762
2763In der GNU-Distribution gibt es viele solche Pakete mit mehreren
2764Ausgaben. Andere Konventionen für Ausgabenamen sind zum Beispiel @code{lib}
2765für Bibliotheken und eventuell auch ihre Header-Dateien,, @code{bin} für
2766eigenständige Programme und @code{debug} für Informationen zur
2767Fehlerbehandlung (@pxref{Dateien zur Fehlersuche installieren}). Die Ausgaben eines
2768Pakets stehen in der dritten Spalte der Anzeige von @command{guix package
2769--list-available} (@pxref{Aufruf von guix package}).
2770
2771
2772@node Aufruf von guix gc
2773@section @command{guix gc} aufrufen
2774
2775@cindex Müllsammler
2776@cindex Plattenspeicher
2777Pakete, die zwar installiert sind, aber nicht benutzt werden, können vom
2778@dfn{Müllsammler} entfernt werden. Mit dem Befehl @command{guix gc} können
2779Benutzer den Müllsammler ausdrücklich aufrufen, um Speicher im Verzeichnis
2780@file{/gnu/store} freizugeben. Dies ist der @emph{einzige} Weg, Dateien aus
2781@file{/gnu/store} zu entfernen — das manuelle Entfernen von Dateien kann den
2782Store irreparabel beschädigen!
2783
2784@cindex GC-Wurzeln
2785@cindex Müllsammlerwurzeln
2786Der Müllsammler kennt eine Reihe von @dfn{Wurzeln}: Jede Datei in
2787@file{/gnu/store}, die von einer Wurzel aus erreichbar ist, gilt als
2788@dfn{lebendig} und kann nicht entfernt werden; jede andere Datei gilt als
793dcd8c 2789@dfn{tot} und ist ein Kandidat, gelöscht zu werden. Die Menge der
1e40e70b
JL
2790Müllsammlerwurzeln (kurz auch »GC-Wurzeln«, von englisch »Garbage
2791Collector«) umfasst Standard-Benutzerprofile; standardmäßig werden diese
2792Müllsammlerwurzeln durch symbolische Verknüpfungen in
2793@file{/var/guix/gcroots} dargestellt. Neue Müllsammlerwurzeln können zum
2794Beispiel mit @command{guix build --root} festgelegt werden (@pxref{Aufruf von guix build}).
2795
2796Bevor Sie mit @code{guix gc --collect-garbage} Speicher freimachen, wollen
2797Sie vielleicht alte Generationen von Benutzerprofilen löschen, damit alte
2798Paketerstellungen von diesen Generationen entfernt werden können. Führen Sie
2799dazu @code{guix package --delete-generations} aus (@pxref{Aufruf von guix package}).
2800
2801Unsere Empfehlung ist, dass Sie den Müllsammler regelmäßig laufen lassen und
2802wenn Sie wenig freien Speicherplatz zur Verfügung haben. Um zum Beispiel
793dcd8c 2803sicherzustellen, dass Sie mindestens 5@tie{}GB auf Ihrer Platte zur
1e40e70b
JL
2804Verfügung haben, benutzen Sie einfach:
2805
2806@example
2807guix gc -F 5G
2808@end example
2809
2810Es ist völlig sicher, dafür eine nicht interaktive, regelmäßige
2811Auftragsausführung vorzugeben (@pxref{Geplante Auftragsausführung}, für eine
2812Erklärung, wie man das in GuixSD tun kann). @command{guix gc} ohne
2813Befehlszeilenargumente auszuführen, lässt so viel Müll wie möglich sammeln,
2814aber das ist oft nicht, was man will, denn so muss man unter Umständen
2815Software erneut erstellen oder erneut herunterladen, weil der Müllsammler
793dcd8c 2816sie als »tot« ansieht, sie aber zur Erstellung anderer Software wieder
1e40e70b
JL
2817gebraucht wird — das trifft zum Beispiel auf die Compiler-Toolchain zu.
2818
2819Der Befehl @command{guix gc} hat drei Arbeitsmodi: Er kann benutzt werden,
2820um als Müllsammler tote Dateien zu entfernen (das Standardverhalten), um
2821ganz bestimmte, angegebene Datein zu löschen (mit der Befehlszeilenoption
2822@code{--delete}), um Müllsammlerinformationen auszugeben oder
2823fortgeschrittenere Anfragen zu verarbeiten. Die
2824Müllsammler-Befehlszeilenoptionen sind wie folgt:
2825
2826@table @code
2827@item --collect-garbage[=@var{Minimum}]
2828@itemx -C [@var{Minimum}]
2829Lässt Müll sammeln — z.B. nicht erreichbare Dateien in @file{/gnu/store} und
2830seinen Unterverzeichnissen. Wird keine andere Befehlszeilenoption angegeben,
2831wird standardmäßig diese durchgeführt.
2832
2833Wenn ein @var{Minimum} angegeben wurde, hört der Müllsammler auf, sobald
2834@var{Minimum} Bytes gesammelt wurden. Das @var{Minimum} kann die Anzahl der
2835Bytes bezeichnen oder mit einer Einheit als Suffix versehen sein, wie etwa
2836@code{MiB} für Mebibytes und @code{GB} für Gigabytes (@pxref{Block size,
2837size specifications,, coreutils, GNU Coreutils}).
2838
2839Wird kein @var{Minimum} angegeben, sammelt der Müllsammler allen Müll.
2840
2841@item --free-space=@var{Menge}
2842@itemx -F @var{Menge}
2843Sammelt Müll, bis die angegebene @var{Menge} an freiem Speicher in
2844@file{/gnu/store} zur Verfügung steht, falls möglich; die @var{Menge} ist
2845eine Speichergröße wie @code{500MiB}, wie oben beschrieben.
2846
2847Wenn die angegebene @var{Menge} oder mehr bereits in @file{/gnu/store} frei
2848verfügbar ist, passiert nichts.
2849
2850@item --delete
2851@itemx -d
2852Versucht, alle als Argumente angegebenen Dateien oder Verzeichnisse im Store
2853zu löschen. Dies schlägt fehl, wenn manche der Dateien oder Verzeichnisse
2854nicht im Store oder noch immer lebendig sind.
2855
2856@item --list-failures
2857Store-Objekte auflisten, die zwischengespeicherten Erstellungsfehlern
2858entsprechen.
2859
2860Hierbei wird nichts ausgegeben, sofern der Daemon nicht mit
2861@option{--cache-failures} gestartet wurde (@pxref{Aufruf des guix-daemon,
2862@option{--cache-failures}}).
2863
2864@item --clear-failures
2865Die angegebenen Store-Objekte aus dem Zwischenspeicher für fehlgeschlagene
2866Erstellungen entfernen.
2867
2868Auch diese Option macht nur Sinn, wenn der Daemon mit
2869@option{--cache-failures} gestartet wurde. Andernfalls passiert nichts.
2870
2871@item --list-dead
2872Zeigt die Liste toter Dateien und Verzeichnisse an, die sich noch im Store
2873befinden — das heißt, Dateien, die von keiner Wurzel mehr erreichbar sind.
2874
2875@item --list-live
2876Zeige die Liste lebendiger Store-Dateien und -Verzeichnisse.
2877
2878@end table
2879
2880Außerdem können Referenzen unter bestehenden Store-Dateien gefunden werden:
2881
2882@table @code
2883
2884@item --references
2885@itemx --referrers
2886@cindex Paketabhängigkeiten
2887Listet die referenzierten bzw. sie referenzierenden Objekte der angegebenen
2888Store-Dateien auf.
2889
2890@item --requisites
2891@itemx -R
2892@cindex Abschluss
2893Listet alle Voraussetzungen der als Argumente übergebenen Store-Dateien
2894auf. Voraussetzungen sind die Store-Dateien selbst, ihre Referenzen sowie
2895die Referenzen davon, rekursiv. Mit anderen Worten, die zurückgelieferte
2896Liste ist der @dfn{transitive Abschluss} dieser Store-Dateien.
2897
2898Der Abschnitt @xref{Aufruf von guix size} erklärt ein Werkzeug, um den
2899Speicherbedarf des Abschlusses eines Elements zu ermitteln. Siehe
793dcd8c 2900@xref{Aufruf von guix graph} für ein Werkzeug, um den Referenzgraphen zu
1e40e70b
JL
2901veranschaulichen.
2902
2903@item --derivers
2904@cindex Ableitung
2905Liefert die Ableitung(en), die zu den angegebenen Store-Objekten führen
2906(@pxref{Ableitungen}).
2907
2908Zum Beispiel liefert dieser Befehl:
2909
2910@example
2911guix gc --derivers `guix package -I ^emacs$ | cut -f4`
2912@end example
2913
2914@noindent
2915die @file{.drv}-Datei(en), die zum in Ihrem Profil installierten
2916@code{emacs}-Paket führen.
2917
2918Beachten Sie, dass es auch sein kann, dass keine passenden
2919@file{.drv}-Dateien existieren, zum Beispiel wenn diese Dateien bereits dem
2920Müllsammler zum Opfer gefallen sind. Es kann auch passieren, dass es mehr
2921als eine passende @file{.drv} gibt, bei Ableitungen mit fester Ausgabe.
2922@end table
2923
2924Zuletzt können Sie mit folgenden Befehlszeilenoptionen die Integrität des
2925Stores prüfen und den Plattenspeicherverbrauch im Zaum halten.
2926
2927@table @option
2928
2929@item --verify[=@var{Optionen}]
2930@cindex Integrität, des Stores
2931@cindex Integritätsprüfung
2932Die Integrität des Stores verifizieren
2933
2934Standardmäßig wird sichergestellt, dass alle Store-Objekte, die in der
2935Datenbank des Daemons als gültig markiert wurden, auch tatsächlich in
2936@file{/gnu/store} existieren.
2937
2938Wenn angegeben, müssen die @var{Optionen} eine kommagetrennte Liste aus
2939mindestens einem der Worte @code{contents} und @code{repair} sein.
2940
2941Wenn Sie @option{--verify=contents} übergeben, berechnet der Daemon den Hash
2942des Inhalts jedes Store-Objekts und vergleicht ihn mit dem Hash in der
2943Datenbank. Sind die Hashes ungleich, wird eine Datenbeschädigung
2944gemeldet. Weil dabei @emph{alle Dateien im Store} durchlaufen werden, kann
2945der Befehl viel Zeit brauchen, besonders auf Systemen mit langsamer Platte.
2946
2947@cindex Store, reparieren
2948@cindex Datenbeschädigung, Behebung
2949Mit @option{--verify=repair} oder @option{--verify=contents,repair} versucht
2950der Daemon, beschädigte Store-Objekte zu reparieren, indem er Substitute für
2951selbige herunterlädt (@pxref{Substitute}). Weil die Reparatur nicht atomar
2952und daher womöglich riskant ist, kann nur der Systemadministrator den Befehl
2953benutzen. Eine weniger aufwendige Alternative, wenn Sie wissen, welches
2954Objekt beschädigt ist, ist, @command{guix build --repair} zu benutzen
2955(@pxref{Aufruf von guix build}).
2956
2957@item --optimize
2958@cindex Deduplizieren
2959Den Store durch Nutzung harter Verknüpfungen für identische Dateien
2960optimieren — mit anderen Worten wird der Store @dfn{dedupliziert}.
2961
2962Der Daemon führt Deduplizierung automatisch nach jeder erfolgreichen
2963Erstellung und jedem Importieren eines Archivs durch, sofern er nicht mit
2964@code{--disable-deduplication} (@pxref{Aufruf des guix-daemon,
2965@code{--disable-deduplication}}) gestartet wurde. Diese Befehlszeilenoption
2966brauchen Sie also in erster Linie dann, wenn der Daemon zuvor mit
2967@code{--disable-deduplication} gestartet worden ist.
2968
2969@end table
2970
2971@node Aufruf von guix pull
2972@section @command{guix pull} aufrufen
2973
2974@cindex Aktualisieren von Guix
2975@cindex Updaten von Guix
2976@cindex @command{guix pull}
2977@cindex pull
2978Packages are installed or upgraded to the latest version available in the
2979distribution currently available on your local machine. To update that
2980distribution, along with the Guix tools, you must run @command{guix pull}:
2981the command downloads the latest Guix source code and package descriptions,
2982and deploys it. Source code is downloaded from a @uref{https://git-scm.com,
2983Git} repository, by default the official GNU@tie{}Guix repository, though
2984this can be customized.
2985
2986Danach wird @command{guix package} Pakete und ihre Versionen entsprechend
2987der gerade heruntergeladenen Kopie von Guix benutzen. Nicht nur das, auch
2988alle Guix-Befehle und Scheme-Module werden aus der neuesten Version von Guix
2989kommen. Neue @command{guix}-Unterbefehle, die durch die Aktualisierung
2990hinzugekommen sind, werden also auch verfügbar.
2991
793dcd8c
LC
2992Any user can update their Guix copy using @command{guix pull}, and the
2993effect is limited to the user who run @command{guix pull}. For instance,
2994when user @code{root} runs @command{guix pull}, this has no effect on the
2995version of Guix that user @code{alice} sees, and vice versa.
1e40e70b 2996
793dcd8c
LC
2997The result of running @command{guix pull} is a @dfn{profile} available under
2998@file{~/.config/guix/current} containing the latest Guix. Thus, make sure
2999to add it to the beginning of your search path so that you use the latest
3000version, and similarly for the Info manual (@pxref{Dokumentation}):
1e40e70b
JL
3001
3002@example
3003export PATH="$HOME/.config/guix/current/bin:$PATH"
3004export INFOPATH="$HOME/.config/guix/current/share/info:$INFOPATH"
3005@end example
3006
793dcd8c
LC
3007The @code{--list-generations} or @code{-l} option lists past generations
3008produced by @command{guix pull}, along with details about their provenance:
1e40e70b
JL
3009
3010@example
3011$ guix pull -l
3012Generation 1 Jun 10 2018 00:18:18
3013 guix 65956ad
3014 repository URL: https://git.savannah.gnu.org/git/guix.git
3015 branch: origin/master
3016 commit: 65956ad3526ba09e1f7a40722c96c6ef7c0936fe
3017
3018Generation 2 Jun 11 2018 11:02:49
3019 guix e0cc7f6
3020 repository URL: https://git.savannah.gnu.org/git/guix.git
3021 branch: origin/master
3022 commit: e0cc7f669bec22c37481dd03a7941c7d11a64f1d
3023 2 new packages: keepalived, libnfnetlink
3024 6 packages upgraded: emacs-nix-mode@@2.0.4,
3025 guile2.0-guix@@0.14.0-12.77a1aac, guix@@0.14.0-12.77a1aac,
3026 heimdal@@7.5.0, milkytracker@@1.02.00, nix@@2.0.4
3027
3028Generation 3 Jun 13 2018 23:31:07 (current)
3029 guix 844cc1c
3030 repository URL: https://git.savannah.gnu.org/git/guix.git
3031 branch: origin/master
3032 commit: 844cc1c8f394f03b404c5bb3aee086922373490c
3033 28 new packages: emacs-helm-ls-git, emacs-helm-mu, @dots{}
3034 69 packages upgraded: borg@@1.1.6, cheese@@3.28.0, @dots{}
3035@end example
3036
3037@ref{Invoking guix describe, @command{guix describe}}, for other ways to
3038describe the current status of Guix.
3039
793dcd8c
LC
3040This @code{~/.config/guix/current} profile works like any other profile
3041created by @command{guix package} (@pxref{Aufruf von guix package}). That is,
3042you can list generations, roll back to the previous generation---i.e., the
3043previous Guix---and so on:
1e40e70b
JL
3044
3045@example
3046$ guix package -p ~/.config/guix/current --roll-back
3047switched from generation 3 to 2
3048$ guix package -p ~/.config/guix/current --delete-generations=1
3049deleting /var/guix/profiles/per-user/charlie/current-guix-1-link
3050@end example
3051
3052Der Befehl @command{guix pull} wird in der Regel ohne Befehlszeilenargumente
3053aufgerufen, aber er versteht auch folgende Befehlszeilenoptionen:
3054
3055@table @code
1e40e70b
JL
3056@item --url=@var{URL}
3057@itemx --commit=@var{Commit}
3058@itemx --branch=@var{Branch}
3059Download code from the specified @var{url}, at the given @var{commit} (a
3060valid Git commit ID represented as a hexadecimal string), or @var{branch}.
3061
3062@cindex @file{channels.scm}, configuration file
3063@cindex configuration file for channels
3064These options are provided for convenience, but you can also specify your
3065configuration in the @file{~/.config/guix/channels.scm} file or using the
3066@option{--channels} option (see below).
3067
3068@item --channels=@var{file}
3069@itemx -C @var{file}
3070Read the list of channels from @var{file} instead of
3071@file{~/.config/guix/channels.scm}. @var{file} must contain Scheme code
3072that evaluates to a list of channel objects. @xref{Channels}, for more
3073information.
3074
3075@item --list-generations[=@var{Muster}]
3076@itemx -l [@var{Muster}]
3077List all the generations of @file{~/.config/guix/current} or, if
3078@var{pattern} is provided, the subset of generations that match
3079@var{pattern}. The syntax of @var{pattern} is the same as with @code{guix
3080package --list-generations} (@pxref{Aufruf von guix package}).
3081
3082@ref{Invoking guix describe}, for a way to display information about the
3083current generation only.
3084
3085@item --profile=@var{Profil}
3086@itemx -p @var{Profil}
3087Use @var{profile} instead of @file{~/.config/guix/current}.
3088
793dcd8c
LC
3089@item --dry-run
3090@itemx -n
3091Show which channel commit(s) would be used and what would be built or
3092substituted but do not actually do it.
3093
3094@item --verbose
3095Ausführliche Informationen ausgeben und Erstellungsprotokolle auf der
3096Standardfehlerausgabe ausgeben.
3097
1e40e70b
JL
3098@item --bootstrap
3099Use the bootstrap Guile to build the latest Guix. This option is only
3100useful to Guix developers.
3101@end table
3102
3103The @dfn{channel} mechanism allows you to instruct @command{guix pull} which
3104repository and branch to pull from, as well as @emph{additional}
3105repositories containing package modules that should be deployed.
3106@xref{Channels}, for more information.
3107
3108In addition, @command{guix pull} supports all the common build options
3109(@pxref{Gemeinsame Erstellungsoptionen}).
3110
3111@node Channels
3112@section Channels
3113
3114@cindex channels
3115@cindex @file{channels.scm}, configuration file
3116@cindex configuration file for channels
3117@cindex @command{guix pull}, configuration file
3118@cindex configuration of @command{guix pull}
3119Guix and its package collection are updated by running @command{guix pull}
3120(@pxref{Aufruf von guix pull}). By default @command{guix pull} downloads and
3121deploys Guix itself from the official GNU@tie{}Guix repository. This can be
3122customized by defining @dfn{channels} in the
3123@file{~/.config/guix/channels.scm} file. A channel specifies a URL and
3124branch of a Git repository to be deployed, and @command{guix pull} can be
3125instructed to pull from one or more channels. In other words, channels can
3126be used to @emph{customize} and to @emph{extend} Guix, as we will see below.
3127
3128@subsection Using a Custom Guix Channel
3129
3130The channel called @code{guix} specifies where Guix itself---its
3131command-line tools as well as its package collection---should be
3132downloaded. For instance, suppose you want to update from your own copy of
3133the Guix repository at @code{example.org}, and specifically the
3134@code{super-hacks} branch, you can write in
3135@code{~/.config/guix/channels.scm} this specification:
3136
3137@lisp
3138;; Tell 'guix pull' to use my own repo.
3139(list (channel
3140 (name 'guix)
3141 (url "https://example.org/my-guix.git")
3142 (branch "super-hacks")))
3143@end lisp
3144
3145@noindent
3146From there on, @command{guix pull} will fetch code from the
3147@code{super-hacks} branch of the repository at @code{example.org}.
3148
3149@subsection Specifying Additional Channels
3150
3151@cindex extending the package collection (channels)
3152@cindex personal packages (channels)
3153@cindex channels, for personal packages
3154You can also specify @emph{additional channels} to pull from. Let's say you
3155have a bunch of custom package variants or personal packages that you think
3156would make little sense to contribute to the Guix project, but would like to
3157have these packages transparently available to you at the command line. You
3158would first write modules containing those package definitions
3159(@pxref{Paketmodule}), maintain them in a Git repository, and then you
3160and anyone else can use it as an additional channel to get packages from.
3161Neat, no?
3162
3163@c What follows stems from discussions at
3164@c <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22629#134> as well as
3165@c earlier discussions on guix-devel@gnu.org.
3166@quotation Warning
3167Before you, dear user, shout---``woow this is @emph{soooo coool}!''---and
3168publish your personal channel to the world, we would like to share a few
3169words of caution:
3170
3171@itemize
3172@item
3173Before publishing a channel, please consider contributing your package
3174definitions to Guix proper (@pxref{Mitwirken}). Guix as a project is
3175open to free software of all sorts, and packages in Guix proper are readily
3176available to all Guix users and benefit from the project's quality assurance
3177process.
3178
3179@item
3180When you maintain package definitions outside Guix, we, Guix developers,
3181consider that @emph{the compatibility burden is on you}. Remember that
3182package modules and package definitions are just Scheme code that uses
3183various programming interfaces (APIs). We want to remain free to change
3184these APIs to keep improving Guix, possibly in ways that break your
3185channel. We never change APIs gratuitously, but we will @emph{not} commit
3186to freezing APIs either.
3187
3188@item
3189Corollary: if you're using an external channel and that channel breaks,
3190please @emph{report the issue to the channel authors}, not to the Guix
3191project.
3192@end itemize
3193
3194You've been warned! Having said this, we believe external channels are a
3195practical way to exert your freedom to augment Guix' package collection and
3196to share your improvements, which are basic tenets of
3197@uref{https://www.gnu.org/philosophy/free-sw.html, free software}. Please
3198email us at @email{guix-devel@@gnu.org} if you'd like to discuss this.
3199@end quotation
3200
3201Once you have a Git repository containing your own package modules, you can
3202write @code{~/.config/guix/channels.scm} to instruct @command{guix pull} to
3203pull from your personal channel @emph{in addition} to the default Guix
3204channel(s):
3205
3206@vindex %default-channels
3207@lisp
3208;; Add my personal packages to those Guix provides.
3209(cons (channel
3210 (name 'my-personal-packages)
3211 (url "https://example.org/personal-packages.git"))
3212 %default-channels)
3213@end lisp
3214
3215@noindent
793dcd8c
LC
3216Note that the snippet above is (as always!)@: Scheme code; we use
3217@code{cons} to add a channel the list of channels that the variable
1e40e70b
JL
3218@code{%default-channels} is bound to (@pxref{Pairs, @code{cons} and lists,,
3219guile, GNU Guile Reference Manual}). With this file in place, @command{guix
3220pull} builds not only Guix but also the package modules from your own
3221repository. The result in @file{~/.config/guix/current} is the union of
3222Guix with your own package modules:
3223
3224@example
3225$ guix pull --list-generations
3226@dots{}
3227Generation 19 Aug 27 2018 16:20:48
3228 guix d894ab8
3229 repository URL: https://git.savannah.gnu.org/git/guix.git
3230 branch: master
3231 commit: d894ab8e9bfabcefa6c49d9ba2e834dd5a73a300
3232 my-personal-packages dd3df5e
3233 repository URL: https://example.org/personal-packages.git
3234 branch: master
3235 commit: dd3df5e2c8818760a8fc0bd699e55d3b69fef2bb
3236 11 new packages: my-gimp, my-emacs-with-cool-features, @dots{}
3237 4 packages upgraded: emacs-racket-mode@@0.0.2-2.1b78827, @dots{}
3238@end example
3239
3240@noindent
3241The output of @command{guix pull} above shows that Generation@tie{}19
3242includes both Guix and packages from the @code{my-personal-packages}
3243channel. Among the new and upgraded packages that are listed, some like
3244@code{my-gimp} and @code{my-emacs-with-cool-features} might come from
3245@code{my-personal-packages}, while others come from the Guix default
3246channel.
3247
3248@subsection Replicating Guix
3249
3250@cindex pinning, channels
3251@cindex replicating Guix
3252@cindex reproducibility, of Guix
3253The @command{guix pull --list-generations} output above shows precisely
3254which commits were used to build this instance of Guix. We can thus
3255replicate it, say, on another machine, by providing a channel specification
3256in @file{~/.config/guix/channels.scm} that is ``pinned'' to these commits:
3257
3258@lisp
3259;; Deploy specific commits of my channels of interest.
3260(list (channel
3261 (name 'guix)
3262 (url "https://git.savannah.gnu.org/git/guix.git")
3263 (commit "d894ab8e9bfabcefa6c49d9ba2e834dd5a73a300"))
3264 (channel
3265 (name 'my-personal-packages)
3266 (url "https://example.org/personal-packages.git")
3267 (branch "dd3df5e2c8818760a8fc0bd699e55d3b69fef2bb")))
3268@end lisp
3269
3270The @command{guix describe --format=channels} command can even generate this
3271list of channels directly (@pxref{Invoking guix describe}).
3272
3273At this point the two machines run the @emph{exact same Guix}, with access
3274to the @emph{exact same packages}. The output of @command{guix build gimp}
3275on one machine will be exactly the same, bit for bit, as the output of the
3276same command on the other machine. It also means both machines have access
3277to all the source code of Guix and, transitively, to all the source code of
3278every package it defines.
3279
3280This gives you super powers, allowing you to track the provenance of binary
3281artifacts with very fine grain, and to reproduce software environments at
3282will---some sort of ``meta reproducibility'' capabilities, if you will.
3283@xref{Inferiors}, for another way to take advantage of these super powers.
3284
3285@node Inferiors
3286@section Inferiors
3287
3288@c TODO: Remove this once we're more confident about API stability.
3289@quotation Anmerkung
3290The functionality described here is a ``technology preview'' as of version
3291@value{VERSION}. As such, the interface is subject to change.
3292@end quotation
3293
3294@cindex inferiors
3295@cindex composition of Guix revisions
3296Sometimes you might need to mix packages from the revision of Guix you're
3297currently running with packages available in a different revision of Guix.
3298Guix @dfn{inferiors} allow you to achieve that by composing different Guix
3299revisions in arbitrary ways.
3300
3301@cindex inferior packages
3302Technically, an ``inferior'' is essentially a separate Guix process
3303connected to your main Guix process through a REPL (@pxref{Invoking guix
3304repl}). The @code{(guix inferior)} module allows you to create inferiors
3305and to communicate with them. It also provides a high-level interface to
3306browse and manipulate the packages that an inferior provides---@dfn{inferior
3307packages}.
3308
3309When combined with channels (@pxref{Channels}), inferiors provide a simple
3310way to interact with a separate revision of Guix. For example, let's assume
3311you want to install in your profile the current @code{guile} package, along
3312with the @code{guile-json} as it existed in an older revision of
3313Guix---perhaps because the newer @code{guile-json} has an incompatible API
3314and you want to run your code against the old API@. To do that, you could
3315write a manifest for use by @code{guix package --manifest} (@pxref{Aufruf von guix package}); in that manifest, you would create an inferior for that old
3316Guix revision you care about, and you would look up the @code{guile-json}
3317package in the inferior:
3318
3319@lisp
3320(use-modules (guix inferior) (guix channels)
3321 (srfi srfi-1)) ;for 'first'
3322
3323(define channels
3324 ;; This is the old revision from which we want to
3325 ;; extract guile-json.
3326 (list (channel
3327 (name 'guix)
3328 (url "https://git.savannah.gnu.org/git/guix.git")
3329 (commit
3330 "65956ad3526ba09e1f7a40722c96c6ef7c0936fe"))))
3331
3332(define inferior
3333 ;; An inferior representing the above revision.
3334 (inferior-for-channels channels))
3335
3336;; Now create a manifest with the current "guile" package
3337;; and the old "guile-json" package.
3338(packages->manifest
3339 (list (first (lookup-inferior-packages inferior "guile-json"))
3340 (specification->package "guile")))
3341@end lisp
3342
3343On its first run, @command{guix package --manifest} might have to build the
3344channel you specified before it can create the inferior; subsequent runs
3345will be much faster because the Guix revision will be cached.
3346
3347The @code{(guix inferior)} module provides the following procedures to open
3348an inferior:
3349
3350@deffn {Scheme Procedure} inferior-for-channels @var{channels} @
3351 [#:cache-directory] [#:ttl] Return an inferior for @var{channels}, a list of
3352channels. Use the cache at @var{cache-directory}, where entries can be
3353reclaimed after @var{ttl} seconds. This procedure opens a new connection to
3354the build daemon.
3355
3356As a side effect, this procedure may build or substitute binaries for
3357@var{channels}, which can take time.
3358@end deffn
3359
3360@deffn {Scheme Procedure} open-inferior @var{directory} @
3361 [#:command "bin/guix"] Open the inferior Guix in @var{directory}, running
3362@code{@var{directory}/@var{command} repl} or equivalent. Return @code{#f}
3363if the inferior could not be launched.
3364@end deffn
3365
3366@cindex inferior packages
3367The procedures listed below allow you to obtain and manipulate inferior
3368packages.
3369
3370@deffn {Scheme Procedure} inferior-packages @var{inferior}
3371Return the list of packages known to @var{inferior}.
3372@end deffn
3373
3374@deffn {Scheme Procedure} lookup-inferior-packages @var{inferior} @var{name} @
3375 [@var{version}] Return the sorted list of inferior packages matching
3376@var{name} in @var{inferior}, with highest version numbers first. If
3377@var{version} is true, return only packages with a version number prefixed
3378by @var{version}.
3379@end deffn
3380
3381@deffn {Scheme Procedure} inferior-package? @var{obj}
3382Return true if @var{obj} is an inferior package.
3383@end deffn
3384
3385@deffn {Scheme Procedure} inferior-package-name @var{package}
3386@deffnx {Scheme Procedure} inferior-package-version @var{package}
3387@deffnx {Scheme Procedure} inferior-package-synopsis @var{package}
3388@deffnx {Scheme Procedure} inferior-package-description @var{package}
3389@deffnx {Scheme Procedure} inferior-package-home-page @var{package}
3390@deffnx {Scheme Procedure} inferior-package-location @var{package}
3391@deffnx {Scheme Procedure} inferior-package-inputs @var{package}
3392@deffnx {Scheme Procedure} inferior-package-native-inputs @var{package}
3393@deffnx {Scheme Procedure} inferior-package-propagated-inputs @var{package}
3394@deffnx {Scheme Procedure} inferior-package-transitive-propagated-inputs @var{package}
3395@deffnx {Scheme Procedure} inferior-package-native-search-paths @var{package}
3396@deffnx {Scheme Procedure} inferior-package-transitive-native-search-paths @var{package}
3397@deffnx {Scheme Procedure} inferior-package-search-paths @var{package}
3398These procedures are the counterpart of package record accessors
3399(@pxref{„package“-Referenz}). Most of them work by querying the inferior
3400@var{package} comes from, so the inferior must still be live when you call
3401these procedures.
3402@end deffn
3403
3404Inferior packages can be used transparently like any other package or
3405file-like object in G-expressions (@pxref{G-Ausdrücke}). They are also
3406transparently handled by the @code{packages->manifest} procedure, which is
3407commonly use in manifests (@pxref{Aufruf von guix package, the
3408@option{--manifest} option of @command{guix package}}). Thus you can insert
3409an inferior package pretty much anywhere you would insert a regular package:
3410in manifests, in the @code{packages} field of your @code{operating-system}
3411declaration, and so on.
3412
3413@node Invoking guix describe
3414@section Invoking @command{guix describe}
3415
3416@cindex Reproduzierbarkeit
3417@cindex replicating Guix
3418Often you may want to answer questions like: ``Which revision of Guix am I
3419using?'' or ``Which channels am I using?'' This is useful information in
3420many situations: if you want to @emph{replicate} an environment on a
3421different machine or user account, if you want to report a bug or to
3422determine what change in the channels you are using caused it, or if you
3423want to record your system state for reproducibility purposes. The
3424@command{guix describe} command answers these questions.
3425
3426When run from a @command{guix pull}ed @command{guix}, @command{guix
3427describe} displays the channel(s) that it was built from, including their
3428repository URL and commit IDs (@pxref{Channels}):
3429
3430@example
3431$ guix describe
3432Generation 10 Sep 03 2018 17:32:44 (current)
3433 guix e0fa68c
3434 repository URL: https://git.savannah.gnu.org/git/guix.git
3435 branch: master
3436 commit: e0fa68c7718fffd33d81af415279d6ddb518f727
3437@end example
3438
3439If you're familiar with the Git version control system, this is similar in
3440spirit to @command{git describe}; the output is also similar to that of
3441@command{guix pull --list-generations}, but limited to the current
3442generation (@pxref{Aufruf von guix pull, the @option{--list-generations}
3443option}). Because the Git commit ID shown above unambiguously refers to a
3444snapshot of Guix, this information is all it takes to describe the revision
3445of Guix you're using, and also to replicate it.
3446
3447To make it easier to replicate Guix, @command{guix describe} can also be
3448asked to return a list of channels instead of the human-readable description
3449above:
3450
3451@example
3452$ guix describe -f channels
3453(list (channel
3454 (name 'guix)
3455 (url "https://git.savannah.gnu.org/git/guix.git")
3456 (commit
3457 "e0fa68c7718fffd33d81af415279d6ddb518f727")))
3458@end example
3459
3460@noindent
3461You can save this to a file and feed it to @command{guix pull -C} on some
3462other machine or at a later point in time, which will instantiate @emph{this
3463exact Guix revision} (@pxref{Aufruf von guix pull, the @option{-C} option}).
3464From there on, since you're able to deploy the same revision of Guix, you
3465can just as well @emph{replicate a complete software environment}. We
3466humbly think that this is @emph{awesome}, and we hope you'll like it too!
3467
3468The details of the options supported by @command{guix describe} are as
3469follows:
3470
3471@table @code
3472@item --format=@var{format}
3473@itemx -f @var{format}
3474Produce output in the specified @var{format}, one of:
3475
3476@table @code
3477@item human
3478produce human-readable output;
3479@item channels
3480produce a list of channel specifications that can be passed to @command{guix
793dcd8c
LC
3481pull -C} or installed as @file{~/.config/guix/channels.scm} (@pxref{Aufruf von guix pull});
3482@item json
3483@cindex JSON
3484produce a list of channel specifications in JSON format;
3485@item recutils
3486produce a list of channel specifications in Recutils format.
1e40e70b 3487@end table
793dcd8c
LC
3488
3489@item --profile=@var{Profil}
3490@itemx -p @var{Profil}
3491Display information about @var{profile}.
1e40e70b
JL
3492@end table
3493
3494@node Aufruf von guix pack
3495@section Invoking @command{guix pack}
3496
3497Occasionally you want to pass software to people who are not (yet!) lucky
3498enough to be using Guix. You'd tell them to run @command{guix package -i
3499@var{something}}, but that's not possible in this case. This is where
3500@command{guix pack} comes in.
3501
3502@quotation Anmerkung
3503If you are looking for ways to exchange binaries among machines that already
3504run Guix, @pxref{Aufruf von guix copy}, @ref{Aufruf von guix publish}, and
3505@ref{Aufruf von guix archive}.
3506@end quotation
3507
3508@cindex pack
3509@cindex bundle
3510@cindex application bundle
3511@cindex software bundle
3512The @command{guix pack} command creates a shrink-wrapped @dfn{pack} or
3513@dfn{software bundle}: it creates a tarball or some other archive containing
3514the binaries of the software you're interested in, and all its
3515dependencies. The resulting archive can be used on any machine that does
3516not have Guix, and people can run the exact same binaries as those you have
3517with Guix. The pack itself is created in a bit-reproducible fashion, so
3518anyone can verify that it really contains the build results that you pretend
3519to be shipping.
3520
3521For example, to create a bundle containing Guile, Emacs, Geiser, and all
3522their dependencies, you can run:
3523
3524@example
3525$ guix pack guile emacs geiser
3526@dots{}
3527/gnu/store/@dots{}-pack.tar.gz
3528@end example
3529
3530The result here is a tarball containing a @file{/gnu/store} directory with
3531all the relevant packages. The resulting tarball contains a @dfn{profile}
3532with the three packages of interest; the profile is the same as would be
3533created by @command{guix package -i}. It is this mechanism that is used to
3534create Guix's own standalone binary tarball (@pxref{Aus Binärdatei installieren}).
3535
3536Users of this pack would have to run
3537@file{/gnu/store/@dots{}-profile/bin/guile} to run Guile, which you may find
3538inconvenient. To work around it, you can create, say, a @file{/opt/gnu/bin}
3539symlink to the profile:
3540
3541@example
3542guix pack -S /opt/gnu/bin=bin guile emacs geiser
3543@end example
3544
3545@noindent
3546That way, users can happily type @file{/opt/gnu/bin/guile} and enjoy.
3547
3548@cindex relocatable binaries, with @command{guix pack}
3549What if the recipient of your pack does not have root privileges on their
3550machine, and thus cannot unpack it in the root file system? In that case,
3551you will want to use the @code{--relocatable} option (see below). This
3552option produces @dfn{relocatable binaries}, meaning they they can be placed
3553anywhere in the file system hierarchy: in the example above, users can
3554unpack your tarball in their home directory and directly run
3555@file{./opt/gnu/bin/guile}.
3556
3557@cindex Docker, build an image with guix pack
3558Alternatively, you can produce a pack in the Docker image format using the
3559following command:
3560
3561@example
3562guix pack -f docker guile emacs geiser
3563@end example
3564
3565@noindent
3566The result is a tarball that can be passed to the @command{docker load}
3567command. See the
3568@uref{https://docs.docker.com/engine/reference/commandline/load/, Docker
3569documentation} for more information.
3570
3571@cindex Singularity, build an image with guix pack
3572@cindex SquashFS, build an image with guix pack
3573Yet another option is to produce a SquashFS image with the following
3574command:
3575
3576@example
3577guix pack -f squashfs guile emacs geiser
3578@end example
3579
3580@noindent
3581The result is a SquashFS file system image that can either be mounted or
3582directly be used as a file system container image with the
3583@uref{http://singularity.lbl.gov, Singularity container execution
3584environment}, using commands like @command{singularity shell} or
3585@command{singularity exec}.
3586
3587Several command-line options allow you to customize your pack:
3588
3589@table @code
3590@item --format=@var{format}
3591@itemx -f @var{format}
3592Produce a pack in the given @var{format}.
3593
3594The available formats are:
3595
3596@table @code
3597@item tarball
3598This is the default format. It produces a tarball containing all the
3599specified binaries and symlinks.
3600
3601@item docker
3602This produces a tarball that follows the
3603@uref{https://github.com/docker/docker/blob/master/image/spec/v1.2.md,
3604Docker Image Specification}.
3605
3606@item squashfs
3607This produces a SquashFS image containing all the specified binaries and
3608symlinks, as well as empty mount points for virtual file systems like
3609procfs.
3610@end table
3611
3612@item --relocatable
3613@itemx -R
3614Produce @dfn{relocatable binaries}---i.e., binaries that can be placed
3615anywhere in the file system hierarchy and run from there. For example, if
3616you create a pack containing Bash with:
3617
3618@example
3619guix pack -R -S /mybin=bin bash
3620@end example
3621
3622@noindent
793dcd8c
LC
3623...@: you can copy that pack to a machine that lacks Guix, and from your
3624home directory as a normal user, run:
1e40e70b
JL
3625
3626@example
3627tar xf pack.tar.gz
3628./mybin/sh
3629@end example
3630
3631@noindent
3632In that shell, if you type @code{ls /gnu/store}, you'll notice that
3633@file{/gnu/store} shows up and contains all the dependencies of @code{bash},
3634even though the machine actually lacks @file{/gnu/store} altogether! That is
3635probably the simplest way to deploy Guix-built software on a non-Guix
3636machine.
3637
3638There's a gotcha though: this technique relies on the @dfn{user namespace}
3639feature of the kernel Linux, which allows unprivileged users to mount or
3640change root. Old versions of Linux did not support it, and some GNU/Linux
3641distributions turn it off; on these systems, programs from the pack
3642@emph{will fail to run}, unless they are unpacked in the root file system.
3643
3644@item --expression=@var{expr}
3645@itemx -e @var{expr}
3646Consider the package @var{expr} evaluates to.
3647
3648This has the same purpose as the same-named option in @command{guix build}
3649(@pxref{Zusätzliche Erstellungsoptionen, @code{--expression} in @command{guix
3650build}}).
3651
3652@item --manifest=@var{Datei}
3653@itemx -m @var{Datei}
3654Use the packages contained in the manifest object returned by the Scheme
3655code in @var{file}.
3656
3657This has a similar purpose as the same-named option in @command{guix
3658package} (@pxref{profile-manifest, @option{--manifest}}) and uses the same
3659manifest files. It allows you to define a collection of packages once and
3660use it both for creating profiles and for creating archives for use on
3661machines that do not have Guix installed. Note that you can specify
3662@emph{either} a manifest file @emph{or} a list of packages, but not both.
3663
3664@item --system=@var{System}
3665@itemx -s @var{system}
3666Attempt to build for @var{system}---e.g., @code{i686-linux}---instead of the
3667system type of the build host.
3668
3669@item --target=@var{triplet}
3670@cindex cross-compilation
3671Cross-build for @var{triplet}, which must be a valid GNU triplet, such as
3672@code{"mips64el-linux-gnu"} (@pxref{Specifying target triplets, GNU
3673configuration triplets,, autoconf, Autoconf}).
3674
3675@item --compression=@var{tool}
3676@itemx -C @var{tool}
3677Compress the resulting tarball using @var{tool}---one of @code{gzip},
3678@code{bzip2}, @code{xz}, @code{lzip}, or @code{none} for no compression.
3679
3680@item --symlink=@var{spec}
3681@itemx -S @var{spec}
3682Add the symlinks specified by @var{spec} to the pack. This option can
3683appear several times.
3684
3685@var{spec} has the form @code{@var{source}=@var{target}}, where @var{source}
3686is the symlink that will be created and @var{target} is the symlink target.
3687
3688For instance, @code{-S /opt/gnu/bin=bin} creates a @file{/opt/gnu/bin}
3689symlink pointing to the @file{bin} sub-directory of the profile.
3690
3691@item --localstatedir
793dcd8c 3692@itemx --profile-name=@var{name}
1e40e70b 3693Include the ``local state directory'', @file{/var/guix}, in the resulting
793dcd8c
LC
3694pack, and notably the @file{/var/guix/profiles/per-user/root/@var{name}}
3695profile---by default @var{name} is @code{guix-profile}, which corresponds to
3696@file{~root/.guix-profile}.
1e40e70b
JL
3697
3698@file{/var/guix} contains the store database (@pxref{Der Store}) as well as
3699garbage-collector roots (@pxref{Aufruf von guix gc}). Providing it in the
3700pack means that the store is ``complete'' and manageable by Guix; not
3701providing it pack means that the store is ``dead'': items cannot be added to
3702it or removed from it after extraction of the pack.
3703
3704One use case for this is the Guix self-contained binary tarball
3705(@pxref{Aus Binärdatei installieren}).
3706
3707@item --bootstrap
3708Use the bootstrap binaries to build the pack. This option is only useful to
3709Guix developers.
3710@end table
3711
3712In addition, @command{guix pack} supports all the common build options
3713(@pxref{Gemeinsame Erstellungsoptionen}) and all the package transformation options
3714(@pxref{Paketumwandlungsoptionen}).
3715
3716
3717@node Aufruf von guix archive
3718@section Invoking @command{guix archive}
3719
3720@cindex @command{guix archive}
3721@cindex archive
3722The @command{guix archive} command allows users to @dfn{export} files from
3723the store into a single archive, and to later @dfn{import} them on a machine
3724that runs Guix. In particular, it allows store files to be transferred from
3725one machine to the store on another machine.
3726
3727@quotation Anmerkung
3728If you're looking for a way to produce archives in a format suitable for
3729tools other than Guix, @pxref{Aufruf von guix pack}.
3730@end quotation
3731
3732@cindex exporting store items
3733To export store files as an archive to standard output, run:
3734
3735@example
3736guix archive --export @var{options} @var{specifications}...
3737@end example
3738
3739@var{specifications} may be either store file names or package
3740specifications, as for @command{guix package} (@pxref{Aufruf von guix package}). For instance, the following command creates an archive
3741containing the @code{gui} output of the @code{git} package and the main
3742output of @code{emacs}:
3743
3744@example
3745guix archive --export git:gui /gnu/store/...-emacs-24.3 > great.nar
3746@end example
3747
3748If the specified packages are not built yet, @command{guix archive}
3749automatically builds them. The build process may be controlled with the
3750common build options (@pxref{Gemeinsame Erstellungsoptionen}).
3751
3752To transfer the @code{emacs} package to a machine connected over SSH, one
3753would run:
3754
3755@example
3756guix archive --export -r emacs | ssh the-machine guix archive --import
3757@end example
3758
3759@noindent
3760Similarly, a complete user profile may be transferred from one machine to
3761another like this:
3762
3763@example
3764guix archive --export -r $(readlink -f ~/.guix-profile) | \
3765 ssh the-machine guix-archive --import
3766@end example
3767
3768@noindent
3769However, note that, in both examples, all of @code{emacs} and the profile as
3770well as all of their dependencies are transferred (due to @code{-r}),
3771regardless of what is already available in the store on the target machine.
3772The @code{--missing} option can help figure out which items are missing from
3773the target store. The @command{guix copy} command simplifies and optimizes
3774this whole process, so this is probably what you should use in this case
3775(@pxref{Aufruf von guix copy}).
3776
3777@cindex nar, archive format
3778@cindex normalized archive (nar)
3779Archives are stored in the ``normalized archive'' or ``nar'' format, which
3780is comparable in spirit to `tar', but with differences that make it more
3781appropriate for our purposes. First, rather than recording all Unix
3782metadata for each file, the nar format only mentions the file type (regular,
3783directory, or symbolic link); Unix permissions and owner/group are
3784dismissed. Second, the order in which directory entries are stored always
3785follows the order of file names according to the C locale collation order.
3786This makes archive production fully deterministic.
3787
3788@c FIXME: Add xref to daemon doc about signatures.
3789When exporting, the daemon digitally signs the contents of the archive, and
3790that digital signature is appended. When importing, the daemon verifies the
3791signature and rejects the import in case of an invalid signature or if the
3792signing key is not authorized.
3793
3794The main options are:
3795
3796@table @code
3797@item --export
3798Export the specified store files or packages (see below.) Write the
3799resulting archive to the standard output.
3800
3801Dependencies are @emph{not} included in the output, unless
3802@code{--recursive} is passed.
3803
3804@item -r
3805@itemx --recursive
3806When combined with @code{--export}, this instructs @command{guix archive} to
3807include dependencies of the given items in the archive. Thus, the resulting
3808archive is self-contained: it contains the closure of the exported store
3809items.
3810
3811@item --import
3812Read an archive from the standard input, and import the files listed therein
3813into the store. Abort if the archive has an invalid digital signature, or
3814if it is signed by a public key not among the authorized keys (see
3815@code{--authorize} below.)
3816
3817@item --missing
3818Read a list of store file names from the standard input, one per line, and
3819write on the standard output the subset of these files missing from the
3820store.
3821
3822@item --generate-key[=@var{parameters}]
3823@cindex signing, archives
3824Generate a new key pair for the daemon. This is a prerequisite before
3825archives can be exported with @code{--export}. Note that this operation
3826usually takes time, because it needs to gather enough entropy to generate
3827the key pair.
3828
3829The generated key pair is typically stored under @file{/etc/guix}, in
3830@file{signing-key.pub} (public key) and @file{signing-key.sec} (private key,
3831which must be kept secret.) When @var{parameters} is omitted, an ECDSA key
3832using the Ed25519 curve is generated, or, for Libgcrypt versions before
38331.6.0, it is a 4096-bit RSA key. Alternatively, @var{parameters} can
3834specify @code{genkey} parameters suitable for Libgcrypt (@pxref{General
3835public-key related Functions, @code{gcry_pk_genkey},, gcrypt, The Libgcrypt
3836Reference Manual}).
3837
3838@item --authorize
3839@cindex authorizing, archives
3840Authorize imports signed by the public key passed on standard input. The
3841public key must be in ``s-expression advanced format''---i.e., the same
3842format as the @file{signing-key.pub} file.
3843
3844The list of authorized keys is kept in the human-editable file
3845@file{/etc/guix/acl}. The file contains
3846@url{http://people.csail.mit.edu/rivest/Sexp.txt, ``advanced-format
3847s-expressions''} and is structured as an access-control list in the
3848@url{http://theworld.com/~cme/spki.txt, Simple Public-Key Infrastructure
3849(SPKI)}.
3850
3851@item --extract=@var{directory}
3852@itemx -x @var{directory}
3853Read a single-item archive as served by substitute servers
3854(@pxref{Substitute}) and extract it to @var{directory}. This is a
3855low-level operation needed in only very narrow use cases; see below.
3856
3857For example, the following command extracts the substitute for Emacs served
3858by @code{hydra.gnu.org} to @file{/tmp/emacs}:
3859
3860@example
3861$ wget -O - \
3862 https://hydra.gnu.org/nar/@dots{}-emacs-24.5 \
3863 | bunzip2 | guix archive -x /tmp/emacs
3864@end example
3865
3866Single-item archives are different from multiple-item archives produced by
3867@command{guix archive --export}; they contain a single store item, and they
3868do @emph{not} embed a signature. Thus this operation does @emph{no}
3869signature verification and its output should be considered unsafe.
3870
3871The primary purpose of this operation is to facilitate inspection of archive
3872contents coming from possibly untrusted substitute servers.
3873
3874@end table
3875
3876@c *********************************************************************
3877@node Programmierschnittstelle
3878@chapter Programmierschnittstelle
3879
3880GNU Guix provides several Scheme programming interfaces (APIs) to define,
3881build, and query packages. The first interface allows users to write
3882high-level package definitions. These definitions refer to familiar
3883packaging concepts, such as the name and version of a package, its build
3884system, and its dependencies. These definitions can then be turned into
3885concrete build actions.
3886
3887Build actions are performed by the Guix daemon, on behalf of users. In a
3888standard setup, the daemon has write access to the store---the
3889@file{/gnu/store} directory---whereas users do not. The recommended setup
3890also has the daemon perform builds in chroots, under a specific build users,
3891to minimize interference with the rest of the system.
3892
3893@cindex Ableitung
3894Lower-level APIs are available to interact with the daemon and the store.
3895To instruct the daemon to perform a build action, users actually provide it
3896with a @dfn{derivation}. A derivation is a low-level representation of the
3897build actions to be taken, and the environment in which they should
3898occur---derivations are to package definitions what assembly is to C
3899programs. The term ``derivation'' comes from the fact that build results
3900@emph{derive} from them.
3901
3902This chapter describes all these APIs in turn, starting from high-level
3903package definitions.
3904
3905@menu
3906* Pakete definieren:: Wie Sie neue Pakete definieren.
3907* Erstellungssysteme:: Angeben, wie Pakete erstellt werden.
3908* Der Store:: Den Paket-Store verändern.
3909* Ableitungen:: Systemnahe Schnittstelle für Paketableitungen.
3910* Die Store-Monade:: Rein funktionale Schnittstelle zum Store.
3911* G-Ausdrücke:: Erstellungsausdrücke verarbeiten.
3912* Invoking guix repl:: Fiddling with Guix interactively.
3913@end menu
3914
3915@node Pakete definieren
3916@section Pakete definieren
3917
3918The high-level interface to package definitions is implemented in the
3919@code{(guix packages)} and @code{(guix build-system)} modules. As an
3920example, the package definition, or @dfn{recipe}, for the GNU Hello package
3921looks like this:
3922
3923@example
3924(define-module (gnu packages hello)
3925 #:use-module (guix packages)
3926 #:use-module (guix download)
3927 #:use-module (guix build-system gnu)
3928 #:use-module (guix licenses)
3929 #:use-module (gnu packages gawk))
3930
3931(define-public hello
3932 (package
3933 (name "hello")
3934 (version "2.10")
3935 (source (origin
3936 (method url-fetch)
3937 (uri (string-append "mirror://gnu/hello/hello-" version
3938 ".tar.gz"))
3939 (sha256
3940 (base32
3941 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
3942 (build-system gnu-build-system)
3943 (arguments '(#:configure-flags '("--enable-silent-rules")))
3944 (inputs `(("gawk" ,gawk)))
3945 (synopsis "Hello, GNU world: An example GNU package")
3946 (description "Guess what GNU Hello prints!")
3947 (home-page "http://www.gnu.org/software/hello/")
3948 (license gpl3+)))
3949@end example
3950
3951@noindent
3952Without being a Scheme expert, the reader may have guessed the meaning of
3953the various fields here. This expression binds the variable @code{hello} to
3954a @code{<package>} object, which is essentially a record (@pxref{SRFI-9,
3955Scheme records,, guile, GNU Guile Reference Manual}). This package object
3956can be inspected using procedures found in the @code{(guix packages)}
3957module; for instance, @code{(package-name hello)}
3958returns---surprise!---@code{"hello"}.
3959
3960With luck, you may be able to import part or all of the definition of the
3961package you are interested in from another repository, using the @code{guix
3962import} command (@pxref{Aufruf von guix import}).
3963
3964In the example above, @var{hello} is defined in a module of its own,
3965@code{(gnu packages hello)}. Technically, this is not strictly necessary,
3966but it is convenient to do so: all the packages defined in modules under
3967@code{(gnu packages @dots{})} are automatically known to the command-line
3968tools (@pxref{Paketmodule}).
3969
3970There are a few points worth noting in the above package definition:
3971
3972@itemize
3973@item
3974The @code{source} field of the package is an @code{<origin>} object
3975(@pxref{„origin“-Referenz}, for the complete reference). Here, the
3976@code{url-fetch} method from @code{(guix download)} is used, meaning that
3977the source is a file to be downloaded over FTP or HTTP.
3978
3979The @code{mirror://gnu} prefix instructs @code{url-fetch} to use one of the
3980GNU mirrors defined in @code{(guix download)}.
3981
3982The @code{sha256} field specifies the expected SHA256 hash of the file being
3983downloaded. It is mandatory, and allows Guix to check the integrity of the
3984file. The @code{(base32 @dots{})} form introduces the base32 representation
3985of the hash. You can obtain this information with @code{guix download}
3986(@pxref{Aufruf von guix download}) and @code{guix hash} (@pxref{Aufruf von guix hash}).
3987
3988@cindex patches
3989When needed, the @code{origin} form can also have a @code{patches} field
3990listing patches to be applied, and a @code{snippet} field giving a Scheme
3991expression to modify the source code.
3992
3993@item
3994@cindex GNU-Erstellungssystem
3995The @code{build-system} field specifies the procedure to build the package
3996(@pxref{Erstellungssysteme}). Here, @var{gnu-build-system} represents the
3997familiar GNU Build System, where packages may be configured, built, and
3998installed with the usual @code{./configure && make && make check && make
3999install} command sequence.
4000
4001@item
4002The @code{arguments} field specifies options for the build system
4003(@pxref{Erstellungssysteme}). Here it is interpreted by @var{gnu-build-system}
4004as a request run @file{configure} with the @code{--enable-silent-rules}
4005flag.
4006
4007@cindex quote
4008@cindex quoting
4009@findex '
4010@findex quote
4011What about these quote (@code{'}) characters? They are Scheme syntax to
4012introduce a literal list; @code{'} is synonymous with @code{quote}.
4013@xref{Expression Syntax, quoting,, guile, GNU Guile Reference Manual}, for
4014details. Here the value of the @code{arguments} field is a list of
4015arguments passed to the build system down the road, as with @code{apply}
4016(@pxref{Fly Evaluation, @code{apply},, guile, GNU Guile Reference Manual}).
4017
4018The hash-colon (@code{#:}) sequence defines a Scheme @dfn{keyword}
4019(@pxref{Keywords,,, guile, GNU Guile Reference Manual}), and
4020@code{#:configure-flags} is a keyword used to pass a keyword argument to the
4021build system (@pxref{Coding With Keywords,,, guile, GNU Guile Reference
4022Manual}).
4023
4024@item
4025The @code{inputs} field specifies inputs to the build process---i.e.,
4026build-time or run-time dependencies of the package. Here, we define an
4027input called @code{"gawk"} whose value is that of the @var{gawk} variable;
4028@var{gawk} is itself bound to a @code{<package>} object.
4029
4030@cindex backquote (quasiquote)
4031@findex `
4032@findex quasiquote
4033@cindex comma (unquote)
4034@findex ,
4035@findex unquote
4036@findex ,@@
4037@findex unquote-splicing
4038Again, @code{`} (a backquote, synonymous with @code{quasiquote}) allows us
4039to introduce a literal list in the @code{inputs} field, while @code{,} (a
4040comma, synonymous with @code{unquote}) allows us to insert a value in that
4041list (@pxref{Expression Syntax, unquote,, guile, GNU Guile Reference
4042Manual}).
4043
4044Note that GCC, Coreutils, Bash, and other essential tools do not need to be
4045specified as inputs here. Instead, @var{gnu-build-system} takes care of
4046ensuring that they are present (@pxref{Erstellungssysteme}).
4047
4048However, any other dependencies need to be specified in the @code{inputs}
4049field. Any dependency not specified here will simply be unavailable to the
4050build process, possibly leading to a build failure.
4051@end itemize
4052
4053@xref{„package“-Referenz}, for a full description of possible fields.
4054
4055Once a package definition is in place, the package may actually be built
4056using the @code{guix build} command-line tool (@pxref{Aufruf von guix build}),
4057troubleshooting any build failures you encounter (@pxref{Fehlschläge beim Erstellen untersuchen}). You can easily jump back to the package definition using the
4058@command{guix edit} command (@pxref{Aufruf von guix edit}). @xref{Paketrichtlinien}, for more information on how to test package definitions, and
4059@ref{Aufruf von guix lint}, for information on how to check a definition for
4060style conformance.
4061@vindex GUIX_PACKAGE_PATH
4062Lastly, @pxref{Channels}, for information on how to extend the distribution
4063by adding your own package definitions in a ``channel''.
4064
4065Finally, updating the package definition to a new upstream version can be
4066partly automated by the @command{guix refresh} command (@pxref{Aufruf von guix refresh}).
4067
4068Behind the scenes, a derivation corresponding to the @code{<package>} object
4069is first computed by the @code{package-derivation} procedure. That
4070derivation is stored in a @code{.drv} file under @file{/gnu/store}. The
4071build actions it prescribes may then be realized by using the
4072@code{build-derivations} procedure (@pxref{Der Store}).
4073
4074@deffn {Scheme Procedure} package-derivation @var{store} @var{package} [@var{system}]
4075Return the @code{<derivation>} object of @var{package} for @var{system}
4076(@pxref{Ableitungen}).
4077
4078@var{package} must be a valid @code{<package>} object, and @var{system} must
4079be a string denoting the target system type---e.g., @code{"x86_64-linux"}
4080for an x86_64 Linux-based GNU system. @var{store} must be a connection to
4081the daemon, which operates on the store (@pxref{Der Store}).
4082@end deffn
4083
4084@noindent
4085@cindex cross-compilation
4086Similarly, it is possible to compute a derivation that cross-builds a
4087package for some other system:
4088
4089@deffn {Scheme Procedure} package-cross-derivation @var{store} @
4090 @var{package} @var{target} [@var{system}] Return the @code{<derivation>}
4091object of @var{package} cross-built from @var{system} to @var{target}.
4092
4093@var{target} must be a valid GNU triplet denoting the target hardware and
4094operating system, such as @code{"mips64el-linux-gnu"} (@pxref{Configuration
4095Names, GNU configuration triplets,, configure, GNU Configure and Build
4096System}).
4097@end deffn
4098
4099@cindex package transformations
4100@cindex input rewriting
4101@cindex dependency tree rewriting
4102Packages can be manipulated in arbitrary ways. An example of a useful
4103transformation is @dfn{input rewriting}, whereby the dependency tree of a
4104package is rewritten by replacing specific inputs by others:
4105
4106@deffn {Scheme Procedure} package-input-rewriting @var{replacements} @
4107 [@var{rewrite-name}] Return a procedure that, when passed a package,
4108replaces its direct and indirect dependencies (but not its implicit inputs)
4109according to @var{replacements}. @var{replacements} is a list of package
4110pairs; the first element of each pair is the package to replace, and the
4111second one is the replacement.
4112
4113Optionally, @var{rewrite-name} is a one-argument procedure that takes the
4114name of a package and returns its new name after rewrite.
4115@end deffn
4116
4117@noindent
4118Consider this example:
4119
4120@example
4121(define libressl-instead-of-openssl
4122 ;; This is a procedure to replace OPENSSL by LIBRESSL,
4123 ;; recursively.
4124 (package-input-rewriting `((,openssl . ,libressl))))
4125
4126(define git-with-libressl
4127 (libressl-instead-of-openssl git))
4128@end example
4129
4130@noindent
4131Here we first define a rewriting procedure that replaces @var{openssl} with
4132@var{libressl}. Then we use it to define a @dfn{variant} of the @var{git}
4133package that uses @var{libressl} instead of @var{openssl}. This is exactly
4134what the @option{--with-input} command-line option does (@pxref{Paketumwandlungsoptionen, @option{--with-input}}).
4135
4136A more generic procedure to rewrite a package dependency graph is
4137@code{package-mapping}: it supports arbitrary changes to nodes in the graph.
4138
4139@deffn {Scheme Procedure} package-mapping @var{proc} [@var{cut?}]
4140Return a procedure that, given a package, applies @var{proc} to all the
4141packages depended on and returns the resulting package. The procedure stops
4142recursion when @var{cut?} returns true for a given package.
4143@end deffn
4144
4145@menu
4146* „package“-Referenz:: Der Datentyp für Pakete.
4147* „origin“-Referenz:: Datentyp für Paketursprünge.
4148@end menu
4149
4150
4151@node „package“-Referenz
4152@subsection @code{package} Reference
4153
4154This section summarizes all the options available in @code{package}
4155declarations (@pxref{Pakete definieren}).
4156
4157@deftp {Data Type} package
4158This is the data type representing a package recipe.
4159
4160@table @asis
4161@item @code{name}
4162The name of the package, as a string.
4163
4164@item @code{version}
4165The version of the package, as a string.
4166
4167@item @code{source}
4168An object telling how the source code for the package should be acquired.
4169Most of the time, this is an @code{origin} object, which denotes a file
4170fetched from the Internet (@pxref{„origin“-Referenz}). It can also be any
4171other ``file-like'' object such as a @code{local-file}, which denotes a file
4172from the local file system (@pxref{G-Ausdrücke, @code{local-file}}).
4173
4174@item @code{build-system}
4175The build system that should be used to build the package (@pxref{Erstellungssysteme}).
4176
4177@item @code{arguments} (default: @code{'()})
4178The arguments that should be passed to the build system. This is a list,
4179typically containing sequential keyword-value pairs.
4180
4181@item @code{inputs} (default: @code{'()})
4182@itemx @code{native-inputs} (default: @code{'()})
4183@itemx @code{propagated-inputs} (default: @code{'()})
4184@cindex inputs, of packages
4185These fields list dependencies of the package. Each one is a list of
4186tuples, where each tuple has a label for the input (a string) as its first
4187element, a package, origin, or derivation as its second element, and
4188optionally the name of the output thereof that should be used, which
4189defaults to @code{"out"} (@pxref{Pakete mit mehreren Ausgaben.}, for more
4190on package outputs). For example, the list below specifies three inputs:
4191
4192@example
4193`(("libffi" ,libffi)
4194 ("libunistring" ,libunistring)
4195 ("glib:bin" ,glib "bin")) ;the "bin" output of Glib
4196@end example
4197
4198@cindex cross compilation, package dependencies
4199The distinction between @code{native-inputs} and @code{inputs} is necessary
4200when considering cross-compilation. When cross-compiling, dependencies
4201listed in @code{inputs} are built for the @emph{target} architecture;
4202conversely, dependencies listed in @code{native-inputs} are built for the
4203architecture of the @emph{build} machine.
4204
4205@code{native-inputs} is typically used to list tools needed at build time,
4206but not at run time, such as Autoconf, Automake, pkg-config, Gettext, or
4207Bison. @command{guix lint} can report likely mistakes in this area
4208(@pxref{Aufruf von guix lint}).
4209
4210@anchor{package-propagated-inputs}
4211Lastly, @code{propagated-inputs} is similar to @code{inputs}, but the
4212specified packages will be automatically installed alongside the package
4213they belong to (@pxref{package-cmd-propagated-inputs, @command{guix
4214package}}, for information on how @command{guix package} deals with
4215propagated inputs.)
4216
4217For example this is necessary when a C/C++ library needs headers of another
4218library to compile, or when a pkg-config file refers to another one @i{via}
4219its @code{Requires} field.
4220
4221Another example where @code{propagated-inputs} is useful is for languages
4222that lack a facility to record the run-time search path akin to the
4223@code{RUNPATH} of ELF files; this includes Guile, Python, Perl, and more.
4224To ensure that libraries written in those languages can find library code
4225they depend on at run time, run-time dependencies must be listed in
4226@code{propagated-inputs} rather than @code{inputs}.
4227
4228@item @code{self-native-input?} (default: @code{#f})
4229This is a Boolean field telling whether the package should use itself as a
4230native input when cross-compiling.
4231
4232@item @code{outputs} (default: @code{'("out")})
4233The list of output names of the package. @xref{Pakete mit mehreren Ausgaben.}, for typical uses of additional outputs.
4234
4235@item @code{native-search-paths} (default: @code{'()})
4236@itemx @code{search-paths} (default: @code{'()})
4237A list of @code{search-path-specification} objects describing search-path
4238environment variables honored by the package.
4239
4240@item @code{replacement} (default: @code{#f})
4241This must be either @code{#f} or a package object that will be used as a
4242@dfn{replacement} for this package. @xref{Sicherheitsaktualisierungen, grafts}, for
4243details.
4244
4245@item @code{synopsis}
4246Eine einzeilige Beschreibung des Pakets.
4247
4248@item @code{description}
4249Eine ausführlichere Beschreibung des Pakets.
4250
4251@item @code{license}
4252@cindex license, of packages
4253The license of the package; a value from @code{(guix licenses)}, or a list
4254of such values.
4255
4256@item @code{home-page}
4257The URL to the home-page of the package, as a string.
4258
4259@item @code{supported-systems} (default: @var{%supported-systems})
4260The list of systems supported by the package, as strings of the form
4261@code{architecture-kernel}, for example @code{"x86_64-linux"}.
4262
4263@item @code{maintainers} (default: @code{'()})
4264The list of maintainers of the package, as @code{maintainer} objects.
4265
4266@item @code{location} (default: source location of the @code{package} form)
4267The source location of the package. It is useful to override this when
4268inheriting from another package, in which case this field is not
4269automatically corrected.
4270@end table
4271@end deftp
4272
4273
4274@node „origin“-Referenz
4275@subsection @code{origin} Reference
4276
4277This section summarizes all the options available in @code{origin}
4278declarations (@pxref{Pakete definieren}).
4279
4280@deftp {Data Type} origin
4281This is the data type representing a source code origin.
4282
4283@table @asis
4284@item @code{uri}
4285An object containing the URI of the source. The object type depends on the
4286@code{method} (see below). For example, when using the @var{url-fetch}
4287method of @code{(guix download)}, the valid @code{uri} values are: a URL
4288represented as a string, or a list thereof.
4289
4290@item @code{method}
4291A procedure that handles the URI.
4292
4293Examples include:
4294
4295@table @asis
4296@item @var{url-fetch} from @code{(guix download)}
4297download a file from the HTTP, HTTPS, or FTP URL specified in the @code{uri}
4298field;
4299
4300@vindex git-fetch
4301@item @var{git-fetch} from @code{(guix git-download)}
4302clone the Git version control repository, and check out the revision
4303specified in the @code{uri} field as a @code{git-reference} object; a
4304@code{git-reference} looks like this:
4305
4306@example
4307(git-reference
4308 (url "git://git.debian.org/git/pkg-shadow/shadow")
4309 (commit "v4.1.5.1"))
4310@end example
4311@end table
4312
4313@item @code{sha256}
4314A bytevector containing the SHA-256 hash of the source. Typically the
4315@code{base32} form is used here to generate the bytevector from a base-32
4316string.
4317
4318You can obtain this information using @code{guix download} (@pxref{Aufruf von guix download}) or @code{guix hash} (@pxref{Aufruf von guix hash}).
4319
4320@item @code{file-name} (default: @code{#f})
4321The file name under which the source code should be saved. When this is
4322@code{#f}, a sensible default value will be used in most cases. In case the
4323source is fetched from a URL, the file name from the URL will be used. For
4324version control checkouts, it is recommended to provide the file name
4325explicitly because the default is not very descriptive.
4326
4327@item @code{patches} (default: @code{'()})
4328A list of file names, origins, or file-like objects (@pxref{G-Ausdrücke,
4329file-like objects}) pointing to patches to be applied to the source.
4330
4331This list of patches must be unconditional. In particular, it cannot depend
4332on the value of @code{%current-system} or @code{%current-target-system}.
4333
4334@item @code{snippet} (default: @code{#f})
4335A G-expression (@pxref{G-Ausdrücke}) or S-expression that will be run in
4336the source directory. This is a convenient way to modify the source,
4337sometimes more convenient than a patch.
4338
4339@item @code{patch-flags} (default: @code{'("-p1")})
4340A list of command-line flags that should be passed to the @code{patch}
4341command.
4342
4343@item @code{patch-inputs} (default: @code{#f})
4344Input packages or derivations to the patching process. When this is
4345@code{#f}, the usual set of inputs necessary for patching are provided, such
4346as GNU@tie{}Patch.
4347
4348@item @code{modules} (default: @code{'()})
4349A list of Guile modules that should be loaded during the patching process
4350and while running the code in the @code{snippet} field.
4351
4352@item @code{patch-guile} (default: @code{#f})
4353The Guile package that should be used in the patching process. When this is
4354@code{#f}, a sensible default is used.
4355@end table
4356@end deftp
4357
4358
4359@node Erstellungssysteme
4360@section Erstellungssysteme
4361
4362@cindex build system
4363Each package definition specifies a @dfn{build system} and arguments for
4364that build system (@pxref{Pakete definieren}). This @code{build-system}
4365field represents the build procedure of the package, as well as implicit
4366dependencies of that build procedure.
4367
4368Build systems are @code{<build-system>} objects. The interface to create
4369and manipulate them is provided by the @code{(guix build-system)} module,
4370and actual build systems are exported by specific modules.
4371
4372@cindex bag (low-level package representation)
4373Under the hood, build systems first compile package objects to @dfn{bags}.
4374A @dfn{bag} is like a package, but with less ornamentation---in other words,
4375a bag is a lower-level representation of a package, which includes all the
4376inputs of that package, including some that were implicitly added by the
4377build system. This intermediate representation is then compiled to a
4378derivation (@pxref{Ableitungen}).
4379
4380Build systems accept an optional list of @dfn{arguments}. In package
4381definitions, these are passed @i{via} the @code{arguments} field
4382(@pxref{Pakete definieren}). They are typically keyword arguments
4383(@pxref{Optional Arguments, keyword arguments in Guile,, guile, GNU Guile
4384Reference Manual}). The value of these arguments is usually evaluated in
4385the @dfn{build stratum}---i.e., by a Guile process launched by the daemon
4386(@pxref{Ableitungen}).
4387
4388The main build system is @var{gnu-build-system}, which implements the
4389standard build procedure for GNU and many other packages. It is provided by
4390the @code{(guix build-system gnu)} module.
4391
4392@defvr {Scheme Variable} gnu-build-system
4393@var{gnu-build-system} represents the GNU Build System, and variants thereof
4394(@pxref{Configuration, configuration and makefile conventions,, standards,
4395GNU Coding Standards}).
4396
4397@cindex build phases
4398In a nutshell, packages using it are configured, built, and installed with
4399the usual @code{./configure && make && make check && make install} command
4400sequence. In practice, a few additional steps are often needed. All these
4401steps are split up in separate @dfn{phases}, notably@footnote{Please see the
4402@code{(guix build gnu-build-system)} modules for more details about the
4403build phases.}:
4404
4405@table @code
4406@item unpack
4407Unpack the source tarball, and change the current directory to the extracted
4408source tree. If the source is actually a directory, copy it to the build
4409tree, and enter that directory.
4410
4411@item patch-source-shebangs
4412Patch shebangs encountered in source files so they refer to the right store
4413file names. For instance, this changes @code{#!/bin/sh} to
4414@code{#!/gnu/store/@dots{}-bash-4.3/bin/sh}.
4415
4416@item configure
4417Run the @file{configure} script with a number of default options, such as
4418@code{--prefix=/gnu/store/@dots{}}, as well as the options specified by the
4419@code{#:configure-flags} argument.
4420
4421@item build
4422Run @code{make} with the list of flags specified with @code{#:make-flags}.
4423If the @code{#:parallel-build?} argument is true (the default), build with
4424@code{make -j}.
4425
4426@item check
4427Run @code{make check}, or some other target specified with
4428@code{#:test-target}, unless @code{#:tests? #f} is passed. If the
4429@code{#:parallel-tests?} argument is true (the default), run @code{make
4430check -j}.
4431
4432@item install
4433Run @code{make install} with the flags listed in @code{#:make-flags}.
4434
4435@item patch-shebangs
4436Patch shebangs on the installed executable files.
4437
4438@item strip
4439Strip debugging symbols from ELF files (unless @code{#:strip-binaries?} is
4440false), copying them to the @code{debug} output when available
4441(@pxref{Dateien zur Fehlersuche installieren}).
4442@end table
4443
4444@vindex %standard-phases
4445The build-side module @code{(guix build gnu-build-system)} defines
4446@var{%standard-phases} as the default list of build phases.
4447@var{%standard-phases} is a list of symbol/procedure pairs, where the
4448procedure implements the actual phase.
4449
4450The list of phases used for a particular package can be changed with the
4451@code{#:phases} parameter. For instance, passing:
4452
4453@example
4454#:phases (modify-phases %standard-phases (delete 'configure))
4455@end example
4456
4457means that all the phases described above will be used, except the
4458@code{configure} phase.
4459
4460In addition, this build system ensures that the ``standard'' environment for
4461GNU packages is available. This includes tools such as GCC, libc,
4462Coreutils, Bash, Make, Diffutils, grep, and sed (see the @code{(guix
4463build-system gnu)} module for a complete list). We call these the
4464@dfn{implicit inputs} of a package, because package definitions do not have
4465to mention them.
4466@end defvr
4467
4468Other @code{<build-system>} objects are defined to support other conventions
4469and tools used by free software packages. They inherit most of
4470@var{gnu-build-system}, and differ mainly in the set of inputs implicitly
4471added to the build process, and in the list of phases executed. Some of
4472these build systems are listed below.
4473
4474@defvr {Scheme Variable} ant-build-system
4475This variable is exported by @code{(guix build-system ant)}. It implements
4476the build procedure for Java packages that can be built with
4477@url{http://ant.apache.org/, Ant build tool}.
4478
4479It adds both @code{ant} and the @dfn{Java Development Kit} (JDK) as provided
4480by the @code{icedtea} package to the set of inputs. Different packages can
4481be specified with the @code{#:ant} and @code{#:jdk} parameters,
4482respectively.
4483
4484When the original package does not provide a suitable Ant build file, the
4485parameter @code{#:jar-name} can be used to generate a minimal Ant build file
4486@file{build.xml} with tasks to build the specified jar archive. In this
4487case the parameter @code{#:source-dir} can be used to specify the source
4488sub-directory, defaulting to ``src''.
4489
4490The @code{#:main-class} parameter can be used with the minimal ant buildfile
4491to specify the main class of the resulting jar. This makes the jar file
4492executable. The @code{#:test-include} parameter can be used to specify the
4493list of junit tests to run. It defaults to @code{(list "**/*Test.java")}.
4494The @code{#:test-exclude} can be used to disable some tests. It defaults to
4495@code{(list "**/Abstract*.java")}, because abstract classes cannot be run as
4496tests.
4497
4498The parameter @code{#:build-target} can be used to specify the Ant task that
4499should be run during the @code{build} phase. By default the ``jar'' task
4500will be run.
4501
4502@end defvr
4503
4504@defvr {Scheme Variable} android-ndk-build-system
4505@cindex Android distribution
4506@cindex Android NDK build system
4507This variable is exported by @code{(guix build-system android-ndk)}. It
4508implements a build procedure for Android NDK (native development kit)
4509packages using a Guix-specific build process.
4510
4511The build system assumes that packages install their public interface
4512(header) files to the subdirectory "include" of the "out" output and their
4513libraries to the subdirectory "lib" of the "out" output.
4514
4515It's also assumed that the union of all the dependencies of a package has no
4516conflicting files.
4517
4518For the time being, cross-compilation is not supported - so right now the
4519libraries and header files are assumed to be host tools.
4520
4521@end defvr
4522
4523@defvr {Scheme Variable} asdf-build-system/source
4524@defvrx {Scheme Variable} asdf-build-system/sbcl
4525@defvrx {Scheme Variable} asdf-build-system/ecl
4526
4527These variables, exported by @code{(guix build-system asdf)}, implement
4528build procedures for Common Lisp packages using
4529@url{https://common-lisp.net/project/asdf/, ``ASDF''}. ASDF is a system
4530definition facility for Common Lisp programs and libraries.
4531
4532The @code{asdf-build-system/source} system installs the packages in source
4533form, and can be loaded using any common lisp implementation, via ASDF. The
4534others, such as @code{asdf-build-system/sbcl}, install binary systems in the
4535format which a particular implementation understands. These build systems
4536can also be used to produce executable programs, or lisp images which
4537contain a set of packages pre-loaded.
4538
4539The build system uses naming conventions. For binary packages, the package
4540name should be prefixed with the lisp implementation, such as @code{sbcl-}
4541for @code{asdf-build-system/sbcl}.
4542
4543Additionally, the corresponding source package should be labeled using the
4544same convention as python packages (see @ref{Python-Module}), using the
4545@code{cl-} prefix.
4546
4547For binary packages, each system should be defined as a Guix package. If
4548one package @code{origin} contains several systems, package variants can be
4549created in order to build all the systems. Source packages, which use
4550@code{asdf-build-system/source}, may contain several systems.
4551
4552In order to create executable programs and images, the build-side procedures
4553@code{build-program} and @code{build-image} can be used. They should be
4554called in a build phase after the @code{create-symlinks} phase, so that the
4555system which was just built can be used within the resulting image.
4556@code{build-program} requires a list of Common Lisp expressions to be passed
4557as the @code{#:entry-program} argument.
4558
4559If the system is not defined within its own @code{.asd} file of the same
4560name, then the @code{#:asd-file} parameter should be used to specify which
4561file the system is defined in. Furthermore, if the package defines a system
4562for its tests in a separate file, it will be loaded before the tests are run
4563if it is specified by the @code{#:test-asd-file} parameter. If it is not
4564set, the files @code{<system>-tests.asd}, @code{<system>-test.asd},
4565@code{tests.asd}, and @code{test.asd} will be tried if they exist.
4566
4567If for some reason the package must be named in a different way than the
4568naming conventions suggest, the @code{#:asd-system-name} parameter can be
4569used to specify the name of the system.
4570
4571@end defvr
4572
4573@defvr {Scheme Variable} cargo-build-system
4574@cindex Rust programming language
4575@cindex Cargo (Rust build system)
4576This variable is exported by @code{(guix build-system cargo)}. It supports
4577builds of packages using Cargo, the build tool of the
4578@uref{https://www.rust-lang.org, Rust programming language}.
4579
4580In its @code{configure} phase, this build system replaces dependencies
4581specified in the @file{Carto.toml} file with inputs to the Guix package.
4582The @code{install} phase installs the binaries, and it also installs the
4583source code and @file{Cargo.toml} file.
4584@end defvr
4585
793dcd8c
LC
4586@cindex Clojure (programming language)
4587@cindex simple Clojure build system
4588@defvr {Scheme Variable} clojure-build-system
4589This variable is exported by @code{(guix build-system clojure)}. It
4590implements a simple build procedure for @uref{https://clojure.org/, Clojure}
4591packages using plain old @code{compile} in Clojure. Cross-compilation is
4592not supported yet.
4593
4594It adds @code{clojure}, @code{icedtea} and @code{zip} to the set of inputs.
4595Different packages can be specified with the @code{#:clojure}, @code{#:jdk}
4596and @code{#:zip} parameters, respectively.
4597
4598A list of source directories, test directories and jar names can be
4599specified with the @code{#:source-dirs}, @code{#:test-dirs} and
4600@code{#:jar-names} parameters, respectively. Compile directory and main
4601class can be specified with the @code{#:compile-dir} and @code{#:main-class}
4602parameters, respectively. Other parameters are documented below.
4603
4604This build system is an extension of @var{ant-build-system}, but with the
4605following phases changed:
4606
4607@table @code
4608
4609@item build
4610This phase calls @code{compile} in Clojure to compile source files and runs
4611@command{jar} to create jars from both source files and compiled files
4612according to the include list and exclude list specified in
4613@code{#:aot-include} and @code{#:aot-exclude}, respectively. The exclude
4614list has priority over the include list. These lists consist of symbols
4615representing Clojure libraries or the special keyword @code{#:all}
4616representing all Clojure libraries found under the source directories. The
4617parameter @code{#:omit-source?} decides if source should be included into
4618the jars.
4619
4620@item check
4621This phase runs tests according to the include list and exclude list
4622specified in @code{#:test-include} and @code{#:test-exclude}, respectively.
4623Their meanings are analogous to that of @code{#:aot-include} and
4624@code{#:aot-exclude}, except that the special keyword @code{#:all} now
4625stands for all Clojure libraries found under the test directories. The
4626parameter @code{#:tests?} decides if tests should be run.
4627
4628@item install
4629This phase installs all jars built previously.
4630@end table
4631
4632Apart from the above, this build system also contains an additional phase:
4633
4634@table @code
4635
4636@item install-doc
4637This phase installs all top-level files with base name matching
4638@var{%doc-regex}. A different regex can be specified with the
4639@code{#:doc-regex} parameter. All files (recursively) inside the
4640documentation directories specified in @code{#:doc-dirs} are installed as
4641well.
4642@end table
4643@end defvr
4644
1e40e70b
JL
4645@defvr {Scheme Variable} cmake-build-system
4646This variable is exported by @code{(guix build-system cmake)}. It
4647implements the build procedure for packages using the
4648@url{http://www.cmake.org, CMake build tool}.
4649
4650It automatically adds the @code{cmake} package to the set of inputs. Which
4651package is used can be specified with the @code{#:cmake} parameter.
4652
4653The @code{#:configure-flags} parameter is taken as a list of flags passed to
4654the @command{cmake} command. The @code{#:build-type} parameter specifies in
4655abstract terms the flags passed to the compiler; it defaults to
4656@code{"RelWithDebInfo"} (short for ``release mode with debugging
4657information''), which roughly means that code is compiled with @code{-O2
4658-g}, as is the case for Autoconf-based packages by default.
4659@end defvr
4660
4661@defvr {Scheme Variable} go-build-system
4662This variable is exported by @code{(guix build-system go)}. It implements a
4663build procedure for Go packages using the standard
4664@url{https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies, Go
4665build mechanisms}.
4666
4667The user is expected to provide a value for the key @code{#:import-path}
4668and, in some cases, @code{#:unpack-path}. The
4669@url{https://golang.org/doc/code.html#ImportPaths, import path} corresponds
4670to the file system path expected by the package's build scripts and any
4671referring packages, and provides a unique way to refer to a Go package. It
4672is typically based on a combination of the package source code's remote URI
4673and file system hierarchy structure. In some cases, you will need to unpack
4674the package's source code to a different directory structure than the one
4675indicated by the import path, and @code{#:unpack-path} should be used in
4676such cases.
4677
4678Packages that provide Go libraries should be installed along with their
4679source code. The key @code{#:install-source?}, which defaults to @code{#t},
4680controls whether or not the source code is installed. It can be set to
4681@code{#f} for packages that only provide executable files.
4682@end defvr
4683
4684@defvr {Scheme Variable} glib-or-gtk-build-system
4685This variable is exported by @code{(guix build-system glib-or-gtk)}. It is
4686intended for use with packages making use of GLib or GTK+.
4687
4688This build system adds the following two phases to the ones defined by
4689@var{gnu-build-system}:
4690
4691@table @code
4692@item glib-or-gtk-wrap
4693The phase @code{glib-or-gtk-wrap} ensures that programs in @file{bin/} are
4694able to find GLib ``schemas'' and
4695@uref{https://developer.gnome.org/gtk3/stable/gtk-running.html, GTK+
4696modules}. This is achieved by wrapping the programs in launch scripts that
4697appropriately set the @code{XDG_DATA_DIRS} and @code{GTK_PATH} environment
4698variables.
4699
4700It is possible to exclude specific package outputs from that wrapping
4701process by listing their names in the
4702@code{#:glib-or-gtk-wrap-excluded-outputs} parameter. This is useful when
4703an output is known not to contain any GLib or GTK+ binaries, and where
4704wrapping would gratuitously add a dependency of that output on GLib and
4705GTK+.
4706
4707@item glib-or-gtk-compile-schemas
4708The phase @code{glib-or-gtk-compile-schemas} makes sure that all
4709@uref{https://developer.gnome.org/gio/stable/glib-compile-schemas.html,
4710GSettings schemas} of GLib are compiled. Compilation is performed by the
4711@command{glib-compile-schemas} program. It is provided by the package
4712@code{glib:bin} which is automatically imported by the build system. The
4713@code{glib} package providing @command{glib-compile-schemas} can be
4714specified with the @code{#:glib} parameter.
4715@end table
4716
4717Both phases are executed after the @code{install} phase.
4718@end defvr
4719
4720@defvr {Scheme Variable} guile-build-system
4721This build system is for Guile packages that consist exclusively of Scheme
4722code and that are so lean that they don't even have a makefile, let alone a
4723@file{configure} script. It compiles Scheme code using @command{guild
4724compile} (@pxref{Compilation,,, guile, GNU Guile Reference Manual}) and
4725installs the @file{.scm} and @file{.go} files in the right place. It also
4726installs documentation.
4727
4728This build system supports cross-compilation by using the @code{--target}
4729option of @command{guild compile}.
4730
4731Packages built with @code{guile-build-system} must provide a Guile package
4732in their @code{native-inputs} field.
4733@end defvr
4734
4735@defvr {Scheme Variable} minify-build-system
4736This variable is exported by @code{(guix build-system minify)}. It
4737implements a minification procedure for simple JavaScript packages.
4738
4739It adds @code{uglify-js} to the set of inputs and uses it to compress all
4740JavaScript files in the @file{src} directory. A different minifier package
4741can be specified with the @code{#:uglify-js} parameter, but it is expected
4742that the package writes the minified code to the standard output.
4743
4744When the input JavaScript files are not all located in the @file{src}
4745directory, the parameter @code{#:javascript-files} can be used to specify a
4746list of file names to feed to the minifier.
4747@end defvr
4748
4749@defvr {Scheme Variable} ocaml-build-system
4750This variable is exported by @code{(guix build-system ocaml)}. It
4751implements a build procedure for @uref{https://ocaml.org, OCaml} packages,
4752which consists of choosing the correct set of commands to run for each
4753package. OCaml packages can expect many different commands to be run. This
4754build system will try some of them.
4755
4756When the package has a @file{setup.ml} file present at the top-level, it
4757will run @code{ocaml setup.ml -configure}, @code{ocaml setup.ml -build} and
4758@code{ocaml setup.ml -install}. The build system will assume that this file
4759was generated by @uref{http://oasis.forge.ocamlcore.org/, OASIS} and will
4760take care of setting the prefix and enabling tests if they are not
4761disabled. You can pass configure and build flags with the
4762@code{#:configure-flags} and @code{#:build-flags}. The @code{#:test-flags}
4763key can be passed to change the set of flags used to enable tests. The
4764@code{#:use-make?} key can be used to bypass this system in the build and
4765install phases.
4766
4767When the package has a @file{configure} file, it is assumed that it is a
4768hand-made configure script that requires a different argument format than in
4769the @code{gnu-build-system}. You can add more flags with the
4770@code{#:configure-flags} key.
4771
4772When the package has a @file{Makefile} file (or @code{#:use-make?} is
4773@code{#t}), it will be used and more flags can be passed to the build and
4774install phases with the @code{#:make-flags} key.
4775
4776Finally, some packages do not have these files and use a somewhat standard
4777location for its build system. In that case, the build system will run
4778@code{ocaml pkg/pkg.ml} or @code{ocaml pkg/build.ml} and take care of
4779providing the path to the required findlib module. Additional flags can be
4780passed via the @code{#:build-flags} key. Install is taken care of by
4781@command{opam-installer}. In this case, the @code{opam} package must be
4782added to the @code{native-inputs} field of the package definition.
4783
4784Note that most OCaml packages assume they will be installed in the same
4785directory as OCaml, which is not what we want in guix. In particular, they
4786will install @file{.so} files in their module's directory, which is usually
4787fine because it is in the OCaml compiler directory. In guix though, these
4788libraries cannot be found and we use @code{CAML_LD_LIBRARY_PATH}. This
4789variable points to @file{lib/ocaml/site-lib/stubslibs} and this is where
4790@file{.so} libraries should be installed.
4791@end defvr
4792
4793@defvr {Scheme Variable} python-build-system
4794This variable is exported by @code{(guix build-system python)}. It
4795implements the more or less standard build procedure used by Python
4796packages, which consists in running @code{python setup.py build} and then
4797@code{python setup.py install --prefix=/gnu/store/@dots{}}.
4798
4799For packages that install stand-alone Python programs under @code{bin/}, it
4800takes care of wrapping these programs so that their @code{PYTHONPATH}
4801environment variable points to all the Python libraries they depend on.
4802
4803Which Python package is used to perform the build can be specified with the
4804@code{#:python} parameter. This is a useful way to force a package to be
4805built for a specific version of the Python interpreter, which might be
4806necessary if the package is only compatible with a single interpreter
4807version.
4808
4809By default guix calls @code{setup.py} under control of @code{setuptools},
4810much like @command{pip} does. Some packages are not compatible with
4811setuptools (and pip), thus you can disable this by setting the
4812@code{#:use-setuptools} parameter to @code{#f}.
4813@end defvr
4814
4815@defvr {Scheme Variable} perl-build-system
4816This variable is exported by @code{(guix build-system perl)}. It implements
4817the standard build procedure for Perl packages, which either consists in
4818running @code{perl Build.PL --prefix=/gnu/store/@dots{}}, followed by
4819@code{Build} and @code{Build install}; or in running @code{perl Makefile.PL
4820PREFIX=/gnu/store/@dots{}}, followed by @code{make} and @code{make install},
4821depending on which of @code{Build.PL} or @code{Makefile.PL} is present in
4822the package distribution. Preference is given to the former if both
4823@code{Build.PL} and @code{Makefile.PL} exist in the package distribution.
4824This preference can be reversed by specifying @code{#t} for the
4825@code{#:make-maker?} parameter.
4826
4827The initial @code{perl Makefile.PL} or @code{perl Build.PL} invocation
4828passes flags specified by the @code{#:make-maker-flags} or
4829@code{#:module-build-flags} parameter, respectively.
4830
4831Which Perl package is used can be specified with @code{#:perl}.
4832@end defvr
4833
4834@defvr {Scheme Variable} r-build-system
4835This variable is exported by @code{(guix build-system r)}. It implements
4836the build procedure used by @uref{http://r-project.org, R} packages, which
4837essentially is little more than running @code{R CMD INSTALL
4838--library=/gnu/store/@dots{}} in an environment where @code{R_LIBS_SITE}
4839contains the paths to all R package inputs. Tests are run after
4840installation using the R function @code{tools::testInstalledPackage}.
4841@end defvr
4842
4843@defvr {Scheme Variable} texlive-build-system
4844This variable is exported by @code{(guix build-system texlive)}. It is used
4845to build TeX packages in batch mode with a specified engine. The build
4846system sets the @code{TEXINPUTS} variable to find all TeX source files in
4847the inputs.
4848
4849By default it runs @code{luatex} on all files ending on @code{ins}. A
4850different engine and format can be specified with the @code{#:tex-format}
4851argument. Different build targets can be specified with the
4852@code{#:build-targets} argument, which expects a list of file names. The
4853build system adds only @code{texlive-bin} and @code{texlive-latex-base}
4854(both from @code{(gnu packages tex}) to the inputs. Both can be overridden
4855with the arguments @code{#:texlive-bin} and @code{#:texlive-latex-base},
4856respectively.
4857
4858The @code{#:tex-directory} parameter tells the build system where to install
4859the built files under the texmf tree.
4860@end defvr
4861
4862@defvr {Scheme Variable} ruby-build-system
4863This variable is exported by @code{(guix build-system ruby)}. It implements
4864the RubyGems build procedure used by Ruby packages, which involves running
4865@code{gem build} followed by @code{gem install}.
4866
4867The @code{source} field of a package that uses this build system typically
4868references a gem archive, since this is the format that Ruby developers use
4869when releasing their software. The build system unpacks the gem archive,
4870potentially patches the source, runs the test suite, repackages the gem, and
4871installs it. Additionally, directories and tarballs may be referenced to
4872allow building unreleased gems from Git or a traditional source release
4873tarball.
4874
4875Which Ruby package is used can be specified with the @code{#:ruby}
4876parameter. A list of additional flags to be passed to the @command{gem}
4877command can be specified with the @code{#:gem-flags} parameter.
4878@end defvr
4879
4880@defvr {Scheme Variable} waf-build-system
4881This variable is exported by @code{(guix build-system waf)}. It implements
4882a build procedure around the @code{waf} script. The common
4883phases---@code{configure}, @code{build}, and @code{install}---are
4884implemented by passing their names as arguments to the @code{waf} script.
4885
4886The @code{waf} script is executed by the Python interpreter. Which Python
4887package is used to run the script can be specified with the @code{#:python}
4888parameter.
4889@end defvr
4890
4891@defvr {Scheme Variable} scons-build-system
4892This variable is exported by @code{(guix build-system scons)}. It
4893implements the build procedure used by the SCons software construction
4894tool. This build system runs @code{scons} to build the package, @code{scons
4895test} to run tests, and then @code{scons install} to install the package.
4896
4897Additional flags to be passed to @code{scons} can be specified with the
4898@code{#:scons-flags} parameter. The version of Python used to run SCons can
4899be specified by selecting the appropriate SCons package with the
4900@code{#:scons} parameter.
4901@end defvr
4902
4903@defvr {Scheme Variable} haskell-build-system
4904This variable is exported by @code{(guix build-system haskell)}. It
4905implements the Cabal build procedure used by Haskell packages, which
4906involves running @code{runhaskell Setup.hs configure
4907--prefix=/gnu/store/@dots{}} and @code{runhaskell Setup.hs build}. Instead
4908of installing the package by running @code{runhaskell Setup.hs install}, to
4909avoid trying to register libraries in the read-only compiler store
4910directory, the build system uses @code{runhaskell Setup.hs copy}, followed
4911by @code{runhaskell Setup.hs register}. In addition, the build system
4912generates the package documentation by running @code{runhaskell Setup.hs
4913haddock}, unless @code{#:haddock? #f} is passed. Optional Haddock
4914parameters can be passed with the help of the @code{#:haddock-flags}
4915parameter. If the file @code{Setup.hs} is not found, the build system looks
4916for @code{Setup.lhs} instead.
4917
4918Which Haskell compiler is used can be specified with the @code{#:haskell}
4919parameter which defaults to @code{ghc}.
4920@end defvr
4921
4922@defvr {Scheme Variable} dub-build-system
4923This variable is exported by @code{(guix build-system dub)}. It implements
4924the Dub build procedure used by D packages, which involves running @code{dub
4925build} and @code{dub run}. Installation is done by copying the files
4926manually.
4927
4928Which D compiler is used can be specified with the @code{#:ldc} parameter
4929which defaults to @code{ldc}.
4930@end defvr
4931
4932@defvr {Scheme Variable} emacs-build-system
4933This variable is exported by @code{(guix build-system emacs)}. It
4934implements an installation procedure similar to the packaging system of
4935Emacs itself (@pxref{Packages,,, emacs, The GNU Emacs Manual}).
4936
4937It first creates the @code{@var{package}-autoloads.el} file, then it byte
4938compiles all Emacs Lisp files. Differently from the Emacs packaging system,
4939the Info documentation files are moved to the standard documentation
4940directory and the @file{dir} file is deleted. Each package is installed in
4941its own directory under @file{share/emacs/site-lisp/guix.d}.
4942@end defvr
4943
4944@defvr {Scheme Variable} font-build-system
4945This variable is exported by @code{(guix build-system font)}. It implements
4946an installation procedure for font packages where upstream provides
793dcd8c 4947pre-compiled TrueType, OpenType, etc.@: font files that merely need to be
1e40e70b
JL
4948copied into place. It copies font files to standard locations in the output
4949directory.
4950@end defvr
4951
4952@defvr {Scheme Variable} meson-build-system
4953This variable is exported by @code{(guix build-system meson)}. It
4954implements the build procedure for packages that use
4955@url{http://mesonbuild.com, Meson} as their build system.
4956
4957It adds both Meson and @uref{https://ninja-build.org/, Ninja} to the set of
4958inputs, and they can be changed with the parameters @code{#:meson} and
4959@code{#:ninja} if needed. The default Meson is @code{meson-for-build},
4960which is special because it doesn't clear the @code{RUNPATH} of binaries and
4961libraries when they are installed.
4962
4963This build system is an extension of @var{gnu-build-system}, but with the
4964following phases changed to some specific for Meson:
4965
4966@table @code
4967
4968@item configure
4969The phase runs @code{meson} with the flags specified in
4970@code{#:configure-flags}. The flag @code{--build-type} is always set to
4971@code{plain} unless something else is specified in @code{#:build-type}.
4972
4973@item build
4974The phase runs @code{ninja} to build the package in parallel by default, but
4975this can be changed with @code{#:parallel-build?}.
4976
4977@item check
4978The phase runs @code{ninja} with the target specified in
4979@code{#:test-target}, which is @code{"test"} by default.
4980
4981@item install
4982The phase runs @code{ninja install} and can not be changed.
4983@end table
4984
4985Apart from that, the build system also adds the following phases:
4986
4987@table @code
4988
4989@item fix-runpath
4990This phase ensures that all binaries can find the libraries they need. It
4991searches for required libraries in subdirectories of the package being
4992built, and adds those to @code{RUNPATH} where needed. It also removes
4993references to libraries left over from the build phase by
4994@code{meson-for-build}, such as test dependencies, that aren't actually
4995required for the program to run.
4996
4997@item glib-or-gtk-wrap
4998This phase is the phase provided by @code{glib-or-gtk-build-system}, and it
4999is not enabled by default. It can be enabled with @code{#:glib-or-gtk?}.
5000
5001@item glib-or-gtk-compile-schemas
5002This phase is the phase provided by @code{glib-or-gtk-build-system}, and it
5003is not enabled by default. It can be enabled with @code{#:glib-or-gtk?}.
5004@end table
5005@end defvr
5006
5007Lastly, for packages that do not need anything as sophisticated, a
5008``trivial'' build system is provided. It is trivial in the sense that it
5009provides basically no support: it does not pull any implicit inputs, and
5010does not have a notion of build phases.
5011
5012@defvr {Scheme Variable} trivial-build-system
5013This variable is exported by @code{(guix build-system trivial)}.
5014
5015This build system requires a @code{#:builder} argument. This argument must
5016be a Scheme expression that builds the package output(s)---as with
5017@code{build-expression->derivation} (@pxref{Ableitungen,
5018@code{build-expression->derivation}}).
5019@end defvr
5020
5021@node Der Store
5022@section Der Store
5023
5024@cindex Store
5025@cindex store items
5026@cindex store paths
5027
5028Conceptually, the @dfn{store} is the place where derivations that have been
5029built successfully are stored---by default, @file{/gnu/store}.
5030Sub-directories in the store are referred to as @dfn{store items} or
5031sometimes @dfn{store paths}. The store has an associated database that
5032contains information such as the store paths referred to by each store path,
5033and the list of @emph{valid} store items---results of successful builds.
5034This database resides in @file{@var{localstatedir}/guix/db}, where
5035@var{localstatedir} is the state directory specified @i{via}
5036@option{--localstatedir} at configure time, usually @file{/var}.
5037
5038The store is @emph{always} accessed by the daemon on behalf of its clients
5039(@pxref{Aufruf des guix-daemon}). To manipulate the store, clients connect to
5040the daemon over a Unix-domain socket, send requests to it, and read the
5041result---these are remote procedure calls, or RPCs.
5042
5043@quotation Anmerkung
5044Users must @emph{never} modify files under @file{/gnu/store} directly. This
5045would lead to inconsistencies and break the immutability assumptions of
5046Guix's functional model (@pxref{Einführung}).
5047
5048@xref{Aufruf von guix gc, @command{guix gc --verify}}, for information on how
5049to check the integrity of the store and attempt recovery from accidental
5050modifications.
5051@end quotation
5052
5053The @code{(guix store)} module provides procedures to connect to the daemon,
5054and to perform RPCs. These are described below. By default,
5055@code{open-connection}, and thus all the @command{guix} commands, connect to
5056the local daemon or to the URI specified by the @code{GUIX_DAEMON_SOCKET}
5057environment variable.
5058
5059@defvr {Environment Variable} GUIX_DAEMON_SOCKET
5060When set, the value of this variable should be a file name or a URI
5061designating the daemon endpoint. When it is a file name, it denotes a
5062Unix-domain socket to connect to. In addition to file names, the supported
5063URI schemes are:
5064
5065@table @code
5066@item file
5067@itemx unix
5068These are for Unix-domain sockets.
5069@code{file:///var/guix/daemon-socket/socket} is equivalent to
5070@file{/var/guix/daemon-socket/socket}.
5071
5072@item guix
5073@cindex Daemon, Fernzugriff
5074@cindex Fernzugriff auf den Daemon
5075@cindex Daemon, Einrichten auf Clustern
5076@cindex Cluster, Einrichtung des Daemons
5077These URIs denote connections over TCP/IP, without encryption nor
5078authentication of the remote host. The URI must specify the host name and
5079optionally a port number (by default port 44146 is used):
5080
5081@example
5082guix://master.guix.example.org:1234
5083@end example
5084
5085This setup is suitable on local networks, such as clusters, where only
5086trusted nodes may connect to the build daemon at
5087@code{master.guix.example.org}.
5088
5089The @code{--listen} option of @command{guix-daemon} can be used to instruct
5090it to listen for TCP connections (@pxref{Aufruf des guix-daemon,
5091@code{--listen}}).
5092
5093@item ssh
5094@cindex SSH access to build daemons
5095These URIs allow you to connect to a remote daemon over SSH@footnote{This
5096feature requires Guile-SSH (@pxref{Voraussetzungen}).}. A typical URL might
5097look like this:
5098
5099@example
5100ssh://charlie@@guix.example.org:22
5101@end example
5102
5103As for @command{guix copy}, the usual OpenSSH client configuration files are
5104honored (@pxref{Aufruf von guix copy}).
5105@end table
5106
5107Additional URI schemes may be supported in the future.
5108
5109@c XXX: Remove this note when the protocol incurs fewer round trips
5110@c and when (guix derivations) no longer relies on file system access.
5111@quotation Anmerkung
5112The ability to connect to remote build daemons is considered experimental as
5113of @value{VERSION}. Please get in touch with us to share any problems or
5114suggestions you may have (@pxref{Mitwirken}).
5115@end quotation
5116@end defvr
5117
5118@deffn {Scheme Procedure} open-connection [@var{uri}] [#:reserve-space? #t]
5119Connect to the daemon over the Unix-domain socket at @var{uri} (a string).
5120When @var{reserve-space?} is true, instruct it to reserve a little bit of
5121extra space on the file system so that the garbage collector can still
5122operate should the disk become full. Return a server object.
5123
5124@var{file} defaults to @var{%default-socket-path}, which is the normal
5125location given the options that were passed to @command{configure}.
5126@end deffn
5127
5128@deffn {Scheme Procedure} close-connection @var{server}
5129Close the connection to @var{server}.
5130@end deffn
5131
5132@defvr {Scheme Variable} current-build-output-port
5133This variable is bound to a SRFI-39 parameter, which refers to the port
5134where build and error logs sent by the daemon should be written.
5135@end defvr
5136
5137Procedures that make RPCs all take a server object as their first argument.
5138
5139@deffn {Scheme Procedure} valid-path? @var{server} @var{path}
5140@cindex invalid store items
5141Return @code{#t} when @var{path} designates a valid store item and @code{#f}
5142otherwise (an invalid item may exist on disk but still be invalid, for
5143instance because it is the result of an aborted or failed build.)
5144
5145A @code{&nix-protocol-error} condition is raised if @var{path} is not
5146prefixed by the store directory (@file{/gnu/store}).
5147@end deffn
5148
5149@deffn {Scheme Procedure} add-text-to-store @var{server} @var{name} @var{text} [@var{references}]
5150Add @var{text} under file @var{name} in the store, and return its store
5151path. @var{references} is the list of store paths referred to by the
5152resulting store path.
5153@end deffn
5154
5155@deffn {Scheme Procedure} build-derivations @var{server} @var{derivations}
5156Build @var{derivations} (a list of @code{<derivation>} objects or derivation
5157paths), and return when the worker is done building them. Return @code{#t}
5158on success.
5159@end deffn
5160
5161Note that the @code{(guix monads)} module provides a monad as well as
5162monadic versions of the above procedures, with the goal of making it more
5163convenient to work with code that accesses the store (@pxref{Die Store-Monade}).
5164
5165@c FIXME
5166@i{This section is currently incomplete.}
5167
5168@node Ableitungen
5169@section Ableitungen
5170
5171@cindex derivations
5172Low-level build actions and the environment in which they are performed are
5173represented by @dfn{derivations}. A derivation contains the following
5174pieces of information:
5175
5176@itemize
5177@item
5178The outputs of the derivation---derivations produce at least one file or
5179directory in the store, but may produce more.
5180
5181@item
5182The inputs of the derivations, which may be other derivations or plain files
5183in the store (patches, build scripts, etc.)
5184
5185@item
5186The system type targeted by the derivation---e.g., @code{x86_64-linux}.
5187
5188@item
5189The file name of a build script in the store, along with the arguments to be
5190passed.
5191
5192@item
5193A list of environment variables to be defined.
5194
5195@end itemize
5196
5197@cindex derivation path
5198Derivations allow clients of the daemon to communicate build actions to the
5199store. They exist in two forms: as an in-memory representation, both on the
5200client- and daemon-side, and as files in the store whose name end in
5201@code{.drv}---these files are referred to as @dfn{derivation paths}.
5202Derivations paths can be passed to the @code{build-derivations} procedure to
5203perform the build actions they prescribe (@pxref{Der Store}).
5204
5205@cindex fixed-output derivations
5206Operations such as file downloads and version-control checkouts for which
5207the expected content hash is known in advance are modeled as
5208@dfn{fixed-output derivations}. Unlike regular derivations, the outputs of
5209a fixed-output derivation are independent of its inputs---e.g., a source
5210code download produces the same result regardless of the download method and
5211tools being used.
5212
5213The @code{(guix derivations)} module provides a representation of
5214derivations as Scheme objects, along with procedures to create and otherwise
5215manipulate derivations. The lowest-level primitive to create a derivation
5216is the @code{derivation} procedure:
5217
5218@deffn {Scheme Procedure} derivation @var{store} @var{name} @var{builder} @
5219 @var{args} [#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @ [#:recursive?
5220#f] [#:inputs '()] [#:env-vars '()] @ [#:system (%current-system)]
5221[#:references-graphs #f] @ [#:allowed-references #f]
5222[#:disallowed-references #f] @ [#:leaked-env-vars #f] [#:local-build? #f] @
793dcd8c
LC
5223[#:substitutable? #t] [#:properties '()] Build a derivation with the given
5224arguments, and return the resulting @code{<derivation>} object.
1e40e70b
JL
5225
5226When @var{hash} and @var{hash-algo} are given, a @dfn{fixed-output
5227derivation} is created---i.e., one whose result is known in advance, such as
5228a file download. If, in addition, @var{recursive?} is true, then that fixed
5229output may be an executable file or a directory and @var{hash} must be the
5230hash of an archive containing this output.
5231
5232When @var{references-graphs} is true, it must be a list of file name/store
5233path pairs. In that case, the reference graph of each store path is
5234exported in the build environment in the corresponding file, in a simple
5235text format.
5236
5237When @var{allowed-references} is true, it must be a list of store items or
5238outputs that the derivation's output may refer to. Likewise,
5239@var{disallowed-references}, if true, must be a list of things the outputs
5240may @emph{not} refer to.
5241
5242When @var{leaked-env-vars} is true, it must be a list of strings denoting
5243environment variables that are allowed to ``leak'' from the daemon's
5244environment to the build environment. This is only applicable to
5245fixed-output derivations---i.e., when @var{hash} is true. The main use is
5246to allow variables such as @code{http_proxy} to be passed to derivations
5247that download files.
5248
5249When @var{local-build?} is true, declare that the derivation is not a good
5250candidate for offloading and should rather be built locally (@pxref{Auslagern des Daemons einrichten}). This is the case for small derivations where the costs of
5251data transfers would outweigh the benefits.
5252
5253When @var{substitutable?} is false, declare that substitutes of the
5254derivation's output should not be used (@pxref{Substitute}). This is
5255useful, for instance, when building packages that capture details of the
5256host CPU instruction set.
793dcd8c
LC
5257
5258@var{properties} must be an association list describing ``properties'' of
5259the derivation. It is kept as-is, uninterpreted, in the derivation.
1e40e70b
JL
5260@end deffn
5261
5262@noindent
5263Here's an example with a shell script as its builder, assuming @var{store}
5264is an open connection to the daemon, and @var{bash} points to a Bash
5265executable in the store:
5266
5267@lisp
5268(use-modules (guix utils)
5269 (guix store)
5270 (guix derivations))
5271
5272(let ((builder ; add the Bash script to the store
5273 (add-text-to-store store "my-builder.sh"
5274 "echo hello world > $out\n" '())))
5275 (derivation store "foo"
5276 bash `("-e" ,builder)
5277 #:inputs `((,bash) (,builder))
5278 #:env-vars '(("HOME" . "/homeless"))))
5279@result{} #<derivation /gnu/store/@dots{}-foo.drv => /gnu/store/@dots{}-foo>
5280@end lisp
5281
5282As can be guessed, this primitive is cumbersome to use directly. A better
5283approach is to write build scripts in Scheme, of course! The best course of
5284action for that is to write the build code as a ``G-expression'', and to
5285pass it to @code{gexp->derivation}. For more information,
5286@pxref{G-Ausdrücke}.
5287
5288Once upon a time, @code{gexp->derivation} did not exist and constructing
5289derivations with build code written in Scheme was achieved with
5290@code{build-expression->derivation}, documented below. This procedure is
5291now deprecated in favor of the much nicer @code{gexp->derivation}.
5292
5293@deffn {Scheme Procedure} build-expression->derivation @var{store} @
5294 @var{name} @var{exp} @ [#:system (%current-system)] [#:inputs '()] @
5295[#:outputs '("out")] [#:hash #f] [#:hash-algo #f] @ [#:recursive? #f]
5296[#:env-vars '()] [#:modules '()] @ [#:references-graphs #f]
5297[#:allowed-references #f] @ [#:disallowed-references #f] @ [#:local-build?
5298#f] [#:substitutable? #t] [#:guile-for-build #f] Return a derivation that
5299executes Scheme expression @var{exp} as a builder for derivation
5300@var{name}. @var{inputs} must be a list of @code{(name drv-path sub-drv)}
5301tuples; when @var{sub-drv} is omitted, @code{"out"} is assumed.
5302@var{modules} is a list of names of Guile modules from the current search
5303path to be copied in the store, compiled, and made available in the load
5304path during the execution of @var{exp}---e.g., @code{((guix build utils)
5305(guix build gnu-build-system))}.
5306
5307@var{exp} is evaluated in an environment where @code{%outputs} is bound to a
5308list of output/path pairs, and where @code{%build-inputs} is bound to a list
5309of string/output-path pairs made from @var{inputs}. Optionally,
5310@var{env-vars} is a list of string pairs specifying the name and value of
5311environment variables visible to the builder. The builder terminates by
5312passing the result of @var{exp} to @code{exit}; thus, when @var{exp} returns
5313@code{#f}, the build is considered to have failed.
5314
5315@var{exp} is built using @var{guile-for-build} (a derivation). When
5316@var{guile-for-build} is omitted or is @code{#f}, the value of the
5317@code{%guile-for-build} fluid is used instead.
5318
5319See the @code{derivation} procedure for the meaning of
5320@var{references-graphs}, @var{allowed-references},
5321@var{disallowed-references}, @var{local-build?}, and @var{substitutable?}.
5322@end deffn
5323
5324@noindent
5325Here's an example of a single-output derivation that creates a directory
5326containing one file:
5327
5328@lisp
5329(let ((builder '(let ((out (assoc-ref %outputs "out")))
5330 (mkdir out) ; create /gnu/store/@dots{}-goo
5331 (call-with-output-file (string-append out "/test")
5332 (lambda (p)
5333 (display '(hello guix) p))))))
5334 (build-expression->derivation store "goo" builder))
5335
5336@result{} #<derivation /gnu/store/@dots{}-goo.drv => @dots{}>
5337@end lisp
5338
5339
5340@node Die Store-Monade
5341@section Die Store-Monade
5342
5343@cindex monad
5344
5345The procedures that operate on the store described in the previous sections
5346all take an open connection to the build daemon as their first argument.
5347Although the underlying model is functional, they either have side effects
5348or depend on the current state of the store.
5349
5350The former is inconvenient: the connection to the build daemon has to be
5351carried around in all those functions, making it impossible to compose
5352functions that do not take that parameter with functions that do. The
5353latter can be problematic: since store operations have side effects and/or
5354depend on external state, they have to be properly sequenced.
5355
5356@cindex monadic values
5357@cindex monadic functions
5358This is where the @code{(guix monads)} module comes in. This module
5359provides a framework for working with @dfn{monads}, and a particularly
5360useful monad for our uses, the @dfn{store monad}. Monads are a construct
5361that allows two things: associating ``context'' with values (in our case,
5362the context is the store), and building sequences of computations (here
5363computations include accesses to the store). Values in a monad---values
5364that carry this additional context---are called @dfn{monadic values};
5365procedures that return such values are called @dfn{monadic procedures}.
5366
5367Consider this ``normal'' procedure:
5368
5369@example
5370(define (sh-symlink store)
5371 ;; Return a derivation that symlinks the 'bash' executable.
5372 (let* ((drv (package-derivation store bash))
5373 (out (derivation->output-path drv))
5374 (sh (string-append out "/bin/bash")))
5375 (build-expression->derivation store "sh"
5376 `(symlink ,sh %output))))
5377@end example
5378
5379Using @code{(guix monads)} and @code{(guix gexp)}, it may be rewritten as a
5380monadic function:
5381
5382@example
5383(define (sh-symlink)
5384 ;; Same, but return a monadic value.
5385 (mlet %store-monad ((drv (package->derivation bash)))
5386 (gexp->derivation "sh"
5387 #~(symlink (string-append #$drv "/bin/bash")
5388 #$output))))
5389@end example
5390
5391There are several things to note in the second version: the @code{store}
5392parameter is now implicit and is ``threaded'' in the calls to the
5393@code{package->derivation} and @code{gexp->derivation} monadic procedures,
5394and the monadic value returned by @code{package->derivation} is @dfn{bound}
5395using @code{mlet} instead of plain @code{let}.
5396
5397As it turns out, the call to @code{package->derivation} can even be omitted
5398since it will take place implicitly, as we will see later
5399(@pxref{G-Ausdrücke}):
5400
5401@example
5402(define (sh-symlink)
5403 (gexp->derivation "sh"
5404 #~(symlink (string-append #$bash "/bin/bash")
5405 #$output)))
5406@end example
5407
5408@c See
5409@c <https://syntaxexclamation.wordpress.com/2014/06/26/escaping-continuations/>
5410@c for the funny quote.
5411Calling the monadic @code{sh-symlink} has no effect. As someone once said,
5412``you exit a monad like you exit a building on fire: by running''. So, to
5413exit the monad and get the desired effect, one must use
5414@code{run-with-store}:
5415
5416@example
5417(run-with-store (open-connection) (sh-symlink))
5418@result{} /gnu/store/...-sh-symlink
5419@end example
5420
5421Note that the @code{(guix monad-repl)} module extends the Guile REPL with
5422new ``meta-commands'' to make it easier to deal with monadic procedures:
5423@code{run-in-store}, and @code{enter-store-monad}. The former is used to
5424``run'' a single monadic value through the store:
5425
5426@example
5427scheme@@(guile-user)> ,run-in-store (package->derivation hello)
5428$1 = #<derivation /gnu/store/@dots{}-hello-2.9.drv => @dots{}>
5429@end example
5430
5431The latter enters a recursive REPL, where all the return values are
5432automatically run through the store:
5433
5434@example
5435scheme@@(guile-user)> ,enter-store-monad
5436store-monad@@(guile-user) [1]> (package->derivation hello)
5437$2 = #<derivation /gnu/store/@dots{}-hello-2.9.drv => @dots{}>
5438store-monad@@(guile-user) [1]> (text-file "foo" "Hello!")
5439$3 = "/gnu/store/@dots{}-foo"
5440store-monad@@(guile-user) [1]> ,q
5441scheme@@(guile-user)>
5442@end example
5443
5444@noindent
5445Note that non-monadic values cannot be returned in the @code{store-monad}
5446REPL.
5447
5448The main syntactic forms to deal with monads in general are provided by the
5449@code{(guix monads)} module and are described below.
5450
5451@deffn {Scheme Syntax} with-monad @var{monad} @var{body} ...
5452Evaluate any @code{>>=} or @code{return} forms in @var{body} as being in
5453@var{monad}.
5454@end deffn
5455
5456@deffn {Scheme Syntax} return @var{val}
5457Return a monadic value that encapsulates @var{val}.
5458@end deffn
5459
5460@deffn {Scheme Syntax} >>= @var{mval} @var{mproc} ...
5461@dfn{Bind} monadic value @var{mval}, passing its ``contents'' to monadic
5462procedures @var{mproc}@dots{}@footnote{This operation is commonly referred
5463to as ``bind'', but that name denotes an unrelated procedure in Guile. Thus
5464we use this somewhat cryptic symbol inherited from the Haskell language.}.
5465There can be one @var{mproc} or several of them, as in this example:
5466
5467@example
5468(run-with-state
5469 (with-monad %state-monad
5470 (>>= (return 1)
5471 (lambda (x) (return (+ 1 x)))
5472 (lambda (x) (return (* 2 x)))))
5473 'some-state)
5474
5475@result{} 4
5476@result{} some-state
5477@end example
5478@end deffn
5479
5480@deffn {Scheme Syntax} mlet @var{monad} ((@var{var} @var{mval}) ...) @
5481 @var{body} ...
5482@deffnx {Scheme Syntax} mlet* @var{monad} ((@var{var} @var{mval}) ...) @
5483 @var{body} ... Bind the variables @var{var} to the monadic values
5484@var{mval} in @var{body}, which is a sequence of expressions. As with the
5485bind operator, this can be thought of as ``unpacking'' the raw, non-monadic
5486value ``contained'' in @var{mval} and making @var{var} refer to that raw,
5487non-monadic value within the scope of the @var{body}. The form (@var{var}
5488-> @var{val}) binds @var{var} to the ``normal'' value @var{val}, as per
5489@code{let}. The binding operations occur in sequence from left to right.
5490The last expression of @var{body} must be a monadic expression, and its
5491result will become the result of the @code{mlet} or @code{mlet*} when run in
5492the @var{monad}.
5493
5494@code{mlet*} is to @code{mlet} what @code{let*} is to @code{let}
5495(@pxref{Local Bindings,,, guile, GNU Guile Reference Manual}).
5496@end deffn
5497
5498@deffn {Scheme System} mbegin @var{monad} @var{mexp} ...
5499Bind @var{mexp} and the following monadic expressions in sequence, returning
5500the result of the last expression. Every expression in the sequence must be
5501a monadic expression.
5502
5503This is akin to @code{mlet}, except that the return values of the monadic
5504expressions are ignored. In that sense, it is analogous to @code{begin},
5505but applied to monadic expressions.
5506@end deffn
5507
5508@deffn {Scheme System} mwhen @var{condition} @var{mexp0} @var{mexp*} ...
5509When @var{condition} is true, evaluate the sequence of monadic expressions
5510@var{mexp0}..@var{mexp*} as in an @code{mbegin}. When @var{condition} is
5511false, return @code{*unspecified*} in the current monad. Every expression
5512in the sequence must be a monadic expression.
5513@end deffn
5514
5515@deffn {Scheme System} munless @var{condition} @var{mexp0} @var{mexp*} ...
5516When @var{condition} is false, evaluate the sequence of monadic expressions
5517@var{mexp0}..@var{mexp*} as in an @code{mbegin}. When @var{condition} is
5518true, return @code{*unspecified*} in the current monad. Every expression in
5519the sequence must be a monadic expression.
5520@end deffn
5521
5522@cindex state monad
5523The @code{(guix monads)} module provides the @dfn{state monad}, which allows
5524an additional value---the state---to be @emph{threaded} through monadic
5525procedure calls.
5526
5527@defvr {Scheme Variable} %state-monad
5528The state monad. Procedures in the state monad can access and change the
5529state that is threaded.
5530
5531Consider the example below. The @code{square} procedure returns a value in
5532the state monad. It returns the square of its argument, but also increments
5533the current state value:
5534
5535@example
5536(define (square x)
5537 (mlet %state-monad ((count (current-state)))
5538 (mbegin %state-monad
5539 (set-current-state (+ 1 count))
5540 (return (* x x)))))
5541
5542(run-with-state (sequence %state-monad (map square (iota 3))) 0)
5543@result{} (0 1 4)
5544@result{} 3
5545@end example
5546
5547When ``run'' through @var{%state-monad}, we obtain that additional state
5548value, which is the number of @code{square} calls.
5549@end defvr
5550
5551@deffn {Monadic Procedure} current-state
5552Return the current state as a monadic value.
5553@end deffn
5554
5555@deffn {Monadic Procedure} set-current-state @var{value}
5556Set the current state to @var{value} and return the previous state as a
5557monadic value.
5558@end deffn
5559
5560@deffn {Monadic Procedure} state-push @var{value}
5561Push @var{value} to the current state, which is assumed to be a list, and
5562return the previous state as a monadic value.
5563@end deffn
5564
5565@deffn {Monadic Procedure} state-pop
5566Pop a value from the current state and return it as a monadic value. The
5567state is assumed to be a list.
5568@end deffn
5569
5570@deffn {Scheme Procedure} run-with-state @var{mval} [@var{state}]
5571Run monadic value @var{mval} starting with @var{state} as the initial
5572state. Return two values: the resulting value, and the resulting state.
5573@end deffn
5574
5575The main interface to the store monad, provided by the @code{(guix store)}
5576module, is as follows.
5577
5578@defvr {Scheme Variable} %store-monad
5579The store monad---an alias for @var{%state-monad}.
5580
5581Values in the store monad encapsulate accesses to the store. When its
5582effect is needed, a value of the store monad must be ``evaluated'' by
5583passing it to the @code{run-with-store} procedure (see below.)
5584@end defvr
5585
5586@deffn {Scheme Procedure} run-with-store @var{store} @var{mval} [#:guile-for-build] [#:system (%current-system)]
5587Run @var{mval}, a monadic value in the store monad, in @var{store}, an open
5588store connection.
5589@end deffn
5590
5591@deffn {Monadic Procedure} text-file @var{name} @var{text} [@var{references}]
5592Return as a monadic value the absolute file name in the store of the file
5593containing @var{text}, a string. @var{references} is a list of store items
5594that the resulting text file refers to; it defaults to the empty list.
5595@end deffn
5596
5597@deffn {Monadic Procedure} binary-file @var{name} @var{data} [@var{references}]
5598Return as a monadic value the absolute file name in the store of the file
5599containing @var{data}, a bytevector. @var{references} is a list of store
5600items that the resulting binary file refers to; it defaults to the empty
5601list.
5602@end deffn
5603
5604@deffn {Monadic Procedure} interned-file @var{file} [@var{name}] @
5605 [#:recursive? #t] [#:select? (const #t)] Return the name of @var{file} once
5606interned in the store. Use @var{name} as its store name, or the basename of
5607@var{file} if @var{name} is omitted.
5608
5609When @var{recursive?} is true, the contents of @var{file} are added
5610recursively; if @var{file} designates a flat file and @var{recursive?} is
5611true, its contents are added, and its permission bits are kept.
5612
5613When @var{recursive?} is true, call @code{(@var{select?} @var{file}
5614@var{stat})} for each directory entry, where @var{file} is the entry's
5615absolute file name and @var{stat} is the result of @code{lstat}; exclude
5616entries for which @var{select?} does not return true.
5617
5618The example below adds a file to the store, under two different names:
5619
5620@example
5621(run-with-store (open-connection)
5622 (mlet %store-monad ((a (interned-file "README"))
5623 (b (interned-file "README" "LEGU-MIN")))
5624 (return (list a b))))
5625
5626@result{} ("/gnu/store/rwm@dots{}-README" "/gnu/store/44i@dots{}-LEGU-MIN")
5627@end example
5628
5629@end deffn
5630
5631The @code{(guix packages)} module exports the following package-related
5632monadic procedures:
5633
5634@deffn {Monadic Procedure} package-file @var{package} [@var{file}] @
5635 [#:system (%current-system)] [#:target #f] @ [#:output "out"] Return as a
5636monadic value in the absolute file name of @var{file} within the
5637@var{output} directory of @var{package}. When @var{file} is omitted, return
5638the name of the @var{output} directory of @var{package}. When @var{target}
5639is true, use it as a cross-compilation target triplet.
5640@end deffn
5641
5642@deffn {Monadic Procedure} package->derivation @var{package} [@var{system}]
5643@deffnx {Monadic Procedure} package->cross-derivation @var{package} @
5644 @var{target} [@var{system}] Monadic version of @code{package-derivation} and
5645@code{package-cross-derivation} (@pxref{Pakete definieren}).
5646@end deffn
5647
5648
5649@node G-Ausdrücke
5650@section G-Ausdrücke
5651
5652@cindex G-expression
5653@cindex build code quoting
5654So we have ``derivations'', which represent a sequence of build actions to
5655be performed to produce an item in the store (@pxref{Ableitungen}). These
5656build actions are performed when asking the daemon to actually build the
5657derivations; they are run by the daemon in a container (@pxref{Aufruf des guix-daemon}).
5658
5659@cindex strata of code
5660It should come as no surprise that we like to write these build actions in
5661Scheme. When we do that, we end up with two @dfn{strata} of Scheme
5662code@footnote{The term @dfn{stratum} in this context was coined by Manuel
5663Serrano et al.@: in the context of their work on Hop. Oleg Kiselyov, who
5664has written insightful
5665@url{http://okmij.org/ftp/meta-programming/#meta-scheme, essays and code on
5666this topic}, refers to this kind of code generation as @dfn{staging}.}: the
5667``host code''---code that defines packages, talks to the daemon, etc.---and
5668the ``build code''---code that actually performs build actions, such as
5669making directories, invoking @command{make}, etc.
5670
5671To describe a derivation and its build actions, one typically needs to embed
5672build code inside host code. It boils down to manipulating build code as
5673data, and the homoiconicity of Scheme---code has a direct representation as
5674data---comes in handy for that. But we need more than the normal
5675@code{quasiquote} mechanism in Scheme to construct build expressions.
5676
5677The @code{(guix gexp)} module implements @dfn{G-expressions}, a form of
5678S-expressions adapted to build expressions. G-expressions, or @dfn{gexps},
5679consist essentially of three syntactic forms: @code{gexp}, @code{ungexp},
5680and @code{ungexp-splicing} (or simply: @code{#~}, @code{#$}, and
5681@code{#$@@}), which are comparable to @code{quasiquote}, @code{unquote}, and
5682@code{unquote-splicing}, respectively (@pxref{Expression Syntax,
5683@code{quasiquote},, guile, GNU Guile Reference Manual}). However, there are
5684major differences:
5685
5686@itemize
5687@item
5688Gexps are meant to be written to a file and run or manipulated by other
5689processes.
5690
5691@item
5692When a high-level object such as a package or derivation is unquoted inside
5693a gexp, the result is as if its output file name had been introduced.
5694
5695@item
5696Gexps carry information about the packages or derivations they refer to, and
5697these dependencies are automatically added as inputs to the build processes
5698that use them.
5699@end itemize
5700
5701@cindex lowering, of high-level objects in gexps
5702This mechanism is not limited to package and derivation objects:
5703@dfn{compilers} able to ``lower'' other high-level objects to derivations or
5704files in the store can be defined, such that these objects can also be
5705inserted into gexps. For example, a useful type of high-level objects that
5706can be inserted in a gexp is ``file-like objects'', which make it easy to
5707add files to the store and to refer to them in derivations and such (see
5708@code{local-file} and @code{plain-file} below.)
5709
5710To illustrate the idea, here is an example of a gexp:
5711
5712@example
5713(define build-exp
5714 #~(begin
5715 (mkdir #$output)
5716 (chdir #$output)
5717 (symlink (string-append #$coreutils "/bin/ls")
5718 "list-files")))
5719@end example
5720
5721This gexp can be passed to @code{gexp->derivation}; we obtain a derivation
5722that builds a directory containing exactly one symlink to
5723@file{/gnu/store/@dots{}-coreutils-8.22/bin/ls}:
5724
5725@example
5726(gexp->derivation "the-thing" build-exp)
5727@end example
5728
5729As one would expect, the @code{"/gnu/store/@dots{}-coreutils-8.22"} string
5730is substituted to the reference to the @var{coreutils} package in the actual
5731build code, and @var{coreutils} is automatically made an input to the
5732derivation. Likewise, @code{#$output} (equivalent to @code{(ungexp
5733output)}) is replaced by a string containing the directory name of the
5734output of the derivation.
5735
5736@cindex cross compilation
5737In a cross-compilation context, it is useful to distinguish between
5738references to the @emph{native} build of a package---that can run on the
5739host---versus references to cross builds of a package. To that end, the
5740@code{#+} plays the same role as @code{#$}, but is a reference to a native
5741package build:
5742
5743@example
5744(gexp->derivation "vi"
5745 #~(begin
5746 (mkdir #$output)
5747 (system* (string-append #+coreutils "/bin/ln")
5748 "-s"
5749 (string-append #$emacs "/bin/emacs")
5750 (string-append #$output "/bin/vi")))
5751 #:target "mips64el-linux-gnu")
5752@end example
5753
5754@noindent
5755In the example above, the native build of @var{coreutils} is used, so that
5756@command{ln} can actually run on the host; but then the cross-compiled build
5757of @var{emacs} is referenced.
5758
5759@cindex imported modules, for gexps
5760@findex with-imported-modules
5761Another gexp feature is @dfn{imported modules}: sometimes you want to be
5762able to use certain Guile modules from the ``host environment'' in the gexp,
5763so those modules should be imported in the ``build environment''. The
5764@code{with-imported-modules} form allows you to express that:
5765
5766@example
5767(let ((build (with-imported-modules '((guix build utils))
5768 #~(begin
5769 (use-modules (guix build utils))
5770 (mkdir-p (string-append #$output "/bin"))))))
5771 (gexp->derivation "empty-dir"
5772 #~(begin
5773 #$build
5774 (display "success!\n")
5775 #t)))
5776@end example
5777
5778@noindent
5779In this example, the @code{(guix build utils)} module is automatically
5780pulled into the isolated build environment of our gexp, such that
5781@code{(use-modules (guix build utils))} works as expected.
5782
5783@cindex module closure
5784@findex source-module-closure
5785Usually you want the @emph{closure} of the module to be imported---i.e., the
5786module itself and all the modules it depends on---rather than just the
5787module; failing to do that, attempts to use the module will fail because of
5788missing dependent modules. The @code{source-module-closure} procedure
5789computes the closure of a module by looking at its source file headers,
5790which comes in handy in this case:
5791
5792@example
5793(use-modules (guix modules)) ;for 'source-module-closure'
5794
5795(with-imported-modules (source-module-closure
5796 '((guix build utils)
5797 (gnu build vm)))
5798 (gexp->derivation "something-with-vms"
5799 #~(begin
5800 (use-modules (guix build utils)
5801 (gnu build vm))
5802 @dots{})))
5803@end example
5804
5805@cindex extensions, for gexps
5806@findex with-extensions
5807In the same vein, sometimes you want to import not just pure-Scheme modules,
5808but also ``extensions'' such as Guile bindings to C libraries or other
5809``full-blown'' packages. Say you need the @code{guile-json} package
5810available on the build side, here's how you would do it:
5811
5812@example
5813(use-modules (gnu packages guile)) ;for 'guile-json'
5814
5815(with-extensions (list guile-json)
5816 (gexp->derivation "something-with-json"
5817 #~(begin
5818 (use-modules (json))
5819 @dots{})))
5820@end example
5821
5822The syntactic form to construct gexps is summarized below.
5823
5824@deffn {Scheme Syntax} #~@var{exp}
5825@deffnx {Scheme Syntax} (gexp @var{exp})
5826Return a G-expression containing @var{exp}. @var{exp} may contain one or
5827more of the following forms:
5828
5829@table @code
5830@item #$@var{obj}
5831@itemx (ungexp @var{obj})
5832Introduce a reference to @var{obj}. @var{obj} may have one of the supported
5833types, for example a package or a derivation, in which case the
5834@code{ungexp} form is replaced by its output file name---e.g.,
5835@code{"/gnu/store/@dots{}-coreutils-8.22}.
5836
5837If @var{obj} is a list, it is traversed and references to supported objects
5838are substituted similarly.
5839
5840If @var{obj} is another gexp, its contents are inserted and its dependencies
5841are added to those of the containing gexp.
5842
5843If @var{obj} is another kind of object, it is inserted as is.
5844
5845@item #$@var{obj}:@var{output}
5846@itemx (ungexp @var{obj} @var{output})
5847This is like the form above, but referring explicitly to the @var{output} of
5848@var{obj}---this is useful when @var{obj} produces multiple outputs
5849(@pxref{Pakete mit mehreren Ausgaben.}).
5850
5851@item #+@var{obj}
5852@itemx #+@var{obj}:output
5853@itemx (ungexp-native @var{obj})
5854@itemx (ungexp-native @var{obj} @var{output})
5855Same as @code{ungexp}, but produces a reference to the @emph{native} build
5856of @var{obj} when used in a cross compilation context.
5857
5858@item #$output[:@var{output}]
5859@itemx (ungexp output [@var{output}])
5860Insert a reference to derivation output @var{output}, or to the main output
5861when @var{output} is omitted.
5862
5863This only makes sense for gexps passed to @code{gexp->derivation}.
5864
5865@item #$@@@var{lst}
5866@itemx (ungexp-splicing @var{lst})
5867Like the above, but splices the contents of @var{lst} inside the containing
5868list.
5869
5870@item #+@@@var{lst}
5871@itemx (ungexp-native-splicing @var{lst})
5872Like the above, but refers to native builds of the objects listed in
5873@var{lst}.
5874
5875@end table
5876
5877G-expressions created by @code{gexp} or @code{#~} are run-time objects of
5878the @code{gexp?} type (see below.)
5879@end deffn
5880
5881@deffn {Scheme Syntax} with-imported-modules @var{modules} @var{body}@dots{}
5882Mark the gexps defined in @var{body}@dots{} as requiring @var{modules} in
5883their execution environment.
5884
5885Each item in @var{modules} can be the name of a module, such as @code{(guix
5886build utils)}, or it can be a module name, followed by an arrow, followed by
5887a file-like object:
5888
5889@example
5890`((guix build utils)
5891 (guix gcrypt)
5892 ((guix config) => ,(scheme-file "config.scm"
5893 #~(define-module @dots{}))))
5894@end example
5895
5896@noindent
5897In the example above, the first two modules are taken from the search path,
5898and the last one is created from the given file-like object.
5899
5900This form has @emph{lexical} scope: it has an effect on the gexps directly
5901defined in @var{body}@dots{}, but not on those defined, say, in procedures
5902called from @var{body}@dots{}.
5903@end deffn
5904
5905@deffn {Scheme Syntax} with-extensions @var{extensions} @var{body}@dots{}
5906Mark the gexps defined in @var{body}@dots{} as requiring @var{extensions} in
5907their build and execution environment. @var{extensions} is typically a list
5908of package objects such as those defined in the @code{(gnu packages guile)}
5909module.
5910
5911Concretely, the packages listed in @var{extensions} are added to the load
5912path while compiling imported modules in @var{body}@dots{}; they are also
5913added to the load path of the gexp returned by @var{body}@dots{}.
5914@end deffn
5915
5916@deffn {Scheme Procedure} gexp? @var{obj}
5917Return @code{#t} if @var{obj} is a G-expression.
5918@end deffn
5919
5920G-expressions are meant to be written to disk, either as code building some
5921derivation, or as plain files in the store. The monadic procedures below
5922allow you to do that (@pxref{Die Store-Monade}, for more information about
5923monads.)
5924
5925@deffn {Monadic Procedure} gexp->derivation @var{name} @var{exp} @
5926 [#:system (%current-system)] [#:target #f] [#:graft? #t] @ [#:hash #f]
5927[#:hash-algo #f] @ [#:recursive? #f] [#:env-vars '()] [#:modules '()] @
5928[#:module-path @var{%load-path}] @ [#:effective-version "2.2"] @
5929[#:references-graphs #f] [#:allowed-references #f] @
5930[#:disallowed-references #f] @ [#:leaked-env-vars #f] @ [#:script-name
5931(string-append @var{name} "-builder")] @ [#:deprecation-warnings #f] @
793dcd8c
LC
5932[#:local-build? #f] [#:substitutable? #t] @ [#:properties '()]
5933[#:guile-for-build #f] Return a derivation @var{name} that runs @var{exp} (a
5934gexp) with @var{guile-for-build} (a derivation) on @var{system}; @var{exp}
5935is stored in a file called @var{script-name}. When @var{target} is true, it
5936is used as the cross-compilation target triplet for packages referred to by
5937@var{exp}.
1e40e70b
JL
5938
5939@var{modules} is deprecated in favor of @code{with-imported-modules}. Its
5940meaning is to make @var{modules} available in the evaluation context of
5941@var{exp}; @var{modules} is a list of names of Guile modules searched in
5942@var{module-path} to be copied in the store, compiled, and made available in
5943the load path during the execution of @var{exp}---e.g., @code{((guix build
5944utils) (guix build gnu-build-system))}.
5945
5946@var{effective-version} determines the string to use when adding extensions
5947of @var{exp} (see @code{with-extensions}) to the search path---e.g.,
5948@code{"2.2"}.
5949
5950@var{graft?} determines whether packages referred to by @var{exp} should be
5951grafted when applicable.
5952
5953When @var{references-graphs} is true, it must be a list of tuples of one of
5954the following forms:
5955
5956@example
5957(@var{file-name} @var{package})
5958(@var{file-name} @var{package} @var{output})
5959(@var{file-name} @var{derivation})
5960(@var{file-name} @var{derivation} @var{output})
5961(@var{file-name} @var{store-item})
5962@end example
5963
5964The right-hand-side of each element of @var{references-graphs} is
5965automatically made an input of the build process of @var{exp}. In the build
5966environment, each @var{file-name} contains the reference graph of the
5967corresponding item, in a simple text format.
5968
5969@var{allowed-references} must be either @code{#f} or a list of output names
5970and packages. In the latter case, the list denotes store items that the
5971result is allowed to refer to. Any reference to another store item will
5972lead to a build error. Similarly for @var{disallowed-references}, which can
5973list items that must not be referenced by the outputs.
5974
5975@var{deprecation-warnings} determines whether to show deprecation warnings
5976while compiling modules. It can be @code{#f}, @code{#t}, or
5977@code{'detailed}.
5978
5979The other arguments are as for @code{derivation} (@pxref{Ableitungen}).
5980@end deffn
5981
5982@cindex file-like objects
5983The @code{local-file}, @code{plain-file}, @code{computed-file},
5984@code{program-file}, and @code{scheme-file} procedures below return
5985@dfn{file-like objects}. That is, when unquoted in a G-expression, these
5986objects lead to a file in the store. Consider this G-expression:
5987
5988@example
5989#~(system* #$(file-append glibc "/sbin/nscd") "-f"
5990 #$(local-file "/tmp/my-nscd.conf"))
5991@end example
5992
5993The effect here is to ``intern'' @file{/tmp/my-nscd.conf} by copying it to
5994the store. Once expanded, for instance @i{via} @code{gexp->derivation}, the
5995G-expression refers to that copy under @file{/gnu/store}; thus, modifying or
5996removing the file in @file{/tmp} does not have any effect on what the
5997G-expression does. @code{plain-file} can be used similarly; it differs in
5998that the file content is directly passed as a string.
5999
6000@deffn {Scheme Procedure} local-file @var{file} [@var{name}] @
6001 [#:recursive? #f] [#:select? (const #t)] Return an object representing local
6002file @var{file} to add to the store; this object can be used in a gexp. If
6003@var{file} is a relative file name, it is looked up relative to the source
6004file where this form appears. @var{file} will be added to the store under
6005@var{name}--by default the base name of @var{file}.
6006
6007When @var{recursive?} is true, the contents of @var{file} are added
6008recursively; if @var{file} designates a flat file and @var{recursive?} is
6009true, its contents are added, and its permission bits are kept.
6010
6011When @var{recursive?} is true, call @code{(@var{select?} @var{file}
6012@var{stat})} for each directory entry, where @var{file} is the entry's
6013absolute file name and @var{stat} is the result of @code{lstat}; exclude
6014entries for which @var{select?} does not return true.
6015
6016This is the declarative counterpart of the @code{interned-file} monadic
6017procedure (@pxref{Die Store-Monade, @code{interned-file}}).
6018@end deffn
6019
6020@deffn {Scheme Procedure} plain-file @var{name} @var{content}
6021Return an object representing a text file called @var{name} with the given
6022@var{content} (a string or a bytevector) to be added to the store.
6023
6024This is the declarative counterpart of @code{text-file}.
6025@end deffn
6026
6027@deffn {Scheme Procedure} computed-file @var{name} @var{gexp} @
6028 [#:options '(#:local-build? #t)] Return an object representing the store
6029item @var{name}, a file or directory computed by @var{gexp}. @var{options}
6030is a list of additional arguments to pass to @code{gexp->derivation}.
6031
6032This is the declarative counterpart of @code{gexp->derivation}.
6033@end deffn
6034
6035@deffn {Monadic Procedure} gexp->script @var{name} @var{exp} @
6036 [#:guile (default-guile)] [#:module-path %load-path] Return an executable
6037script @var{name} that runs @var{exp} using @var{guile}, with @var{exp}'s
6038imported modules in its search path. Look up @var{exp}'s modules in
6039@var{module-path}.
6040
6041The example below builds a script that simply invokes the @command{ls}
6042command:
6043
6044@example
6045(use-modules (guix gexp) (gnu packages base))
6046
6047(gexp->script "list-files"
6048 #~(execl #$(file-append coreutils "/bin/ls")
6049 "ls"))
6050@end example
6051
6052When ``running'' it through the store (@pxref{Die Store-Monade,
6053@code{run-with-store}}), we obtain a derivation that produces an executable
6054file @file{/gnu/store/@dots{}-list-files} along these lines:
6055
6056@example
6057#!/gnu/store/@dots{}-guile-2.0.11/bin/guile -ds
6058!#
6059(execl "/gnu/store/@dots{}-coreutils-8.22"/bin/ls" "ls")
6060@end example
6061@end deffn
6062
6063@deffn {Scheme Procedure} program-file @var{name} @var{exp} @
6064 [#:guile #f] [#:module-path %load-path] Return an object representing the
6065executable store item @var{name} that runs @var{gexp}. @var{guile} is the
6066Guile package used to execute that script. Imported modules of @var{gexp}
6067are looked up in @var{module-path}.
6068
6069This is the declarative counterpart of @code{gexp->script}.
6070@end deffn
6071
6072@deffn {Monadic Procedure} gexp->file @var{name} @var{exp} @
6073 [#:set-load-path? #t] [#:module-path %load-path] @ [#:splice? #f] @ [#:guile
6074(default-guile)] Return a derivation that builds a file @var{name}
6075containing @var{exp}. When @var{splice?} is true, @var{exp} is considered
6076to be a list of expressions that will be spliced in the resulting file.
6077
6078When @var{set-load-path?} is true, emit code in the resulting file to set
6079@code{%load-path} and @code{%load-compiled-path} to honor @var{exp}'s
6080imported modules. Look up @var{exp}'s modules in @var{module-path}.
6081
6082The resulting file holds references to all the dependencies of @var{exp} or
6083a subset thereof.
6084@end deffn
6085
6086@deffn {Scheme Procedure} scheme-file @var{name} @var{exp} [#:splice? #f]
6087Return an object representing the Scheme file @var{name} that contains
6088@var{exp}.
6089
6090This is the declarative counterpart of @code{gexp->file}.
6091@end deffn
6092
6093@deffn {Monadic Procedure} text-file* @var{name} @var{text} @dots{}
6094Return as a monadic value a derivation that builds a text file containing
6095all of @var{text}. @var{text} may list, in addition to strings, objects of
6096any type that can be used in a gexp: packages, derivations, local file
6097objects, etc. The resulting store file holds references to all these.
6098
6099This variant should be preferred over @code{text-file} anytime the file to
6100create will reference items from the store. This is typically the case when
6101building a configuration file that embeds store file names, like this:
6102
6103@example
6104(define (profile.sh)
6105 ;; Return the name of a shell script in the store that
6106 ;; initializes the 'PATH' environment variable.
6107 (text-file* "profile.sh"
6108 "export PATH=" coreutils "/bin:"
6109 grep "/bin:" sed "/bin\n"))
6110@end example
6111
6112In this example, the resulting @file{/gnu/store/@dots{}-profile.sh} file
6113will reference @var{coreutils}, @var{grep}, and @var{sed}, thereby
6114preventing them from being garbage-collected during its lifetime.
6115@end deffn
6116
6117@deffn {Scheme Procedure} mixed-text-file @var{name} @var{text} @dots{}
6118Return an object representing store file @var{name} containing @var{text}.
6119@var{text} is a sequence of strings and file-like objects, as in:
6120
6121@example
6122(mixed-text-file "profile"
6123 "export PATH=" coreutils "/bin:" grep "/bin")
6124@end example
6125
6126This is the declarative counterpart of @code{text-file*}.
6127@end deffn
6128
6129@deffn {Scheme Procedure} file-union @var{name} @var{files}
6130Return a @code{<computed-file>} that builds a directory containing all of
6131@var{files}. Each item in @var{files} must be a two-element list where the
6132first element is the file name to use in the new directory, and the second
6133element is a gexp denoting the target file. Here's an example:
6134
6135@example
6136(file-union "etc"
6137 `(("hosts" ,(plain-file "hosts"
6138 "127.0.0.1 localhost"))
6139 ("bashrc" ,(plain-file "bashrc"
6140 "alias ls='ls --color=auto'"))))
6141@end example
6142
6143This yields an @code{etc} directory containing these two files.
6144@end deffn
6145
6146@deffn {Scheme Procedure} directory-union @var{name} @var{things}
6147Return a directory that is the union of @var{things}, where @var{things} is
6148a list of file-like objects denoting directories. For example:
6149
6150@example
6151(directory-union "guile+emacs" (list guile emacs))
6152@end example
6153
6154yields a directory that is the union of the @code{guile} and @code{emacs}
6155packages.
6156@end deffn
6157
6158@deffn {Scheme Procedure} file-append @var{obj} @var{suffix} @dots{}
6159Return a file-like object that expands to the concatenation of @var{obj} and
6160@var{suffix}, where @var{obj} is a lowerable object and each @var{suffix} is
6161a string.
6162
6163As an example, consider this gexp:
6164
6165@example
6166(gexp->script "run-uname"
6167 #~(system* #$(file-append coreutils
6168 "/bin/uname")))
6169@end example
6170
6171The same effect could be achieved with:
6172
6173@example
6174(gexp->script "run-uname"
6175 #~(system* (string-append #$coreutils
6176 "/bin/uname")))
6177@end example
6178
6179There is one difference though: in the @code{file-append} case, the
6180resulting script contains the absolute file name as a string, whereas in the
6181second case, the resulting script contains a @code{(string-append @dots{})}
6182expression to construct the file name @emph{at run time}.
6183@end deffn
6184
6185
6186Of course, in addition to gexps embedded in ``host'' code, there are also
6187modules containing build tools. To make it clear that they are meant to be
6188used in the build stratum, these modules are kept in the @code{(guix build
6189@dots{})} name space.
6190
6191@cindex lowering, of high-level objects in gexps
6192Internally, high-level objects are @dfn{lowered}, using their compiler, to
6193either derivations or store items. For instance, lowering a package yields
6194a derivation, and lowering a @code{plain-file} yields a store item. This is
6195achieved using the @code{lower-object} monadic procedure.
6196
6197@deffn {Monadic Procedure} lower-object @var{obj} [@var{system}] @
6198 [#:target #f] Return as a value in @var{%store-monad} the derivation or
6199store item corresponding to @var{obj} for @var{system}, cross-compiling for
6200@var{target} if @var{target} is true. @var{obj} must be an object that has
6201an associated gexp compiler, such as a @code{<package>}.
6202@end deffn
6203
6204@node Invoking guix repl
6205@section Invoking @command{guix repl}
6206
6207@cindex REPL, read-eval-print loop
6208The @command{guix repl} command spawns a Guile @dfn{read-eval-print loop}
6209(REPL) for interactive programming (@pxref{Using Guile Interactively,,,
6210guile, GNU Guile Reference Manual}). Compared to just launching the
6211@command{guile} command, @command{guix repl} guarantees that all the Guix
6212modules and all its dependencies are available in the search path. You can
6213use it this way:
6214
6215@example
6216$ guix repl
6217scheme@@(guile-user)> ,use (gnu packages base)
6218scheme@@(guile-user)> coreutils
6219$1 = #<package coreutils@@8.29 gnu/packages/base.scm:327 3e28300>
6220@end example
6221
6222@cindex inferiors
6223In addition, @command{guix repl} implements a simple machine-readable REPL
6224protocol for use by @code{(guix inferior)}, a facility to interact with
6225@dfn{inferiors}, separate processes running a potentially different revision
6226of Guix.
6227
6228The available options are as follows:
6229
6230@table @code
6231@item --type=@var{type}
6232@itemx -t @var{type}
6233Start a REPL of the given @var{TYPE}, which can be one of the following:
6234
6235@table @code
6236@item guile
6237This is default, and it spawns a standard full-featured Guile REPL.
6238@item machine
6239Spawn a REPL that uses the machine-readable protocol. This is the protocol
6240that the @code{(guix inferior)} module speaks.
6241@end table
6242
6243@item --listen=@var{Endpunkt}
6244By default, @command{guix repl} reads from standard input and writes to
6245standard output. When this option is passed, it will instead listen for
6246connections on @var{endpoint}. Here are examples of valid options:
6247
6248@table @code
6249@item --listen=tcp:37146
6250Accept connections on localhost on port 37146.
6251
6252@item --listen=unix:/tmp/socket
6253Accept connections on the Unix-domain socket @file{/tmp/socket}.
6254@end table
6255@end table
6256
6257@c *********************************************************************
6258@node Zubehör
6259@chapter Zubehör
6260
6261This section describes Guix command-line utilities. Some of them are
6262primarily targeted at developers and users who write new package
6263definitions, while others are more generally useful. They complement the
6264Scheme programming interface of Guix in a convenient way.
6265
6266@menu
6267* Aufruf von guix build:: Pakete aus der Befehlszeile heraus erstellen.
6268* Aufruf von guix edit:: Paketdefinitionen bearbeiten.
6269* Aufruf von guix download:: Herunterladen einer Datei und Ausgabe ihres
6270 Hashes.
6271* Aufruf von guix hash:: Den kryptographischen Hash einer Datei
6272 berechnen.
6273* Aufruf von guix import:: Paketdefinitionen importieren.
6274* Aufruf von guix refresh:: Paketdefinitionen aktualisieren.
6275* Aufruf von guix lint:: Fehler in Paketdefinitionen finden.
6276* Aufruf von guix size:: Plattenverbrauch profilieren.
6277* Aufruf von guix graph:: Den Paketgraphen visualisieren.
6278* Aufruf von guix environment:: Entwicklungsumgebungen einrichten.
6279* Aufruf von guix publish:: Substitute teilen.
6280* Aufruf von guix challenge:: Die Substitut-Server anfechten.
6281* Aufruf von guix copy:: Mit einem entfernten Store Dateien austauschen.
6282* Aufruf von guix container:: Prozesse isolieren.
6283* Aufruf von guix weather:: Die Verfügbarkeit von Substituten
6284 einschätzen.
6285* Invoking guix processes:: Listing client processes.
6286@end menu
6287
6288@node Aufruf von guix build
6289@section Aufruf von @command{guix build}
6290
6291@cindex package building
6292@cindex @command{guix build}
6293The @command{guix build} command builds packages or derivations and their
6294dependencies, and prints the resulting store paths. Note that it does not
6295modify the user's profile---this is the job of the @command{guix package}
6296command (@pxref{Aufruf von guix package}). Thus, it is mainly useful for
6297distribution developers.
6298
6299The general syntax is:
6300
6301@example
6302guix build @var{options} @var{package-or-derivation}@dots{}
6303@end example
6304
6305As an example, the following command builds the latest versions of Emacs and
6306of Guile, displays their build logs, and finally displays the resulting
6307directories:
6308
6309@example
6310guix build emacs guile
6311@end example
6312
6313Similarly, the following command builds all the available packages:
6314
6315@example
6316guix build --quiet --keep-going \
6317 `guix package -A | cut -f1,2 --output-delimiter=@@`
6318@end example
6319
6320@var{package-or-derivation} may be either the name of a package found in the
6321software distribution such as @code{coreutils} or @code{coreutils@@8.20}, or
6322a derivation such as @file{/gnu/store/@dots{}-coreutils-8.19.drv}. In the
6323former case, a package with the corresponding name (and optionally version)
6324is searched for among the GNU distribution modules (@pxref{Paketmodule}).
6325
6326Alternatively, the @code{--expression} option may be used to specify a
6327Scheme expression that evaluates to a package; this is useful when
6328disambiguating among several same-named packages or package variants is
6329needed.
6330
6331There may be zero or more @var{options}. The available options are
6332described in the subsections below.
6333
6334@menu
6335* Gemeinsame Erstellungsoptionen:: Erstellungsoptionen für die meisten
6336 Befehle.
6337* Paketumwandlungsoptionen:: Varianten von Paketen erzeugen.
6338* Zusätzliche Erstellungsoptionen:: Optionen spezifisch für »guix
6339 build«.
6340* Fehlschläge beim Erstellen untersuchen:: Praxiserfahrung bei der
6341 Paketerstellung.
6342@end menu
6343
6344@node Gemeinsame Erstellungsoptionen
6345@subsection Gemeinsame Erstellungsoptionen
6346
6347A number of options that control the build process are common to
6348@command{guix build} and other commands that can spawn builds, such as
6349@command{guix package} or @command{guix archive}. These are the following:
6350
6351@table @code
6352
6353@item --load-path=@var{directory}
6354@itemx -L @var{directory}
6355Add @var{directory} to the front of the package module search path
6356(@pxref{Paketmodule}).
6357
6358This allows users to define their own packages and make them visible to the
6359command-line tools.
6360
6361@item --keep-failed
6362@itemx -K
6363Keep the build tree of failed builds. Thus, if a build fails, its build
6364tree is kept under @file{/tmp}, in a directory whose name is shown at the
6365end of the build log. This is useful when debugging build issues.
6366@xref{Fehlschläge beim Erstellen untersuchen}, for tips and tricks on how to debug build
6367issues.
6368
793dcd8c
LC
6369This option has no effect when connecting to a remote daemon with a
6370@code{guix://} URI (@pxref{Der Store, the @code{GUIX_DAEMON_SOCKET}
6371variable}).
6372
1e40e70b
JL
6373@item --keep-going
6374@itemx -k
6375Keep going when some of the derivations fail to build; return only once all
6376the builds have either completed or failed.
6377
6378The default behavior is to stop as soon as one of the specified derivations
6379has failed.
6380
6381@item --dry-run
6382@itemx -n
6383Do not build the derivations.
6384
6385@anchor{fallback-option}
6386@item --fallback
6387When substituting a pre-built binary fails, fall back to building packages
6388locally (@pxref{Fehler bei der Substitution}).
6389
6390@item --substitute-urls=@var{URLs}
6391@anchor{client-substitute-urls}
6392Consider @var{urls} the whitespace-separated list of substitute source URLs,
6393overriding the default list of URLs of @command{guix-daemon}
6394(@pxref{daemon-substitute-urls,, @command{guix-daemon} URLs}).
6395
6396This means that substitutes may be downloaded from @var{urls}, provided they
6397are signed by a key authorized by the system administrator
6398(@pxref{Substitute}).
6399
6400When @var{urls} is the empty string, substitutes are effectively disabled.
6401
6402@item --no-substitutes
6403Benutze keine Substitute für Erstellungsergebnisse. Das heißt, dass alle
6404Objekte lokal erstellt werden müssen, und kein Herunterladen von vorab
6405erstellten Binärdateien erlaubt ist (@pxref{Substitute}).
6406
6407@item --no-grafts
6408Do not ``graft'' packages. In practice, this means that package updates
6409available as grafts are not applied. @xref{Sicherheitsaktualisierungen}, for more
6410information on grafts.
6411
6412@item --rounds=@var{n}
6413Build each derivation @var{n} times in a row, and raise an error if
6414consecutive build results are not bit-for-bit identical.
6415
6416This is a useful way to detect non-deterministic builds processes.
6417Non-deterministic build processes are a problem because they make it
6418practically impossible for users to @emph{verify} whether third-party
6419binaries are genuine. @xref{Aufruf von guix challenge}, for more.
6420
6421Note that, currently, the differing build results are not kept around, so
6422you will have to manually investigate in case of an error---e.g., by
6423stashing one of the build results with @code{guix archive --export}
6424(@pxref{Aufruf von guix archive}), then rebuilding, and finally comparing the
6425two results.
6426
6427@item --no-build-hook
6428Nicht versuchen, Erstellungen über den »Build-Hook« des Daemons auszulagern
6429(@pxref{Auslagern des Daemons einrichten}). Somit wird lokal erstellt, statt
6430Erstellungen auf entfernte Maschinen auszulagern.
6431
6432@item --max-silent-time=@var{Sekunden}
6433Wenn der Erstellungs- oder Substitutionsprozess länger als
6434@var{Sekunden}-lang keine Ausgabe erzeugt, wird er abgebrochen und ein
6435Fehler beim Erstellen gemeldet.
6436
6437By default, the daemon's setting is honored (@pxref{Aufruf des guix-daemon,
6438@code{--max-silent-time}}).
6439
6440@item --timeout=@var{Sekunden}
6441Entsprechend wird hier der Erstellungs- oder Substitutionsprozess
6442abgebrochen und als Fehlschlag gemeldet, wenn er mehr als
6443@var{Sekunden}-lang dauert.
6444
6445By default, the daemon's setting is honored (@pxref{Aufruf des guix-daemon,
6446@code{--timeout}}).
6447
6448@item --verbosity=@var{level}
6449Use the given verbosity level. @var{level} must be an integer between 0 and
64505; higher means more verbose output. Setting a level of 4 or more may be
6451helpful when debugging setup issues with the build daemon.
6452
6453@item --cores=@var{n}
6454@itemx -c @var{n}
6455Allow the use of up to @var{n} CPU cores for the build. The special value
6456@code{0} means to use as many CPU cores as available.
6457
6458@item --max-jobs=@var{n}
6459@itemx -M @var{n}
6460Allow at most @var{n} build jobs in parallel. @xref{Aufruf des guix-daemon,
6461@code{--max-jobs}}, for details about this option and the equivalent
6462@command{guix-daemon} option.
6463
6464@end table
6465
6466Behind the scenes, @command{guix build} is essentially an interface to the
6467@code{package-derivation} procedure of the @code{(guix packages)} module,
6468and to the @code{build-derivations} procedure of the @code{(guix
6469derivations)} module.
6470
6471In addition to options explicitly passed on the command line, @command{guix
6472build} and other @command{guix} commands that support building honor the
6473@code{GUIX_BUILD_OPTIONS} environment variable.
6474
6475@defvr {Environment Variable} GUIX_BUILD_OPTIONS
6476Users can define this variable to a list of command line options that will
6477automatically be used by @command{guix build} and other @command{guix}
6478commands that can perform builds, as in the example below:
6479
6480@example
6481$ export GUIX_BUILD_OPTIONS="--no-substitutes -c 2 -L /foo/bar"
6482@end example
6483
6484These options are parsed independently, and the result is appended to the
6485parsed command-line options.
6486@end defvr
6487
6488
6489@node Paketumwandlungsoptionen
6490@subsection Paketumwandlungsoptionen
6491
6492@cindex package variants
6493Another set of command-line options supported by @command{guix build} and
6494also @command{guix package} are @dfn{package transformation options}. These
6495are options that make it possible to define @dfn{package variants}---for
6496instance, packages built from different source code. This is a convenient
6497way to create customized packages on the fly without having to type in the
6498definitions of package variants (@pxref{Pakete definieren}).
6499
6500@table @code
6501
6502@item --with-source=@var{source}
6503@itemx --with-source=@var{package}=@var{source}
6504@itemx --with-source=@var{package}@@@var{version}=@var{source}
6505Use @var{source} as the source of @var{package}, and @var{version} as its
6506version number. @var{source} must be a file name or a URL, as for
6507@command{guix download} (@pxref{Aufruf von guix download}).
6508
6509When @var{package} is omitted, it is taken to be the package name specified
6510on the command line that matches the base of @var{source}---e.g., if
6511@var{source} is @code{/src/guile-2.0.10.tar.gz}, the corresponding package
6512is @code{guile}.
6513
6514Likewise, when @var{version} is omitted, the version string is inferred from
6515@var{source}; in the previous example, it is @code{2.0.10}.
6516
6517This option allows users to try out versions of packages other than the one
6518provided by the distribution. The example below downloads
6519@file{ed-1.7.tar.gz} from a GNU mirror and uses that as the source for the
6520@code{ed} package:
6521
6522@example
6523guix build ed --with-source=mirror://gnu/ed/ed-1.7.tar.gz
6524@end example
6525
6526As a developer, @code{--with-source} makes it easy to test release
6527candidates:
6528
6529@example
6530guix build guile --with-source=../guile-2.0.9.219-e1bb7.tar.xz
6531@end example
6532
6533@dots{} or to build from a checkout in a pristine environment:
6534
6535@example
6536$ git clone git://git.sv.gnu.org/guix.git
6537$ guix build guix --with-source=guix@@1.0=./guix
6538@end example
6539
6540@item --with-input=@var{package}=@var{replacement}
6541Replace dependency on @var{package} by a dependency on @var{replacement}.
6542@var{package} must be a package name, and @var{replacement} must be a
6543package specification such as @code{guile} or @code{guile@@1.8}.
6544
6545For instance, the following command builds Guix, but replaces its dependency
6546on the current stable version of Guile with a dependency on the legacy
6547version of Guile, @code{guile@@2.0}:
6548
6549@example
6550guix build --with-input=guile=guile@@2.0 guix
6551@end example
6552
6553This is a recursive, deep replacement. So in this example, both @code{guix}
6554and its dependency @code{guile-json} (which also depends on @code{guile})
6555get rebuilt against @code{guile@@2.0}.
6556
6557This is implemented using the @code{package-input-rewriting} Scheme
6558procedure (@pxref{Pakete definieren, @code{package-input-rewriting}}).
6559
6560@item --with-graft=@var{package}=@var{replacement}
6561This is similar to @code{--with-input} but with an important difference:
6562instead of rebuilding the whole dependency chain, @var{replacement} is built
6563and then @dfn{grafted} onto the binaries that were initially referring to
6564@var{package}. @xref{Sicherheitsaktualisierungen}, for more information on grafts.
6565
6566For example, the command below grafts version 3.5.4 of GnuTLS onto Wget and
6567all its dependencies, replacing references to the version of GnuTLS they
6568currently refer to:
6569
6570@example
6571guix build --with-graft=gnutls=gnutls@@3.5.4 wget
6572@end example
6573
6574This has the advantage of being much faster than rebuilding everything. But
6575there is a caveat: it works if and only if @var{package} and
6576@var{replacement} are strictly compatible---for example, if they provide a
6577library, the application binary interface (ABI) of those libraries must be
6578compatible. If @var{replacement} is somehow incompatible with
6579@var{package}, then the resulting package may be unusable. Use with care!
6580
793dcd8c
LC
6581@item --with-branch=@var{package}=@var{branch}
6582@cindex Git, using the latest commit
6583@cindex latest commit, building
6584Build @var{package} from the latest commit of @var{branch}. The
6585@code{source} field of @var{package} must be an origin with the
6586@code{git-fetch} method (@pxref{„origin“-Referenz}) or a @code{git-checkout}
6587object; the repository URL is taken from that @code{source}.
6588
6589For instance, the following command builds @code{guile-sqlite3} from the
6590latest commit of its @code{master} branch, and then builds @code{guix}
6591(which depends on it) and @code{cuirass} (which depends on @code{guix})
6592against this specific @code{guile-sqlite3} build:
6593
6594@example
6595guix build --with-branch=guile-sqlite3=master cuirass
6596@end example
6597
6598@cindex continuous integration
6599Obviously, since it uses the latest commit of the given branch, the result
6600of such a command varies over time. Nevertheless it is a convenient way to
6601rebuild entire software stacks against the latest commit of one or more
6602packages. This is particularly useful in the context of continuous
6603integration (CI).
6604
6605Checkouts are kept in a cache under @file{~/.cache/guix/checkouts} to speed
6606up consecutive accesses to the same repository. You may want to clean it up
6607once in a while to save disk space.
6608
6609@item --with-commit=@var{package}=@var{commit}
6610This is similar to @code{--with-branch}, except that it builds from
6611@var{commit} rather than the tip of a branch. @var{commit} must be a valid
6612Git commit SHA1 identifier.
1e40e70b
JL
6613@end table
6614
6615@node Zusätzliche Erstellungsoptionen
6616@subsection Zusätzliche Erstellungsoptionen
6617
6618The command-line options presented below are specific to @command{guix
6619build}.
6620
6621@table @code
6622
6623@item --quiet
6624@itemx -q
6625Build quietly, without displaying the build log. Upon completion, the build
6626log is kept in @file{/var} (or similar) and can always be retrieved using
6627the @option{--log-file} option.
6628
6629@item --file=@var{file}
6630@itemx -f @var{Datei}
6631Build the package, derivation, or other file-like object that the code
6632within @var{file} evaluates to (@pxref{G-Ausdrücke, file-like objects}).
6633
6634As an example, @var{file} might contain a package definition like this
6635(@pxref{Pakete definieren}):
6636
6637@example
6638@verbatiminclude package-hello.scm
6639@end example
6640
6641@item --expression=@var{expr}
6642@itemx -e @var{expr}
6643Build the package or derivation @var{expr} evaluates to.
6644
6645For example, @var{expr} may be @code{(@@ (gnu packages guile) guile-1.8)},
6646which unambiguously designates this specific variant of version 1.8 of
6647Guile.
6648
6649Alternatively, @var{expr} may be a G-expression, in which case it is used as
6650a build program passed to @code{gexp->derivation} (@pxref{G-Ausdrücke}).
6651
6652Lastly, @var{expr} may refer to a zero-argument monadic procedure
6653(@pxref{Die Store-Monade}). The procedure must return a derivation as a
6654monadic value, which is then passed through @code{run-with-store}.
6655
6656@item --source
6657@itemx -S
6658Build the source derivations of the packages, rather than the packages
6659themselves.
6660
6661For instance, @code{guix build -S gcc} returns something like
6662@file{/gnu/store/@dots{}-gcc-4.7.2.tar.bz2}, which is the GCC source
6663tarball.
6664
6665The returned source tarball is the result of applying any patches and code
6666snippets specified in the package @code{origin} (@pxref{Pakete definieren}).
6667
6668@item --sources
6669Fetch and return the source of @var{package-or-derivation} and all their
6670dependencies, recursively. This is a handy way to obtain a local copy of
6671all the source code needed to build @var{packages}, allowing you to
6672eventually build them even without network access. It is an extension of
6673the @code{--source} option and can accept one of the following optional
6674argument values:
6675
6676@table @code
6677@item package
6678This value causes the @code{--sources} option to behave in the same way as
6679the @code{--source} option.
6680
6681@item all
6682Build the source derivations of all packages, including any source that
6683might be listed as @code{inputs}. This is the default value.
6684
6685@example
6686$ guix build --sources tzdata
6687The following derivations will be built:
6688 /gnu/store/@dots{}-tzdata2015b.tar.gz.drv
6689 /gnu/store/@dots{}-tzcode2015b.tar.gz.drv
6690@end example
6691
6692@item transitive
6693Build the source derivations of all packages, as well of all transitive
793dcd8c 6694inputs to the packages. This can be used e.g.@: to prefetch package source
1e40e70b
JL
6695for later offline building.
6696
6697@example
6698$ guix build --sources=transitive tzdata
6699The following derivations will be built:
6700 /gnu/store/@dots{}-tzcode2015b.tar.gz.drv
6701 /gnu/store/@dots{}-findutils-4.4.2.tar.xz.drv
6702 /gnu/store/@dots{}-grep-2.21.tar.xz.drv
6703 /gnu/store/@dots{}-coreutils-8.23.tar.xz.drv
6704 /gnu/store/@dots{}-make-4.1.tar.xz.drv
6705 /gnu/store/@dots{}-bash-4.3.tar.xz.drv
6706@dots{}
6707@end example
6708
6709@end table
6710
6711@item --system=@var{System}
6712@itemx -s @var{system}
6713Attempt to build for @var{system}---e.g., @code{i686-linux}---instead of the
6714system type of the build host.
6715
6716@quotation Anmerkung
6717The @code{--system} flag is for @emph{native} compilation and must not be
6718confused with cross-compilation. See @code{--target} below for information
6719on cross-compilation.
6720@end quotation
6721
6722An example use of this is on Linux-based systems, which can emulate
6723different personalities. For instance, passing @code{--system=i686-linux}
6724on an @code{x86_64-linux} system or @code{--system=armhf-linux} on an
6725@code{aarch64-linux} system allows you to build packages in a complete
672632-bit environment.
6727
6728@quotation Anmerkung
6729Building for an @code{armhf-linux} system is unconditionally enabled on
6730@code{aarch64-linux} machines, although certain aarch64 chipsets do not
6731allow for this functionality, notably the ThunderX.
6732@end quotation
6733
6734Similarly, when transparent emulation with QEMU and @code{binfmt_misc} is
6735enabled (@pxref{Virtualisierungsdienste, @code{qemu-binfmt-service-type}}),
6736you can build for any system for which a QEMU @code{binfmt_misc} handler is
6737installed.
6738
6739Builds for a system other than that of the machine you are using can also be
6740offloaded to a remote machine of the right architecture. @xref{Auslagern des Daemons einrichten}, for more information on offloading.
6741
6742@item --target=@var{triplet}
6743@cindex cross-compilation
6744Cross-build for @var{triplet}, which must be a valid GNU triplet, such as
6745@code{"mips64el-linux-gnu"} (@pxref{Specifying target triplets, GNU
6746configuration triplets,, autoconf, Autoconf}).
6747
6748@anchor{build-check}
6749@item --check
6750@cindex determinism, checking
6751@cindex reproducibility, checking
6752Rebuild @var{package-or-derivation}, which are already available in the
6753store, and raise an error if the build results are not bit-for-bit
6754identical.
6755
6756This mechanism allows you to check whether previously installed substitutes
6757are genuine (@pxref{Substitute}), or whether the build result of a package
6758is deterministic. @xref{Aufruf von guix challenge}, for more background
6759information and tools.
6760
6761Wenn dies zusammen mit @option{--keep-failed} benutzt wird, bleiben die sich
6762unterscheidenden Ausgaben im Store unter dem Namen
6763@file{/gnu/store/@dots{}-check}. Dadurch können Unterschiede zwischen den
6764beiden Ergebnissen leicht erkannt werden.
6765
6766@item --repair
6767@cindex repairing store items
6768@cindex Datenbeschädigung, Behebung
6769Attempt to repair the specified store items, if they are corrupt, by
6770re-downloading or rebuilding them.
6771
6772This operation is not atomic and thus restricted to @code{root}.
6773
6774@item --derivations
6775@itemx -d
6776Return the derivation paths, not the output paths, of the given packages.
6777
6778@item --root=@var{file}
6779@itemx -r @var{file}
6780@cindex GC roots, adding
6781@cindex garbage collector roots, adding
6782Make @var{file} a symlink to the result, and register it as a garbage
6783collector root.
6784
6785Consequently, the results of this @command{guix build} invocation are
6786protected from garbage collection until @var{file} is removed. When that
6787option is omitted, build results are eligible for garbage collection as soon
6788as the build completes. @xref{Aufruf von guix gc}, for more on GC roots.
6789
6790@item --log-file
6791@cindex build logs, access
6792Return the build log file names or URLs for the given
6793@var{package-or-derivation}, or raise an error if build logs are missing.
6794
6795This works regardless of how packages or derivations are specified. For
6796instance, the following invocations are equivalent:
6797
6798@example
6799guix build --log-file `guix build -d guile`
6800guix build --log-file `guix build guile`
6801guix build --log-file guile
6802guix build --log-file -e '(@@ (gnu packages guile) guile-2.0)'
6803@end example
6804
6805If a log is unavailable locally, and unless @code{--no-substitutes} is
6806passed, the command looks for a corresponding log on one of the substitute
6807servers (as specified with @code{--substitute-urls}.)
6808
6809So for instance, imagine you want to see the build log of GDB on MIPS, but
6810you are actually on an @code{x86_64} machine:
6811
6812@example
6813$ guix build --log-file gdb -s mips64el-linux
6814https://hydra.gnu.org/log/@dots{}-gdb-7.10
6815@end example
6816
6817You can freely access a huge library of build logs!
6818@end table
6819
6820@node Fehlschläge beim Erstellen untersuchen
6821@subsection Fehlschläge beim Erstellen untersuchen
6822
6823@cindex build failures, debugging
6824When defining a new package (@pxref{Pakete definieren}), you will probably
6825find yourself spending some time debugging and tweaking the build until it
6826succeeds. To do that, you need to operate the build commands yourself in an
6827environment as close as possible to the one the build daemon uses.
6828
6829To that end, the first thing to do is to use the @option{--keep-failed} or
6830@option{-K} option of @command{guix build}, which will keep the failed build
6831tree in @file{/tmp} or whatever directory you specified as @code{TMPDIR}
6832(@pxref{Aufruf von guix build, @code{--keep-failed}}).
6833
6834From there on, you can @command{cd} to the failed build tree and source the
6835@file{environment-variables} file, which contains all the environment
6836variable definitions that were in place when the build failed. So let's say
6837you're debugging a build failure in package @code{foo}; a typical session
6838would look like this:
6839
6840@example
6841$ guix build foo -K
6842@dots{} @i{build fails}
6843$ cd /tmp/guix-build-foo.drv-0
6844$ source ./environment-variables
6845$ cd foo-1.2
6846@end example
6847
6848Now, you can invoke commands as if you were the daemon (almost) and
6849troubleshoot your build process.
6850
6851Sometimes it happens that, for example, a package's tests pass when you run
6852them manually but they fail when the daemon runs them. This can happen
6853because the daemon runs builds in containers where, unlike in our
6854environment above, network access is missing, @file{/bin/sh} does not exist,
6855etc. (@pxref{Einrichten der Erstellungsumgebung}).
6856
6857In such cases, you may need to run inspect the build process from within a
6858container similar to the one the build daemon creates:
6859
6860@example
6861$ guix build -K foo
6862@dots{}
6863$ cd /tmp/guix-build-foo.drv-0
6864$ guix environment --no-grafts -C foo --ad-hoc strace gdb
6865[env]# source ./environment-variables
6866[env]# cd foo-1.2
6867@end example
6868
6869Here, @command{guix environment -C} creates a container and spawns a new
6870shell in it (@pxref{Aufruf von guix environment}). The @command{--ad-hoc
6871strace gdb} part adds the @command{strace} and @command{gdb} commands to the
6872container, which would may find handy while debugging. The
6873@option{--no-grafts} option makes sure we get the exact same environment,
6874with ungrafted packages (@pxref{Sicherheitsaktualisierungen}, for more info on grafts).
6875
6876To get closer to a container like that used by the build daemon, we can
6877remove @file{/bin/sh}:
6878
6879@example
6880[env]# rm /bin/sh
6881@end example
6882
6883(Don't worry, this is harmless: this is all happening in the throw-away
6884container created by @command{guix environment}.)
6885
6886The @command{strace} command is probably not in the search path, but we can
6887run:
6888
6889@example
6890[env]# $GUIX_ENVIRONMENT/bin/strace -f -o log make check
6891@end example
6892
6893In this way, not only you will have reproduced the environment variables the
6894daemon uses, you will also be running the build process in a container
6895similar to the one the daemon uses.
6896
6897
6898@node Aufruf von guix edit
6899@section Invoking @command{guix edit}
6900
6901@cindex @command{guix edit}
6902@cindex package definition, editing
6903So many packages, so many source files! The @command{guix edit} command
6904facilitates the life of users and packagers by pointing their editor at the
6905source file containing the definition of the specified packages. For
6906instance:
6907
6908@example
6909guix edit gcc@@4.9 vim
6910@end example
6911
6912@noindent
6913launches the program specified in the @code{VISUAL} or in the @code{EDITOR}
6914environment variable to view the recipe of GCC@tie{}4.9.3 and that of Vim.
6915
6916If you are using a Guix Git checkout (@pxref{Erstellung aus dem Git}), or have
6917created your own packages on @code{GUIX_PACKAGE_PATH} (@pxref{Paketmodule}), you will be able to edit the package recipes. In other cases,
6918you will be able to examine the read-only recipes for packages currently in
6919the store.
6920
6921
6922@node Aufruf von guix download
6923@section Invoking @command{guix download}
6924
6925@cindex @command{guix download}
6926@cindex downloading package sources
6927When writing a package definition, developers typically need to download a
6928source tarball, compute its SHA256 hash, and write that hash in the package
6929definition (@pxref{Pakete definieren}). The @command{guix download} tool
6930helps with this task: it downloads a file from the given URI, adds it to the
6931store, and prints both its file name in the store and its SHA256 hash.
6932
6933The fact that the downloaded file is added to the store saves bandwidth:
6934when the developer eventually tries to build the newly defined package with
6935@command{guix build}, the source tarball will not have to be downloaded
6936again because it is already in the store. It is also a convenient way to
6937temporarily stash files, which may be deleted eventually (@pxref{Aufruf von guix gc}).
6938
6939The @command{guix download} command supports the same URIs as used in
6940package definitions. In particular, it supports @code{mirror://} URIs.
6941@code{https} URIs (HTTP over TLS) are supported @emph{provided} the Guile
6942bindings for GnuTLS are available in the user's environment; when they are
6943not available, an error is raised. @xref{Guile Preparations, how to install
6944the GnuTLS bindings for Guile,, gnutls-guile, GnuTLS-Guile}, for more
6945information.
6946
6947@command{guix download} verifies HTTPS server certificates by loading the
6948certificates of X.509 authorities from the directory pointed to by the
6949@code{SSL_CERT_DIR} environment variable (@pxref{X.509-Zertifikate}),
6950unless @option{--no-check-certificate} is used.
6951
6952The following options are available:
6953
6954@table @code
6955@item --format=@var{fmt}
6956@itemx -f @var{fmt}
6957Write the hash in the format specified by @var{fmt}. For more information
6958on the valid values for @var{fmt}, @pxref{Aufruf von guix hash}.
6959
6960@item --no-check-certificate
6961Do not validate the X.509 certificates of HTTPS servers.
6962
6963When using this option, you have @emph{absolutely no guarantee} that you are
6964communicating with the authentic server responsible for the given URL, which
6965makes you vulnerable to ``man-in-the-middle'' attacks.
6966
6967@item --output=@var{file}
6968@itemx -o @var{file}
6969Save the downloaded file to @var{file} instead of adding it to the store.
6970@end table
6971
6972@node Aufruf von guix hash
6973@section Invoking @command{guix hash}
6974
6975@cindex @command{guix hash}
6976The @command{guix hash} command computes the SHA256 hash of a file. It is
6977primarily a convenience tool for anyone contributing to the distribution: it
6978computes the cryptographic hash of a file, which can be used in the
6979definition of a package (@pxref{Pakete definieren}).
6980
6981The general syntax is:
6982
6983@example
6984guix hash @var{option} @var{file}
6985@end example
6986
6987When @var{file} is @code{-} (a hyphen), @command{guix hash} computes the
6988hash of data read from standard input. @command{guix hash} has the
6989following options:
6990
6991@table @code
6992
6993@item --format=@var{fmt}
6994@itemx -f @var{fmt}
6995Write the hash in the format specified by @var{fmt}.
6996
6997Supported formats: @code{nix-base32}, @code{base32}, @code{base16}
6998(@code{hex} and @code{hexadecimal} can be used as well).
6999
7000If the @option{--format} option is not specified, @command{guix hash} will
7001output the hash in @code{nix-base32}. This representation is used in the
7002definitions of packages.
7003
7004@item --recursive
7005@itemx -r
7006Compute the hash on @var{file} recursively.
7007
7008@c FIXME: Replace xref above with xref to an ``Archive'' section when
7009@c it exists.
7010In this case, the hash is computed on an archive containing @var{file},
7011including its children if it is a directory. Some of the metadata of
7012@var{file} is part of the archive; for instance, when @var{file} is a
7013regular file, the hash is different depending on whether @var{file} is
7014executable or not. Metadata such as time stamps has no impact on the hash
7015(@pxref{Aufruf von guix archive}).
7016
7017@item --exclude-vcs
7018@itemx -x
7019When combined with @option{--recursive}, exclude version control system
7020directories (@file{.bzr}, @file{.git}, @file{.hg}, etc.)
7021
7022@vindex git-fetch
7023As an example, here is how you would compute the hash of a Git checkout,
7024which is useful when using the @code{git-fetch} method (@pxref{„origin“-Referenz}):
7025
7026@example
7027$ git clone http://example.org/foo.git
7028$ cd foo
7029$ guix hash -rx .
7030@end example
7031@end table
7032
7033@node Aufruf von guix import
7034@section Invoking @command{guix import}
7035
7036@cindex importing packages
7037@cindex package import
7038@cindex package conversion
7039@cindex Invoking @command{guix import}
7040The @command{guix import} command is useful for people who would like to add
7041a package to the distribution with as little work as possible---a legitimate
7042demand. The command knows of a few repositories from which it can
7043``import'' package metadata. The result is a package definition, or a
7044template thereof, in the format we know (@pxref{Pakete definieren}).
7045
7046The general syntax is:
7047
7048@example
7049guix import @var{importer} @var{options}@dots{}
7050@end example
7051
7052@var{importer} specifies the source from which to import package metadata,
7053and @var{options} specifies a package identifier and other options specific
7054to @var{importer}. Currently, the available ``importers'' are:
7055
7056@table @code
7057@item gnu
7058Import metadata for the given GNU package. This provides a template for the
7059latest version of that GNU package, including the hash of its source
7060tarball, and its canonical synopsis and description.
7061
7062Additional information such as the package dependencies and its license
7063needs to be figured out manually.
7064
7065For example, the following command returns a package definition for
7066GNU@tie{}Hello:
7067
7068@example
7069guix import gnu hello
7070@end example
7071
7072Specific command-line options are:
7073
7074@table @code
7075@item --key-download=@var{policy}
7076As for @code{guix refresh}, specify the policy to handle missing OpenPGP
7077keys when verifying the package signature. @xref{Aufruf von guix refresh,
7078@code{--key-download}}.
7079@end table
7080
7081@item pypi
7082@cindex pypi
7083Import metadata from the @uref{https://pypi.python.org/, Python Package
7084Index}@footnote{This functionality requires Guile-JSON to be installed.
7085@xref{Voraussetzungen}.}. Information is taken from the JSON-formatted
7086description available at @code{pypi.python.org} and usually includes all the
7087relevant information, including package dependencies. For maximum
7088efficiency, it is recommended to install the @command{unzip} utility, so
7089that the importer can unzip Python wheels and gather data from them.
7090
7091The command below imports metadata for the @code{itsdangerous} Python
7092package:
7093
7094@example
7095guix import pypi itsdangerous
7096@end example
7097
7098@table @code
7099@item --recursive
7100@itemx -r
7101Traverse the dependency graph of the given upstream package recursively and
7102generate package expressions for all those packages that are not yet in
7103Guix.
7104@end table
7105
7106@item gem
7107@cindex gem
7108Import metadata from @uref{https://rubygems.org/, RubyGems}@footnote{This
7109functionality requires Guile-JSON to be installed. @xref{Voraussetzungen}.}.
7110Information is taken from the JSON-formatted description available at
7111@code{rubygems.org} and includes most relevant information, including
7112runtime dependencies. There are some caveats, however. The metadata
7113doesn't distinguish between synopses and descriptions, so the same string is
7114used for both fields. Additionally, the details of non-Ruby dependencies
7115required to build native extensions is unavailable and left as an exercise
7116to the packager.
7117
7118The command below imports metadata for the @code{rails} Ruby package:
7119
7120@example
7121guix import gem rails
7122@end example
7123
7124@table @code
7125@item --recursive
7126@itemx -r
7127Traverse the dependency graph of the given upstream package recursively and
7128generate package expressions for all those packages that are not yet in
7129Guix.
7130@end table
7131
7132@item cpan
7133@cindex CPAN
7134Import metadata from @uref{https://www.metacpan.org/,
7135MetaCPAN}@footnote{This functionality requires Guile-JSON to be installed.
7136@xref{Voraussetzungen}.}. Information is taken from the JSON-formatted
7137metadata provided through @uref{https://fastapi.metacpan.org/, MetaCPAN's
7138API} and includes most relevant information, such as module dependencies.
7139License information should be checked closely. If Perl is available in the
7140store, then the @code{corelist} utility will be used to filter core modules
7141out of the list of dependencies.
7142
7143The command command below imports metadata for the @code{Acme::Boolean} Perl
7144module:
7145
7146@example
7147guix import cpan Acme::Boolean
7148@end example
7149
7150@item cran
7151@cindex CRAN
7152@cindex Bioconductor
7153Import metadata from @uref{https://cran.r-project.org/, CRAN}, the central
7154repository for the @uref{http://r-project.org, GNU@tie{}R statistical and
7155graphical environment}.
7156
7157Information is extracted from the @code{DESCRIPTION} file of the package.
7158
7159The command command below imports metadata for the @code{Cairo} R package:
7160
7161@example
7162guix import cran Cairo
7163@end example
7164
7165When @code{--recursive} is added, the importer will traverse the dependency
7166graph of the given upstream package recursively and generate package
7167expressions for all those packages that are not yet in Guix.
7168
7169When @code{--archive=bioconductor} is added, metadata is imported from
7170@uref{https://www.bioconductor.org/, Bioconductor}, a repository of R
7171packages for for the analysis and comprehension of high-throughput genomic
7172data in bioinformatics.
7173
7174Information is extracted from the @code{DESCRIPTION} file of a package
7175published on the web interface of the Bioconductor SVN repository.
7176
7177The command below imports metadata for the @code{GenomicRanges} R package:
7178
7179@example
7180guix import cran --archive=bioconductor GenomicRanges
7181@end example
7182
7183@item texlive
7184@cindex TeX Live
7185@cindex CTAN
7186Import metadata from @uref{http://www.ctan.org/, CTAN}, the comprehensive
7187TeX archive network for TeX packages that are part of the
7188@uref{https://www.tug.org/texlive/, TeX Live distribution}.
7189
7190Information about the package is obtained through the XML API provided by
7191CTAN, while the source code is downloaded from the SVN repository of the Tex
7192Live project. This is done because the CTAN does not keep versioned
7193archives.
7194
7195The command command below imports metadata for the @code{fontspec} TeX
7196package:
7197
7198@example
7199guix import texlive fontspec
7200@end example
7201
7202When @code{--archive=DIRECTORY} is added, the source code is downloaded not
7203from the @file{latex} sub-directory of the @file{texmf-dist/source} tree in
7204the TeX Live SVN repository, but from the specified sibling directory under
7205the same root.
7206
7207The command below imports metadata for the @code{ifxetex} package from CTAN
7208while fetching the sources from the directory @file{texmf/source/generic}:
7209
7210@example
7211guix import texlive --archive=generic ifxetex
7212@end example
7213
7214@item json
7215@cindex JSON, import
7216Import package metadata from a local JSON file@footnote{This functionality
7217requires Guile-JSON to be installed. @xref{Voraussetzungen}.}. Consider the
7218following example package definition in JSON format:
7219
7220@example
7221@{
7222 "name": "hello",
7223 "version": "2.10",
7224 "source": "mirror://gnu/hello/hello-2.10.tar.gz",
7225 "build-system": "gnu",
7226 "home-page": "https://www.gnu.org/software/hello/",
7227 "synopsis": "Hello, GNU world: An example GNU package",
7228 "description": "GNU Hello prints a greeting.",
7229 "license": "GPL-3.0+",
7230 "native-inputs": ["gcc@@6"]
7231@}
7232@end example
7233
7234The field names are the same as for the @code{<package>} record
7235(@xref{Pakete definieren}). References to other packages are provided as
7236JSON lists of quoted package specification strings such as @code{guile} or
7237@code{guile@@2.0}.
7238
7239The importer also supports a more explicit source definition using the
7240common fields for @code{<origin>} records:
7241
7242@example
7243@{
7244 @dots{}
7245 "source": @{
7246 "method": "url-fetch",
7247 "uri": "mirror://gnu/hello/hello-2.10.tar.gz",
7248 "sha256": @{
7249 "base32": "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"
7250 @}
7251 @}
7252 @dots{}
7253@}
7254@end example
7255
7256The command below reads metadata from the JSON file @code{hello.json} and
7257outputs a package expression:
7258
7259@example
7260guix import json hello.json
7261@end example
7262
7263@item nix
7264Import metadata from a local copy of the source of the
7265@uref{http://nixos.org/nixpkgs/, Nixpkgs distribution}@footnote{This relies
7266on the @command{nix-instantiate} command of @uref{http://nixos.org/nix/,
7267Nix}.}. Package definitions in Nixpkgs are typically written in a mixture
7268of Nix-language and Bash code. This command only imports the high-level
7269package structure that is written in the Nix language. It normally includes
7270all the basic fields of a package definition.
7271
7272When importing a GNU package, the synopsis and descriptions are replaced by
7273their canonical upstream variant.
7274
7275Usually, you will first need to do:
7276
7277@example
7278export NIX_REMOTE=daemon
7279@end example
7280
7281@noindent
7282so that @command{nix-instantiate} does not try to open the Nix database.
7283
7284As an example, the command below imports the package definition of
7285LibreOffice (more precisely, it imports the definition of the package bound
7286to the @code{libreoffice} top-level attribute):
7287
7288@example
7289guix import nix ~/path/to/nixpkgs libreoffice
7290@end example
7291
7292@item hackage
7293@cindex hackage
7294Import metadata from the Haskell community's central package archive
7295@uref{https://hackage.haskell.org/, Hackage}. Information is taken from
7296Cabal files and includes all the relevant information, including package
7297dependencies.
7298
7299Specific command-line options are:
7300
7301@table @code
7302@item --stdin
7303@itemx -s
7304Read a Cabal file from standard input.
7305@item --no-test-dependencies
7306@itemx -t
7307Do not include dependencies required only by the test suites.
7308@item --cabal-environment=@var{alist}
7309@itemx -e @var{alist}
7310@var{alist} is a Scheme alist defining the environment in which the Cabal
7311conditionals are evaluated. The accepted keys are: @code{os}, @code{arch},
7312@code{impl} and a string representing the name of a flag. The value
7313associated with a flag has to be either the symbol @code{true} or
7314@code{false}. The value associated with other keys has to conform to the
7315Cabal file format definition. The default value associated with the keys
7316@code{os}, @code{arch} and @code{impl} is @samp{linux}, @samp{x86_64} and
7317@samp{ghc}, respectively.
7318@item --recursive
7319@itemx -r
7320Traverse the dependency graph of the given upstream package recursively and
7321generate package expressions for all those packages that are not yet in
7322Guix.
7323@end table
7324
7325The command below imports metadata for the latest version of the @code{HTTP}
7326Haskell package without including test dependencies and specifying the value
7327of the flag @samp{network-uri} as @code{false}:
7328
7329@example
7330guix import hackage -t -e "'((\"network-uri\" . false))" HTTP
7331@end example
7332
7333A specific package version may optionally be specified by following the
7334package name by an at-sign and a version number as in the following example:
7335
7336@example
7337guix import hackage mtl@@2.1.3.1
7338@end example
7339
7340@item stackage
7341@cindex stackage
7342The @code{stackage} importer is a wrapper around the @code{hackage} one. It
7343takes a package name, looks up the package version included in a long-term
7344support (LTS) @uref{https://www.stackage.org, Stackage} release and uses the
7345@code{hackage} importer to retrieve its metadata. Note that it is up to you
7346to select an LTS release compatible with the GHC compiler used by Guix.
7347
7348Specific command-line options are:
7349
7350@table @code
7351@item --no-test-dependencies
7352@itemx -t
7353Do not include dependencies required only by the test suites.
7354@item --lts-version=@var{version}
7355@itemx -l @var{version}
7356@var{version} is the desired LTS release version. If omitted the latest
7357release is used.
7358@item --recursive
7359@itemx -r
7360Traverse the dependency graph of the given upstream package recursively and
7361generate package expressions for all those packages that are not yet in
7362Guix.
7363@end table
7364
7365The command below imports metadata for the @code{HTTP} Haskell package
7366included in the LTS Stackage release version 7.18:
7367
7368@example
7369guix import stackage --lts-version=7.18 HTTP
7370@end example
7371
7372@item elpa
7373@cindex elpa
7374Import metadata from an Emacs Lisp Package Archive (ELPA) package repository
7375(@pxref{Packages,,, emacs, The GNU Emacs Manual}).
7376
7377Specific command-line options are:
7378
7379@table @code
7380@item --archive=@var{repo}
7381@itemx -a @var{repo}
7382@var{repo} identifies the archive repository from which to retrieve the
7383information. Currently the supported repositories and their identifiers
7384are:
7385@itemize -
7386@item
7387@uref{http://elpa.gnu.org/packages, GNU}, selected by the @code{gnu}
7388identifier. This is the default.
7389
7390Packages from @code{elpa.gnu.org} are signed with one of the keys contained
7391in the GnuPG keyring at @file{share/emacs/25.1/etc/package-keyring.gpg} (or
7392similar) in the @code{emacs} package (@pxref{Package Installation, ELPA
7393package signatures,, emacs, The GNU Emacs Manual}).
7394
7395@item
7396@uref{http://stable.melpa.org/packages, MELPA-Stable}, selected by the
7397@code{melpa-stable} identifier.
7398
7399@item
7400@uref{http://melpa.org/packages, MELPA}, selected by the @code{melpa}
7401identifier.
7402@end itemize
7403
7404@item --recursive
7405@itemx -r
7406Traverse the dependency graph of the given upstream package recursively and
7407generate package expressions for all those packages that are not yet in
7408Guix.
7409@end table
7410
7411@item crate
7412@cindex crate
7413Import metadata from the crates.io Rust package repository
7414@uref{https://crates.io, crates.io}.
7415
7416@item opam
7417@cindex OPAM
7418@cindex OCaml
7419Import metadata from the @uref{https://opam.ocaml.org/, OPAM} package
7420repository used by the OCaml community.
7421@end table
7422
7423The structure of the @command{guix import} code is modular. It would be
7424useful to have more importers for other package formats, and your help is
7425welcome here (@pxref{Mitwirken}).
7426
7427@node Aufruf von guix refresh
7428@section Invoking @command{guix refresh}
7429
7430@cindex @command{guix refresh}
7431The primary audience of the @command{guix refresh} command is developers of
7432the GNU software distribution. By default, it reports any packages provided
7433by the distribution that are outdated compared to the latest upstream
7434version, like this:
7435
7436@example
7437$ guix refresh
7438gnu/packages/gettext.scm:29:13: gettext would be upgraded from 0.18.1.1 to 0.18.2.1
7439gnu/packages/glib.scm:77:12: glib would be upgraded from 2.34.3 to 2.37.0
7440@end example
7441
7442Alternately, one can specify packages to consider, in which case a warning
7443is emitted for packages that lack an updater:
7444
7445@example
7446$ guix refresh coreutils guile guile-ssh
7447gnu/packages/ssh.scm:205:2: warning: no updater for guile-ssh
7448gnu/packages/guile.scm:136:12: guile would be upgraded from 2.0.12 to 2.0.13
7449@end example
7450
7451@command{guix refresh} browses the upstream repository of each package and
7452determines the highest version number of the releases therein. The command
7453knows how to update specific types of packages: GNU packages, ELPA packages,
7454etc.---see the documentation for @option{--type} below. There are many
7455packages, though, for which it lacks a method to determine whether a new
7456upstream release is available. However, the mechanism is extensible, so
7457feel free to get in touch with us to add a new method!
7458
7459Sometimes the upstream name differs from the package name used in Guix, and
7460@command{guix refresh} needs a little help. Most updaters honor the
7461@code{upstream-name} property in package definitions, which can be used to
7462that effect:
7463
7464@example
7465(define-public network-manager
7466 (package
7467 (name "network-manager")
7468 ;; @dots{}
7469 (properties '((upstream-name . "NetworkManager")))))
7470@end example
7471
7472When passed @code{--update}, it modifies distribution source files to update
7473the version numbers and source tarball hashes of those package recipes
7474(@pxref{Pakete definieren}). This is achieved by downloading each package's
7475latest source tarball and its associated OpenPGP signature, authenticating
7476the downloaded tarball against its signature using @command{gpg}, and
7477finally computing its hash. When the public key used to sign the tarball is
7478missing from the user's keyring, an attempt is made to automatically
7479retrieve it from a public key server; when this is successful, the key is
7480added to the user's keyring; otherwise, @command{guix refresh} reports an
7481error.
7482
7483The following options are supported:
7484
7485@table @code
7486
7487@item --expression=@var{expr}
7488@itemx -e @var{expr}
7489Consider the package @var{expr} evaluates to.
7490
7491This is useful to precisely refer to a package, as in this example:
7492
7493@example
7494guix refresh -l -e '(@@@@ (gnu packages commencement) glibc-final)'
7495@end example
7496
7497This command lists the dependents of the ``final'' libc (essentially all the
7498packages.)
7499
7500@item --update
7501@itemx -u
7502Update distribution source files (package recipes) in place. This is
7503usually run from a checkout of the Guix source tree (@pxref{Guix vor der Installation ausführen}):
7504
7505@example
7506$ ./pre-inst-env guix refresh -s non-core -u
7507@end example
7508
7509@xref{Pakete definieren}, for more information on package definitions.
7510
7511@item --select=[@var{subset}]
7512@itemx -s @var{subset}
7513Select all the packages in @var{subset}, one of @code{core} or
7514@code{non-core}.
7515
7516The @code{core} subset refers to all the packages at the core of the
7517distribution---i.e., packages that are used to build ``everything else''.
7518This includes GCC, libc, Binutils, Bash, etc. Usually, changing one of
7519these packages in the distribution entails a rebuild of all the others.
7520Thus, such updates are an inconvenience to users in terms of build time or
7521bandwidth used to achieve the upgrade.
7522
7523The @code{non-core} subset refers to the remaining packages. It is
7524typically useful in cases where an update of the core packages would be
7525inconvenient.
7526
7527@item --manifest=@var{Datei}
7528@itemx -m @var{Datei}
7529Select all the packages from the manifest in @var{file}. This is useful to
7530check if any packages of the user manifest can be updated.
7531
7532@item --type=@var{updater}
7533@itemx -t @var{updater}
7534Select only packages handled by @var{updater} (may be a comma-separated list
7535of updaters). Currently, @var{updater} may be one of:
7536
7537@table @code
7538@item gnu
7539the updater for GNU packages;
7540@item gnome
7541the updater for GNOME packages;
7542@item kde
7543the updater for KDE packages;
7544@item xorg
7545the updater for X.org packages;
7546@item kernel.org
7547the updater for packages hosted on kernel.org;
7548@item elpa
7549the updater for @uref{http://elpa.gnu.org/, ELPA} packages;
7550@item cran
7551the updater for @uref{https://cran.r-project.org/, CRAN} packages;
7552@item bioconductor
7553the updater for @uref{https://www.bioconductor.org/, Bioconductor} R
7554packages;
7555@item cpan
7556the updater for @uref{http://www.cpan.org/, CPAN} packages;
7557@item pypi
7558the updater for @uref{https://pypi.python.org, PyPI} packages.
7559@item gem
7560the updater for @uref{https://rubygems.org, RubyGems} packages.
7561@item github
7562the updater for @uref{https://github.com, GitHub} packages.
7563@item hackage
7564the updater for @uref{https://hackage.haskell.org, Hackage} packages.
7565@item stackage
7566the updater for @uref{https://www.stackage.org, Stackage} packages.
7567@item crate
7568the updater for @uref{https://crates.io, Crates} packages.
7569@end table
7570
7571For instance, the following command only checks for updates of Emacs
7572packages hosted at @code{elpa.gnu.org} and for updates of CRAN packages:
7573
7574@example
7575$ guix refresh --type=elpa,cran
7576gnu/packages/statistics.scm:819:13: r-testthat would be upgraded from 0.10.0 to 0.11.0
7577gnu/packages/emacs.scm:856:13: emacs-auctex would be upgraded from 11.88.6 to 11.88.9
7578@end example
7579
7580@end table
7581
7582In addition, @command{guix refresh} can be passed one or more package names,
7583as in this example:
7584
7585@example
7586$ ./pre-inst-env guix refresh -u emacs idutils gcc@@4.8
7587@end example
7588
7589@noindent
7590The command above specifically updates the @code{emacs} and @code{idutils}
7591packages. The @code{--select} option would have no effect in this case.
7592
7593When considering whether to upgrade a package, it is sometimes convenient to
7594know which packages would be affected by the upgrade and should be checked
7595for compatibility. For this the following option may be used when passing
7596@command{guix refresh} one or more package names:
7597
7598@table @code
7599
7600@item --list-updaters
7601@itemx -L
7602List available updaters and exit (see @option{--type} above.)
7603
7604For each updater, display the fraction of packages it covers; at the end,
7605display the fraction of packages covered by all these updaters.
7606
7607@item --list-dependent
7608@itemx -l
7609List top-level dependent packages that would need to be rebuilt as a result
7610of upgrading one or more packages.
7611
7612@xref{Aufruf von guix graph, the @code{reverse-package} type of @command{guix
7613graph}}, for information on how to visualize the list of dependents of a
7614package.
7615
7616@end table
7617
7618Be aware that the @code{--list-dependent} option only @emph{approximates}
7619the rebuilds that would be required as a result of an upgrade. More
7620rebuilds might be required under some circumstances.
7621
7622@example
7623$ guix refresh --list-dependent flex
7624Building the following 120 packages would ensure 213 dependent packages are rebuilt:
7625hop@@2.4.0 geiser@@0.4 notmuch@@0.18 mu@@0.9.9.5 cflow@@1.4 idutils@@4.6 @dots{}
7626@end example
7627
7628The command above lists a set of packages that could be built to check for
7629compatibility with an upgraded @code{flex} package.
7630
7631The following options can be used to customize GnuPG operation:
7632
7633@table @code
7634
7635@item --gpg=@var{command}
7636Use @var{command} as the GnuPG 2.x command. @var{command} is searched for
7637in @code{$PATH}.
7638
7639@item --keyring=@var{file}
7640Use @var{file} as the keyring for upstream keys. @var{file} must be in the
7641@dfn{keybox format}. Keybox files usually have a name ending in @file{.kbx}
7642and the GNU@tie{}Privacy Guard (GPG) can manipulate these files
7643(@pxref{kbxutil, @command{kbxutil},, gnupg, Using the GNU Privacy Guard},
7644for information on a tool to manipulate keybox files).
7645
7646When this option is omitted, @command{guix refresh} uses
7647@file{~/.config/guix/upstream/trustedkeys.kbx} as the keyring for upstream
7648signing keys. OpenPGP signatures are checked against keys from this
7649keyring; missing keys are downloaded to this keyring as well (see
7650@option{--key-download} below.)
7651
7652You can export keys from your default GPG keyring into a keybox file using
7653commands like this one:
7654
7655@example
7656gpg --export rms@@gnu.org | kbxutil --import-openpgp >> mykeyring.kbx
7657@end example
7658
7659Likewise, you can fetch keys to a specific keybox file like this:
7660
7661@example
7662gpg --no-default-keyring --keyring mykeyring.kbx \
7663 --recv-keys @value{OPENPGP-SIGNING-KEY-ID}
7664@end example
7665
7666@ref{GPG Configuration Options, @option{--keyring},, gnupg, Using the GNU
7667Privacy Guard}, for more information on GPG's @option{--keyring} option.
7668
7669@item --key-download=@var{policy}
7670Handle missing OpenPGP keys according to @var{policy}, which may be one of:
7671
7672@table @code
7673@item always
7674Always download missing OpenPGP keys from the key server, and add them to
7675the user's GnuPG keyring.
7676
7677@item never
7678Never try to download missing OpenPGP keys. Instead just bail out.
7679
7680@item interactive
7681When a package signed with an unknown OpenPGP key is encountered, ask the
7682user whether to download it or not. This is the default behavior.
7683@end table
7684
7685@item --key-server=@var{host}
7686Use @var{host} as the OpenPGP key server when importing a public key.
7687
7688@end table
7689
7690The @code{github} updater uses the @uref{https://developer.github.com/v3/,
793dcd8c 7691GitHub API} to query for new releases. When used repeatedly e.g.@: when
1e40e70b
JL
7692refreshing all packages, GitHub will eventually refuse to answer any further
7693API requests. By default 60 API requests per hour are allowed, and a full
7694refresh on all GitHub packages in Guix requires more than this.
7695Authentication with GitHub through the use of an API token alleviates these
7696limits. To use an API token, set the environment variable
7697@code{GUIX_GITHUB_TOKEN} to a token procured from
7698@uref{https://github.com/settings/tokens} or otherwise.
7699
7700
7701@node Aufruf von guix lint
7702@section Invoking @command{guix lint}
7703
7704@cindex @command{guix lint}
7705@cindex package, checking for errors
7706The @command{guix lint} command is meant to help package developers avoid
7707common errors and use a consistent style. It runs a number of checks on a
7708given set of packages in order to find common mistakes in their
7709definitions. Available @dfn{checkers} include (see @code{--list-checkers}
7710for a complete list):
7711
7712@table @code
7713@item synopsis
7714@itemx description
7715Validate certain typographical and stylistic rules about package
7716descriptions and synopses.
7717
7718@item inputs-should-be-native
7719Identify inputs that should most likely be native inputs.
7720
7721@item source
7722@itemx home-page
7723@itemx mirror-url
7724@itemx source-file-name
7725Probe @code{home-page} and @code{source} URLs and report those that are
7726invalid. Suggest a @code{mirror://} URL when applicable. Check that the
793dcd8c 7727source file name is meaningful, e.g.@: is not just a version number or
1e40e70b
JL
7728``git-checkout'', without a declared @code{file-name} (@pxref{„origin“-Referenz}).
7729
7730@item cve
7731@cindex security vulnerabilities
7732@cindex CVE, Common Vulnerabilities and Exposures
7733Report known vulnerabilities found in the Common Vulnerabilities and
7734Exposures (CVE) databases of the current and past year
7735@uref{https://nvd.nist.gov/download.cfm#CVE_FEED, published by the US NIST}.
7736
7737To view information about a particular vulnerability, visit pages such as:
7738
7739@itemize
7740@item
7741@indicateurl{https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-YYYY-ABCD}
7742@item
7743@indicateurl{https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-YYYY-ABCD}
7744@end itemize
7745
7746@noindent
7747where @code{CVE-YYYY-ABCD} is the CVE identifier---e.g.,
7748@code{CVE-2015-7554}.
7749
7750Package developers can specify in package recipes the
7751@uref{https://nvd.nist.gov/cpe.cfm,Common Platform Enumeration (CPE)} name
7752and version of the package when they differ from the name or version that
7753Guix uses, as in this example:
7754
7755@example
7756(package
7757 (name "grub")
7758 ;; @dots{}
7759 ;; CPE calls this package "grub2".
7760 (properties '((cpe-name . "grub2")
7761 (cpe-version . "2.3")))
7762@end example
7763
7764@c See <http://www.openwall.com/lists/oss-security/2017/03/15/3>.
7765Some entries in the CVE database do not specify which version of a package
7766they apply to, and would thus ``stick around'' forever. Package developers
7767who found CVE alerts and verified they can be ignored can declare them as in
7768this example:
7769
7770@example
7771(package
7772 (name "t1lib")
7773 ;; @dots{}
7774 ;; These CVEs no longer apply and can be safely ignored.
7775 (properties `((lint-hidden-cve . ("CVE-2011-0433"
7776 "CVE-2011-1553"
7777 "CVE-2011-1554"
7778 "CVE-2011-5244")))))
7779@end example
7780
7781@item formatting
7782Warn about obvious source code formatting issues: trailing white space, use
7783of tabulations, etc.
7784@end table
7785
7786The general syntax is:
7787
7788@example
7789guix lint @var{options} @var{package}@dots{}
7790@end example
7791
7792If no package is given on the command line, then all packages are checked.
7793The @var{options} may be zero or more of the following:
7794
7795@table @code
7796@item --list-checkers
7797@itemx -l
7798List and describe all the available checkers that will be run on packages
7799and exit.
7800
7801@item --checkers
7802@itemx -c
7803Only enable the checkers specified in a comma-separated list using the names
7804returned by @code{--list-checkers}.
7805
7806@end table
7807
7808@node Aufruf von guix size
7809@section Invoking @command{guix size}
7810
7811@cindex size
7812@cindex package size
7813@cindex Abschluss
7814@cindex @command{guix size}
7815The @command{guix size} command helps package developers profile the disk
7816usage of packages. It is easy to overlook the impact of an additional
7817dependency added to a package, or the impact of using a single output for a
7818package that could easily be split (@pxref{Pakete mit mehreren Ausgaben.}). Such are the typical issues that @command{guix size} can
7819highlight.
7820
7821The command can be passed one or more package specifications such as
7822@code{gcc@@4.8} or @code{guile:debug}, or a file name in the store.
7823Consider this example:
7824
7825@example
7826$ guix size coreutils
7827store item total self
7828/gnu/store/@dots{}-gcc-5.5.0-lib 60.4 30.1 38.1%
7829/gnu/store/@dots{}-glibc-2.27 30.3 28.8 36.6%
7830/gnu/store/@dots{}-coreutils-8.28 78.9 15.0 19.0%
7831/gnu/store/@dots{}-gmp-6.1.2 63.1 2.7 3.4%
7832/gnu/store/@dots{}-bash-static-4.4.12 1.5 1.5 1.9%
7833/gnu/store/@dots{}-acl-2.2.52 61.1 0.4 0.5%
7834/gnu/store/@dots{}-attr-2.4.47 60.6 0.2 0.3%
7835/gnu/store/@dots{}-libcap-2.25 60.5 0.2 0.2%
7836total: 78.9 MiB
7837@end example
7838
7839@cindex Abschluss
7840The store items listed here constitute the @dfn{transitive closure} of
7841Coreutils---i.e., Coreutils and all its dependencies, recursively---as would
7842be returned by:
7843
7844@example
7845$ guix gc -R /gnu/store/@dots{}-coreutils-8.23
7846@end example
7847
7848Here the output shows three columns next to store items. The first column,
7849labeled ``total'', shows the size in mebibytes (MiB) of the closure of the
7850store item---that is, its own size plus the size of all its dependencies.
7851The next column, labeled ``self'', shows the size of the item itself. The
7852last column shows the ratio of the size of the item itself to the space
7853occupied by all the items listed here.
7854
7855In this example, we see that the closure of Coreutils weighs in at
785679@tie{}MiB, most of which is taken by libc and GCC's run-time support
7857libraries. (That libc and GCC's libraries represent a large fraction of the
7858closure is not a problem @i{per se} because they are always available on the
7859system anyway.)
7860
7861When the package(s) passed to @command{guix size} are available in the
7862store@footnote{More precisely, @command{guix size} looks for the
7863@emph{ungrafted} variant of the given package(s), as returned by @code{guix
7864build @var{package} --no-grafts}. @xref{Sicherheitsaktualisierungen}, for information
7865on grafts.}, @command{guix size} queries the daemon to determine its
7866dependencies, and measures its size in the store, similar to @command{du -ms
7867--apparent-size} (@pxref{du invocation,,, coreutils, GNU Coreutils}).
7868
7869When the given packages are @emph{not} in the store, @command{guix size}
7870reports information based on the available substitutes
7871(@pxref{Substitute}). This makes it possible it to profile disk usage of
7872store items that are not even on disk, only available remotely.
7873
7874You can also specify several package names:
7875
7876@example
7877$ guix size coreutils grep sed bash
7878store item total self
7879/gnu/store/@dots{}-coreutils-8.24 77.8 13.8 13.4%
7880/gnu/store/@dots{}-grep-2.22 73.1 0.8 0.8%
7881/gnu/store/@dots{}-bash-4.3.42 72.3 4.7 4.6%
7882/gnu/store/@dots{}-readline-6.3 67.6 1.2 1.2%
7883@dots{}
7884total: 102.3 MiB
7885@end example
7886
7887@noindent
7888In this example we see that the combination of the four packages takes
7889102.3@tie{}MiB in total, which is much less than the sum of each closure
7890since they have a lot of dependencies in common.
7891
7892The available options are:
7893
7894@table @option
7895
7896@item --substitute-urls=@var{URLs}
7897Use substitute information from @var{urls}. @xref{client-substitute-urls,
7898the same option for @code{guix build}}.
7899
7900@item --sort=@var{key}
7901Sort lines according to @var{key}, one of the following options:
7902
7903@table @code
7904@item self
7905the size of each item (the default);
7906@item Abschluss
7907the total size of the item's closure.
7908@end table
7909
7910@item --map-file=@var{file}
7911Write a graphical map of disk usage in PNG format to @var{file}.
7912
7913For the example above, the map looks like this:
7914
7915@image{images/coreutils-size-map,5in,, map of Coreutils disk usage produced
7916by @command{guix size}}
7917
7918This option requires that
7919@uref{http://wingolog.org/software/guile-charting/, Guile-Charting} be
7920installed and visible in Guile's module search path. When that is not the
7921case, @command{guix size} fails as it tries to load it.
7922
7923@item --system=@var{System}
7924@itemx -s @var{system}
7925Consider packages for @var{system}---e.g., @code{x86_64-linux}.
7926
7927@end table
7928
7929@node Aufruf von guix graph
7930@section Invoking @command{guix graph}
7931
7932@cindex DAG
7933@cindex @command{guix graph}
7934@cindex Paketabhängigkeiten
7935Packages and their dependencies form a @dfn{graph}, specifically a directed
7936acyclic graph (DAG). It can quickly become difficult to have a mental model
7937of the package DAG, so the @command{guix graph} command provides a visual
7938representation of the DAG. By default, @command{guix graph} emits a DAG
7939representation in the input format of @uref{http://www.graphviz.org/,
7940Graphviz}, so its output can be passed directly to the @command{dot} command
7941of Graphviz. It can also emit an HTML page with embedded JavaScript code to
7942display a ``chord diagram'' in a Web browser, using the
7943@uref{https://d3js.org/, d3.js} library, or emit Cypher queries to construct
7944a graph in a graph database supporting the @uref{http://www.opencypher.org/,
7945openCypher} query language. The general syntax is:
7946
7947@example
7948guix graph @var{options} @var{package}@dots{}
7949@end example
7950
7951For example, the following command generates a PDF file representing the
7952package DAG for the GNU@tie{}Core Utilities, showing its build-time
7953dependencies:
7954
7955@example
7956guix graph coreutils | dot -Tpdf > dag.pdf
7957@end example
7958
7959The output looks like this:
7960
7961@image{images/coreutils-graph,2in,,Dependency graph of the GNU Coreutils}
7962
7963Nice little graph, no?
7964
7965But there is more than one graph! The one above is concise: it is the graph
7966of package objects, omitting implicit inputs such as GCC, libc, grep, etc.
7967It is often useful to have such a concise graph, but sometimes one may want
7968to see more details. @command{guix graph} supports several types of graphs,
7969allowing you to choose the level of detail:
7970
7971@table @code
7972@item package
7973This is the default type used in the example above. It shows the DAG of
7974package objects, excluding implicit dependencies. It is concise, but
7975filters out many details.
7976
7977@item reverse-package
7978This shows the @emph{reverse} DAG of packages. For example:
7979
7980@example
7981guix graph --type=reverse-package ocaml
7982@end example
7983
793dcd8c 7984...@: yields the graph of packages that depend on OCaml.
1e40e70b
JL
7985
7986Note that for core packages this can yield huge graphs. If all you want is
7987to know the number of packages that depend on a given package, use
7988@command{guix refresh --list-dependent} (@pxref{Aufruf von guix refresh,
7989@option{--list-dependent}}).
7990
7991@item bag-emerged
7992This is the package DAG, @emph{including} implicit inputs.
7993
7994For instance, the following command:
7995
7996@example
7997guix graph --type=bag-emerged coreutils | dot -Tpdf > dag.pdf
7998@end example
7999
793dcd8c 8000...@: yields this bigger graph:
1e40e70b
JL
8001
8002@image{images/coreutils-bag-graph,,5in,Detailed dependency graph of the GNU
8003Coreutils}
8004
8005At the bottom of the graph, we see all the implicit inputs of
8006@var{gnu-build-system} (@pxref{Erstellungssysteme, @code{gnu-build-system}}).
8007
8008Now, note that the dependencies of these implicit inputs---that is, the
8009@dfn{bootstrap dependencies} (@pxref{Bootstrapping})---are not shown here,
8010for conciseness.
8011
8012@item bag
8013Similar to @code{bag-emerged}, but this time including all the bootstrap
8014dependencies.
8015
8016@item bag-with-origins
8017Similar to @code{bag}, but also showing origins and their dependencies.
8018
8019@item Ableitung
8020This is the most detailed representation: It shows the DAG of derivations
8021(@pxref{Ableitungen}) and plain store items. Compared to the above
8022representation, many additional nodes are visible, including build scripts,
8023patches, Guile modules, etc.
8024
8025For this type of graph, it is also possible to pass a @file{.drv} file name
8026instead of a package name, as in:
8027
8028@example
8029guix graph -t derivation `guix system build -d my-config.scm`
8030@end example
8031
8032@item module
8033This is the graph of @dfn{package modules} (@pxref{Paketmodule}). For
8034example, the following command shows the graph for the package module that
8035defines the @code{guile} package:
8036
8037@example
8038guix graph -t module guile | dot -Tpdf > module-graph.pdf
8039@end example
8040@end table
8041
8042All the types above correspond to @emph{build-time dependencies}. The
8043following graph type represents the @emph{run-time dependencies}:
8044
8045@table @code
8046@item references
8047This is the graph of @dfn{references} of a package output, as returned by
8048@command{guix gc --references} (@pxref{Aufruf von guix gc}).
8049
8050If the given package output is not available in the store, @command{guix
8051graph} attempts to obtain dependency information from substitutes.
8052
8053Here you can also pass a store file name instead of a package name. For
8054example, the command below produces the reference graph of your profile
8055(which can be big!):
8056
8057@example
8058guix graph -t references `readlink -f ~/.guix-profile`
8059@end example
8060
8061@item referrers
8062This is the graph of the @dfn{referrers} of a store item, as returned by
8063@command{guix gc --referrers} (@pxref{Aufruf von guix gc}).
8064
8065This relies exclusively on local information from your store. For instance,
8066let us suppose that the current Inkscape is available in 10 profiles on your
8067machine; @command{guix graph -t referrers inkscape} will show a graph rooted
8068at Inkscape and with those 10 profiles linked to it.
8069
8070It can help determine what is preventing a store item from being garbage
8071collected.
8072
8073@end table
8074
8075The available options are the following:
8076
8077@table @option
8078@item --type=@var{type}
8079@itemx -t @var{type}
8080Produce a graph output of @var{type}, where @var{type} must be one of the
8081values listed above.
8082
8083@item --list-types
8084List the supported graph types.
8085
8086@item --backend=@var{backend}
8087@itemx -b @var{backend}
8088Produce a graph using the selected @var{backend}.
8089
8090@item --list-backends
8091List the supported graph backends.
8092
8093Currently, the available backends are Graphviz and d3.js.
8094
8095@item --expression=@var{expr}
8096@itemx -e @var{expr}
8097Consider the package @var{expr} evaluates to.
8098
8099This is useful to precisely refer to a package, as in this example:
8100
8101@example
8102guix graph -e '(@@@@ (gnu packages commencement) gnu-make-final)'
8103@end example
8104
8105@item --system=@var{System}
8106@itemx -s @var{system}
8107Display the graph for @var{system}---e.g., @code{i686-linux}.
8108
8109The package dependency graph is largely architecture-independent, but there
8110are some architecture-dependent bits that this option allows you to
8111visualize.
8112@end table
8113
8114
8115@node Aufruf von guix environment
8116@section Invoking @command{guix environment}
8117
8118@cindex reproducible build environments
8119@cindex development environments
8120@cindex @command{guix environment}
8121@cindex environment, package build environment
8122The purpose of @command{guix environment} is to assist hackers in creating
8123reproducible development environments without polluting their package
8124profile. The @command{guix environment} tool takes one or more packages,
8125builds all of their inputs, and creates a shell environment to use them.
8126
8127The general syntax is:
8128
8129@example
8130guix environment @var{options} @var{package}@dots{}
8131@end example
8132
8133The following example spawns a new shell set up for the development of
8134GNU@tie{}Guile:
8135
8136@example
8137guix environment guile
8138@end example
8139
8140If the needed dependencies are not built yet, @command{guix environment}
8141automatically builds them. The environment of the new shell is an augmented
8142version of the environment that @command{guix environment} was run in. It
8143contains the necessary search paths for building the given package added to
8144the existing environment variables. To create a ``pure'' environment, in
8145which the original environment variables have been unset, use the
8146@code{--pure} option@footnote{Users sometimes wrongfully augment environment
8147variables such as @code{PATH} in their @file{~/.bashrc} file. As a
8148consequence, when @code{guix environment} launches it, Bash may read
8149@file{~/.bashrc}, thereby introducing ``impurities'' in these environment
8150variables. It is an error to define such environment variables in
8151@file{.bashrc}; instead, they should be defined in @file{.bash_profile},
8152which is sourced only by log-in shells. @xref{Bash Startup Files,,, bash,
8153The GNU Bash Reference Manual}, for details on Bash start-up files.}.
8154
8155@vindex GUIX_ENVIRONMENT
8156@command{guix environment} defines the @code{GUIX_ENVIRONMENT} variable in
8157the shell it spawns; its value is the file name of the profile of this
8158environment. This allows users to, say, define a specific prompt for
8159development environments in their @file{.bashrc} (@pxref{Bash Startup
8160Files,,, bash, The GNU Bash Reference Manual}):
8161
8162@example
8163if [ -n "$GUIX_ENVIRONMENT" ]
8164then
8165 export PS1="\u@@\h \w [dev]\$ "
8166fi
8167@end example
8168
8169@noindent
793dcd8c 8170...@: or to browse the profile:
1e40e70b
JL
8171
8172@example
8173$ ls "$GUIX_ENVIRONMENT/bin"
8174@end example
8175
8176Additionally, more than one package may be specified, in which case the
8177union of the inputs for the given packages are used. For example, the
8178command below spawns a shell where all of the dependencies of both Guile and
8179Emacs are available:
8180
8181@example
8182guix environment guile emacs
8183@end example
8184
8185Sometimes an interactive shell session is not desired. An arbitrary command
8186may be invoked by placing the @code{--} token to separate the command from
8187the rest of the arguments:
8188
8189@example
8190guix environment guile -- make -j4
8191@end example
8192
8193In other situations, it is more convenient to specify the list of packages
8194needed in the environment. For example, the following command runs
8195@command{python} from an environment containing Python@tie{}2.7 and NumPy:
8196
8197@example
8198guix environment --ad-hoc python2-numpy python-2.7 -- python
8199@end example
8200
8201Furthermore, one might want the dependencies of a package and also some
8202additional packages that are not build-time or runtime dependencies, but are
8203useful when developing nonetheless. Because of this, the @code{--ad-hoc}
8204flag is positional. Packages appearing before @code{--ad-hoc} are
8205interpreted as packages whose dependencies will be added to the
8206environment. Packages appearing after are interpreted as packages that will
8207be added to the environment directly. For example, the following command
8208creates a Guix development environment that additionally includes Git and
8209strace:
8210
8211@example
8212guix environment guix --ad-hoc git strace
8213@end example
8214
8215Sometimes it is desirable to isolate the environment as much as possible,
8216for maximal purity and reproducibility. In particular, when using Guix on a
8217host distro that is not GuixSD, it is desirable to prevent access to
8218@file{/usr/bin} and other system-wide resources from the development
8219environment. For example, the following command spawns a Guile REPL in a
8220``container'' where only the store and the current working directory are
8221mounted:
8222
8223@example
8224guix environment --ad-hoc --container guile -- guile
8225@end example
8226
8227@quotation Anmerkung
8228The @code{--container} option requires Linux-libre 3.19 or newer.
8229@end quotation
8230
8231The available options are summarized below.
8232
8233@table @code
8234@item --root=@var{file}
8235@itemx -r @var{file}
8236@cindex persistent environment
8237@cindex garbage collector root, for environments
8238Make @var{file} a symlink to the profile for this environment, and register
8239it as a garbage collector root.
8240
8241This is useful if you want to protect your environment from garbage
8242collection, to make it ``persistent''.
8243
8244When this option is omitted, the environment is protected from garbage
8245collection only for the duration of the @command{guix environment} session.
8246This means that next time you recreate the same environment, you could have
8247to rebuild or re-download packages. @xref{Aufruf von guix gc}, for more on GC
8248roots.
8249
8250@item --expression=@var{expr}
8251@itemx -e @var{expr}
8252Create an environment for the package or list of packages that @var{expr}
8253evaluates to.
8254
8255For example, running:
8256
8257@example
8258guix environment -e '(@@ (gnu packages maths) petsc-openmpi)'
8259@end example
8260
8261starts a shell with the environment for this specific variant of the PETSc
8262package.
8263
8264Running:
8265
8266@example
8267guix environment --ad-hoc -e '(@@ (gnu) %base-packages)'
8268@end example
8269
8270starts a shell with all the GuixSD base packages available.
8271
8272The above commands only use the default output of the given packages. To
8273select other outputs, two element tuples can be specified:
8274
8275@example
8276guix environment --ad-hoc -e '(list (@@ (gnu packages bash) bash) "include")'
8277@end example
8278
8279@item --load=@var{file}
8280@itemx -l @var{file}
8281Create an environment for the package or list of packages that the code
8282within @var{file} evaluates to.
8283
8284Zum Beispiel könnte die @var{Datei} eine Definition wie diese enthalten
8285(@pxref{Pakete definieren}):
8286
8287@example
8288@verbatiminclude environment-gdb.scm
8289@end example
8290
8291@item --manifest=@var{Datei}
8292@itemx -m @var{Datei}
8293Create an environment for the packages contained in the manifest object
8294returned by the Scheme code in @var{file}.
8295
8296This is similar to the same-named option in @command{guix package}
8297(@pxref{profile-manifest, @option{--manifest}}) and uses the same manifest
8298files.
8299
8300@item --ad-hoc
8301Include all specified packages in the resulting environment, as if an @i{ad
8302hoc} package were defined with them as inputs. This option is useful for
8303quickly creating an environment without having to write a package expression
8304to contain the desired inputs.
8305
8306For instance, the command:
8307
8308@example
8309guix environment --ad-hoc guile guile-sdl -- guile
8310@end example
8311
8312runs @command{guile} in an environment where Guile and Guile-SDL are
8313available.
8314
8315Note that this example implicitly asks for the default output of
8316@code{guile} and @code{guile-sdl}, but it is possible to ask for a specific
8317output---e.g., @code{glib:bin} asks for the @code{bin} output of @code{glib}
8318(@pxref{Pakete mit mehreren Ausgaben.}).
8319
8320This option may be composed with the default behavior of @command{guix
8321environment}. Packages appearing before @code{--ad-hoc} are interpreted as
8322packages whose dependencies will be added to the environment, the default
8323behavior. Packages appearing after are interpreted as packages that will be
8324added to the environment directly.
8325
8326@item --pure
8327Unset existing environment variables when building the new environment.
8328This has the effect of creating an environment in which search paths only
8329contain package inputs.
8330
8331@item --search-paths
8332Display the environment variable definitions that make up the environment.
8333
8334@item --system=@var{System}
8335@itemx -s @var{system}
8336Attempt to build for @var{system}---e.g., @code{i686-linux}.
8337
8338@item --container
8339@itemx -C
8340@cindex container
8341Run @var{command} within an isolated container. The current working
8342directory outside the container is mapped inside the container.
8343Additionally, unless overridden with @code{--user}, a dummy home directory
8344is created that matches the current user's home directory, and
8345@file{/etc/passwd} is configured accordingly. The spawned process runs as
8346the current user outside the container, but has root privileges in the
8347context of the container.
8348
8349@item --network
8350@itemx -N
8351For containers, share the network namespace with the host system.
8352Containers created without this flag only have access to the loopback
8353device.
8354
8355@item --link-profile
8356@itemx -P
8357For containers, link the environment profile to @file{~/.guix-profile}
8358within the container. This is equivalent to running the command @command{ln
8359-s $GUIX_ENVIRONMENT ~/.guix-profile} within the container. Linking will
8360fail and abort the environment if the directory already exists, which will
8361certainly be the case if @command{guix environment} was invoked in the
8362user's home directory.
8363
8364Certain packages are configured to look in @code{~/.guix-profile} for
8365configuration files and data;@footnote{For example, the @code{fontconfig}
8366package inspects @file{~/.guix-profile/share/fonts} for additional fonts.}
8367@code{--link-profile} allows these programs to behave as expected within the
8368environment.
8369
8370@item --user=@var{user}
8371@itemx -u @var{user}
8372For containers, use the username @var{user} in place of the current user.
8373The generated @file{/etc/passwd} entry within the container will contain the
8374name @var{user}; the home directory will be @file{/home/USER}; and no user
8375GECOS data will be copied. @var{user} need not exist on the system.
8376
8377Additionally, any shared or exposed path (see @code{--share} and
8378@code{--expose} respectively) whose target is within the current user's home
8379directory will be remapped relative to @file{/home/USER}; this includes the
8380automatic mapping of the current working directory.
8381
8382@example
8383# will expose paths as /home/foo/wd, /home/foo/test, and /home/foo/target
8384cd $HOME/wd
8385guix environment --container --user=foo \
8386 --expose=$HOME/test \
8387 --expose=/tmp/target=$HOME/target
8388@end example
8389
8390While this will limit the leaking of user identity through home paths and
8391each of the user fields, this is only one useful component of a broader
8392privacy/anonymity solution---not one in and of itself.
8393
8394@item --expose=@var{source}[=@var{target}]
8395For containers, expose the file system @var{source} from the host system as
8396the read-only file system @var{target} within the container. If
8397@var{target} is not specified, @var{source} is used as the target mount
8398point in the container.
8399
8400The example below spawns a Guile REPL in a container in which the user's
8401home directory is accessible read-only via the @file{/exchange} directory:
8402
8403@example
8404guix environment --container --expose=$HOME=/exchange --ad-hoc guile -- guile
8405@end example
8406
8407@item --share=@var{source}[=@var{target}]
8408For containers, share the file system @var{source} from the host system as
8409the writable file system @var{target} within the container. If @var{target}
8410is not specified, @var{source} is used as the target mount point in the
8411container.
8412
8413The example below spawns a Guile REPL in a container in which the user's
8414home directory is accessible for both reading and writing via the
8415@file{/exchange} directory:
8416
8417@example
8418guix environment --container --share=$HOME=/exchange --ad-hoc guile -- guile
8419@end example
8420@end table
8421
8422@command{guix environment} also supports all of the common build options
8423that @command{guix build} supports (@pxref{Gemeinsame Erstellungsoptionen}).
8424
8425
8426@node Aufruf von guix publish
8427@section Invoking @command{guix publish}
8428
8429@cindex @command{guix publish}
8430The purpose of @command{guix publish} is to enable users to easily share
8431their store with others, who can then use it as a substitute server
8432(@pxref{Substitute}).
8433
8434When @command{guix publish} runs, it spawns an HTTP server which allows
8435anyone with network access to obtain substitutes from it. This means that
8436any machine running Guix can also act as if it were a build farm, since the
8437HTTP interface is compatible with Hydra, the software behind the
8438@code{hydra.gnu.org} build farm.
8439
8440For security, each substitute is signed, allowing recipients to check their
8441authenticity and integrity (@pxref{Substitute}). Because @command{guix
8442publish} uses the signing key of the system, which is only readable by the
8443system administrator, it must be started as root; the @code{--user} option
8444makes it drop root privileges early on.
8445
8446The signing key pair must be generated before @command{guix publish} is
8447launched, using @command{guix archive --generate-key} (@pxref{Aufruf von guix archive}).
8448
8449The general syntax is:
8450
8451@example
8452guix publish @var{options}@dots{}
8453@end example
8454
8455Running @command{guix publish} without any additional arguments will spawn
8456an HTTP server on port 8080:
8457
8458@example
8459guix publish
8460@end example
8461
8462Once a publishing server has been authorized (@pxref{Aufruf von guix archive}), the daemon may download substitutes from it:
8463
8464@example
8465guix-daemon --substitute-urls=http://example.org:8080
8466@end example
8467
8468By default, @command{guix publish} compresses archives on the fly as it
8469serves them. This ``on-the-fly'' mode is convenient in that it requires no
8470setup and is immediately available. However, when serving lots of clients,
8471we recommend using the @option{--cache} option, which enables caching of the
8472archives before they are sent to clients---see below for details. The
8473@command{guix weather} command provides a handy way to check what a server
8474provides (@pxref{Aufruf von guix weather}).
8475
8476As a bonus, @command{guix publish} also serves as a content-addressed mirror
8477for source files referenced in @code{origin} records (@pxref{„origin“-Referenz}). For instance, assuming @command{guix publish} is running on
8478@code{example.org}, the following URL returns the raw
8479@file{hello-2.10.tar.gz} file with the given SHA256 hash (represented in
8480@code{nix-base32} format, @pxref{Aufruf von guix hash}):
8481
8482@example
8483http://example.org/file/hello-2.10.tar.gz/sha256/0ssi1@dots{}ndq1i
8484@end example
8485
8486Obviously, these URLs only work for files that are in the store; in other
8487cases, they return 404 (``Not Found'').
8488
8489@cindex build logs, publication
8490Build logs are available from @code{/log} URLs like:
8491
8492@example
8493http://example.org/log/gwspk@dots{}-guile-2.2.3
8494@end example
8495
8496@noindent
8497When @command{guix-daemon} is configured to save compressed build logs, as
8498is the case by default (@pxref{Aufruf des guix-daemon}), @code{/log} URLs
8499return the compressed log as-is, with an appropriate @code{Content-Type}
8500and/or @code{Content-Encoding} header. We recommend running
8501@command{guix-daemon} with @code{--log-compression=gzip} since Web browsers
8502can automatically decompress it, which is not the case with bzip2
8503compression.
8504
8505The following options are available:
8506
8507@table @code
8508@item --port=@var{port}
8509@itemx -p @var{port}
8510Listen for HTTP requests on @var{port}.
8511
8512@item --listen=@var{host}
8513Listen on the network interface for @var{host}. The default is to accept
8514connections from any interface.
8515
8516@item --user=@var{user}
8517@itemx -u @var{user}
8518Change privileges to @var{user} as soon as possible---i.e., once the server
8519socket is open and the signing key has been read.
8520
8521@item --compression[=@var{level}]
8522@itemx -C [@var{level}]
8523Compress data using the given @var{level}. When @var{level} is zero,
8524disable compression. The range 1 to 9 corresponds to different gzip
8525compression levels: 1 is the fastest, and 9 is the best (CPU-intensive).
8526The default is 3.
8527
8528Unless @option{--cache} is used, compression occurs on the fly and the
8529compressed streams are not cached. Thus, to reduce load on the machine that
8530runs @command{guix publish}, it may be a good idea to choose a low
8531compression level, to run @command{guix publish} behind a caching proxy, or
8532to use @option{--cache}. Using @option{--cache} has the advantage that it
8533allows @command{guix publish} to add @code{Content-Length} HTTP header to
8534its responses.
8535
8536@item --cache=@var{directory}
8537@itemx -c @var{directory}
8538Cache archives and meta-data (@code{.narinfo} URLs) to @var{directory} and
8539only serve archives that are in cache.
8540
8541When this option is omitted, archives and meta-data are created on-the-fly.
8542This can reduce the available bandwidth, especially when compression is
8543enabled, since this may become CPU-bound. Another drawback of the default
8544mode is that the length of archives is not known in advance, so
8545@command{guix publish} does not add a @code{Content-Length} HTTP header to
8546its responses, which in turn prevents clients from knowing the amount of
8547data being downloaded.
8548
8549Conversely, when @option{--cache} is used, the first request for a store
8550item (@i{via} a @code{.narinfo} URL) returns 404 and triggers a background
8551process to @dfn{bake} the archive---computing its @code{.narinfo} and
8552compressing the archive, if needed. Once the archive is cached in
8553@var{directory}, subsequent requests succeed and are served directly from
8554the cache, which guarantees that clients get the best possible bandwidth.
8555
8556The ``baking'' process is performed by worker threads. By default, one
8557thread per CPU core is created, but this can be customized. See
8558@option{--workers} below.
8559
8560When @option{--ttl} is used, cached entries are automatically deleted when
8561they have expired.
8562
8563@item --workers=@var{N}
8564When @option{--cache} is used, request the allocation of @var{N} worker
8565threads to ``bake'' archives.
8566
8567@item --ttl=@var{ttl}
8568Produce @code{Cache-Control} HTTP headers that advertise a time-to-live
8569(TTL) of @var{ttl}. @var{ttl} must denote a duration: @code{5d} means 5
8570days, @code{1m} means 1 month, and so on.
8571
8572This allows the user's Guix to keep substitute information in cache for
8573@var{ttl}. However, note that @code{guix publish} does not itself guarantee
8574that the store items it provides will indeed remain available for as long as
8575@var{ttl}.
8576
8577Additionally, when @option{--cache} is used, cached entries that have not
8578been accessed for @var{ttl} and that no longer have a corresponding item in
8579the store, may be deleted.
8580
8581@item --nar-path=@var{path}
8582Use @var{path} as the prefix for the URLs of ``nar'' files (@pxref{Aufruf von guix archive, normalized archives}).
8583
8584By default, nars are served at a URL such as
8585@code{/nar/gzip/@dots{}-coreutils-8.25}. This option allows you to change
8586the @code{/nar} part to @var{path}.
8587
8588@item --public-key=@var{file}
8589@itemx --private-key=@var{file}
8590Use the specific @var{file}s as the public/private key pair used to sign the
8591store items being published.
8592
8593The files must correspond to the same key pair (the private key is used for
8594signing and the public key is merely advertised in the signature metadata).
8595They must contain keys in the canonical s-expression format as produced by
8596@command{guix archive --generate-key} (@pxref{Aufruf von guix archive}). By
8597default, @file{/etc/guix/signing-key.pub} and
8598@file{/etc/guix/signing-key.sec} are used.
8599
8600@item --repl[=@var{port}]
8601@itemx -r [@var{port}]
8602Spawn a Guile REPL server (@pxref{REPL Servers,,, guile, GNU Guile Reference
8603Manual}) on @var{port} (37146 by default). This is used primarily for
8604debugging a running @command{guix publish} server.
8605@end table
8606
8607Enabling @command{guix publish} on a GuixSD system is a one-liner: just
8608instantiate a @code{guix-publish-service-type} service in the
8609@code{services} field of the @code{operating-system} declaration
8610(@pxref{guix-publish-service-type, @code{guix-publish-service-type}}).
8611
8612If you are instead running Guix on a ``foreign distro'', follow these
8613instructions:”
8614
8615@itemize
8616@item
8617If your host distro uses the systemd init system:
8618
8619@example
8620# ln -s ~root/.guix-profile/lib/systemd/system/guix-publish.service \
8621 /etc/systemd/system/
8622# systemctl start guix-publish && systemctl enable guix-publish
8623@end example
8624
8625@item
8626Wenn Ihre Wirts-Distribution als »init«-System Upstart verwendet:
8627
8628@example
8629# ln -s ~root/.guix-profile/lib/upstart/system/guix-publish.conf /etc/init/
8630# start guix-publish
8631@end example
8632
8633@item
8634Otherwise, proceed similarly with your distro's init system.
8635@end itemize
8636
8637@node Aufruf von guix challenge
8638@section Invoking @command{guix challenge}
8639
8640@cindex Reproduzierbare Erstellungen
8641@cindex verifiable builds
8642@cindex @command{guix challenge}
8643@cindex challenge
8644Do the binaries provided by this server really correspond to the source code
8645it claims to build? Is a package build process deterministic? These are the
8646questions the @command{guix challenge} command attempts to answer.
8647
8648The former is obviously an important question: Before using a substitute
8649server (@pxref{Substitute}), one had better @emph{verify} that it provides
8650the right binaries, and thus @emph{challenge} it. The latter is what
8651enables the former: If package builds are deterministic, then independent
8652builds of the package should yield the exact same result, bit for bit; if a
8653server provides a binary different from the one obtained locally, it may be
8654either corrupt or malicious.
8655
8656We know that the hash that shows up in @file{/gnu/store} file names is the
8657hash of all the inputs of the process that built the file or
8658directory---compilers, libraries, build scripts,
8659etc. (@pxref{Einführung}). Assuming deterministic build processes, one
8660store file name should map to exactly one build output. @command{guix
8661challenge} checks whether there is, indeed, a single mapping by comparing
8662the build outputs of several independent builds of any given store item.
8663
8664The command output looks like this:
8665
8666@smallexample
8667$ guix challenge --substitute-urls="https://hydra.gnu.org https://guix.example.org"
8668updating list of substitutes from 'https://hydra.gnu.org'... 100.0%
8669updating list of substitutes from 'https://guix.example.org'... 100.0%
8670/gnu/store/@dots{}-openssl-1.0.2d contents differ:
8671 local hash: 0725l22r5jnzazaacncwsvp9kgf42266ayyp814v7djxs7nk963q
8672 https://hydra.gnu.org/nar/@dots{}-openssl-1.0.2d: 0725l22r5jnzazaacncwsvp9kgf42266ayyp814v7djxs7nk963q
8673 https://guix.example.org/nar/@dots{}-openssl-1.0.2d: 1zy4fmaaqcnjrzzajkdn3f5gmjk754b43qkq47llbyak9z0qjyim
8674/gnu/store/@dots{}-git-2.5.0 contents differ:
8675 local hash: 00p3bmryhjxrhpn2gxs2fy0a15lnip05l97205pgbk5ra395hyha
8676 https://hydra.gnu.org/nar/@dots{}-git-2.5.0: 069nb85bv4d4a6slrwjdy8v1cn4cwspm3kdbmyb81d6zckj3nq9f
8677 https://guix.example.org/nar/@dots{}-git-2.5.0: 0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73
8678/gnu/store/@dots{}-pius-2.1.1 contents differ:
8679 local hash: 0k4v3m9z1zp8xzzizb7d8kjj72f9172xv078sq4wl73vnq9ig3ax
8680 https://hydra.gnu.org/nar/@dots{}-pius-2.1.1: 0k4v3m9z1zp8xzzizb7d8kjj72f9172xv078sq4wl73vnq9ig3ax
8681 https://guix.example.org/nar/@dots{}-pius-2.1.1: 1cy25x1a4fzq5rk0pmvc8xhwyffnqz95h2bpvqsz2mpvlbccy0gs
8682
8683@dots{}
8684
86856,406 store items were analyzed:
8686 - 4,749 (74.1%) were identical
8687 - 525 (8.2%) differed
8688 - 1,132 (17.7%) were inconclusive
8689@end smallexample
8690
8691@noindent
8692In this example, @command{guix challenge} first scans the store to determine
8693the set of locally-built derivations---as opposed to store items that were
8694downloaded from a substitute server---and then queries all the substitute
8695servers. It then reports those store items for which the servers obtained a
8696result different from the local build.
8697
8698@cindex non-determinism, in package builds
8699As an example, @code{guix.example.org} always gets a different answer.
8700Conversely, @code{hydra.gnu.org} agrees with local builds, except in the
8701case of Git. This might indicate that the build process of Git is
8702non-deterministic, meaning that its output varies as a function of various
8703things that Guix does not fully control, in spite of building packages in
8704isolated environments (@pxref{Funktionalitäten}). Most common sources of
8705non-determinism include the addition of timestamps in build results, the
8706inclusion of random numbers, and directory listings sorted by inode number.
8707See @uref{https://reproducible-builds.org/docs/}, for more information.
8708
8709To find out what is wrong with this Git binary, we can do something along
8710these lines (@pxref{Aufruf von guix archive}):
8711
8712@example
8713$ wget -q -O - https://hydra.gnu.org/nar/@dots{}-git-2.5.0 \
8714 | guix archive -x /tmp/git
8715$ diff -ur --no-dereference /gnu/store/@dots{}-git.2.5.0 /tmp/git
8716@end example
8717
8718This command shows the difference between the files resulting from the local
8719build, and the files resulting from the build on @code{hydra.gnu.org}
8720(@pxref{Overview, Comparing and Merging Files,, diffutils, Comparing and
8721Merging Files}). The @command{diff} command works great for text files.
8722When binary files differ, a better option is @uref{https://diffoscope.org/,
8723Diffoscope}, a tool that helps visualize differences for all kinds of files.
8724
8725Once you have done that work, you can tell whether the differences are due
8726to a non-deterministic build process or to a malicious server. We try hard
8727to remove sources of non-determinism in packages to make it easier to verify
8728substitutes, but of course, this is a process that involves not just Guix,
8729but a large part of the free software community. In the meantime,
8730@command{guix challenge} is one tool to help address the problem.
8731
8732If you are writing packages for Guix, you are encouraged to check whether
8733@code{hydra.gnu.org} and other substitute servers obtain the same build
8734result as you did with:
8735
8736@example
8737$ guix challenge @var{package}
8738@end example
8739
8740@noindent
8741where @var{package} is a package specification such as @code{guile@@2.0} or
8742@code{glibc:debug}.
8743
8744The general syntax is:
8745
8746@example
8747guix challenge @var{options} [@var{packages}@dots{}]
8748@end example
8749
8750When a difference is found between the hash of a locally-built item and that
8751of a server-provided substitute, or among substitutes provided by different
8752servers, the command displays it as in the example above and its exit code
8753is 2 (other non-zero exit codes denote other kinds of errors.)
8754
8755The one option that matters is:
8756
8757@table @code
8758
8759@item --substitute-urls=@var{URLs}
8760Consider @var{urls} the whitespace-separated list of substitute source URLs
8761to compare to.
8762
8763@item --verbose
8764@itemx -v
8765Show details about matches (identical contents) in addition to information
8766about mismatches.
8767
8768@end table
8769
8770@node Aufruf von guix copy
8771@section Invoking @command{guix copy}
8772
8773@cindex copy, of store items, over SSH
8774@cindex SSH, copy of store items
8775@cindex sharing store items across machines
8776@cindex transferring store items across machines
8777The @command{guix copy} command copies items from the store of one machine
8778to that of another machine over a secure shell (SSH)
8779connection@footnote{This command is available only when Guile-SSH was
8780found. @xref{Voraussetzungen}, for details.}. For example, the following
8781command copies the @code{coreutils} package, the user's profile, and all
8782their dependencies over to @var{host}, logged in as @var{user}:
8783
8784@example
8785guix copy --to=@var{user}@@@var{host} \
8786 coreutils `readlink -f ~/.guix-profile`
8787@end example
8788
8789If some of the items to be copied are already present on @var{host}, they
8790are not actually sent.
8791
8792The command below retrieves @code{libreoffice} and @code{gimp} from
8793@var{host}, assuming they are available there:
8794
8795@example
8796guix copy --from=@var{host} libreoffice gimp
8797@end example
8798
8799The SSH connection is established using the Guile-SSH client, which is
8800compatible with OpenSSH: it honors @file{~/.ssh/known_hosts} and
8801@file{~/.ssh/config}, and uses the SSH agent for authentication.
8802
8803The key used to sign items that are sent must be accepted by the remote
8804machine. Likewise, the key used by the remote machine to sign items you are
8805retrieving must be in @file{/etc/guix/acl} so it is accepted by your own
8806daemon. @xref{Aufruf von guix archive}, for more information about store item
8807authentication.
8808
8809The general syntax is:
8810
8811@example
8812guix copy [--to=@var{spec}|--from=@var{spec}] @var{items}@dots{}
8813@end example
8814
8815You must always specify one of the following options:
8816
8817@table @code
8818@item --to=@var{spec}
8819@itemx --from=@var{spec}
8820Specify the host to send to or receive from. @var{spec} must be an SSH spec
8821such as @code{example.org}, @code{charlie@@example.org}, or
8822@code{charlie@@example.org:2222}.
8823@end table
8824
8825The @var{items} can be either package names, such as @code{gimp}, or store
8826items, such as @file{/gnu/store/@dots{}-idutils-4.6}.
8827
8828When specifying the name of a package to send, it is first built if needed,
8829unless @option{--dry-run} was specified. Common build options are supported
8830(@pxref{Gemeinsame Erstellungsoptionen}).
8831
8832
8833@node Aufruf von guix container
8834@section Invoking @command{guix container}
8835@cindex container
8836@cindex @command{guix container}
8837@quotation Anmerkung
8838As of version @value{VERSION}, this tool is experimental. The interface is
8839subject to radical change in the future.
8840@end quotation
8841
8842The purpose of @command{guix container} is to manipulate processes running
8843within an isolated environment, commonly known as a ``container'', typically
8844created by the @command{guix environment} (@pxref{Aufruf von guix environment}) and @command{guix system container} (@pxref{Aufruf von guix system}) commands.
8845
8846The general syntax is:
8847
8848@example
8849guix container @var{action} @var{options}@dots{}
8850@end example
8851
8852@var{action} specifies the operation to perform with a container, and
8853@var{options} specifies the context-specific arguments for the action.
8854
8855The following actions are available:
8856
8857@table @code
8858@item exec
8859Execute a command within the context of a running container.
8860
8861The syntax is:
8862
8863@example
8864guix container exec @var{pid} @var{program} @var{arguments}@dots{}
8865@end example
8866
8867@var{pid} specifies the process ID of the running container. @var{program}
8868specifies an executable file name within the root file system of the
8869container. @var{arguments} are the additional options that will be passed
8870to @var{program}.
8871
8872The following command launches an interactive login shell inside a GuixSD
8873container, started by @command{guix system container}, and whose process ID
8874is 9001:
8875
8876@example
8877guix container exec 9001 /run/current-system/profile/bin/bash --login
8878@end example
8879
8880Note that the @var{pid} cannot be the parent process of a container. It
8881must be PID 1 of the container or one of its child processes.
8882
8883@end table
8884
8885@node Aufruf von guix weather
8886@section Invoking @command{guix weather}
8887
8888Occasionally you're grumpy because substitutes are lacking and you end up
8889building packages by yourself (@pxref{Substitute}). The @command{guix
8890weather} command reports on substitute availability on the specified servers
8891so you can have an idea of whether you'll be grumpy today. It can sometimes
8892be useful info as a user, but it is primarily useful to people running
8893@command{guix publish} (@pxref{Aufruf von guix publish}).
8894
8895@cindex statistics, for substitutes
8896@cindex availability of substitutes
8897@cindex substitute availability
8898@cindex weather, substitute availability
8899Here's a sample run:
8900
8901@example
8902$ guix weather --substitute-urls=https://guix.example.org
8903computing 5,872 package derivations for x86_64-linux...
8904looking for 6,128 store items on https://guix.example.org..
8905updating list of substitutes from 'https://guix.example.org'... 100.0%
8906https://guix.example.org
8907 43.4% substitutes available (2,658 out of 6,128)
8908 7,032.5 MiB of nars (compressed)
8909 19,824.2 MiB on disk (uncompressed)
8910 0.030 seconds per request (182.9 seconds in total)
8911 33.5 requests per second
8912
8913 9.8% (342 out of 3,470) of the missing items are queued
8914 867 queued builds
8915 x86_64-linux: 518 (59.7%)
8916 i686-linux: 221 (25.5%)
8917 aarch64-linux: 128 (14.8%)
8918 build rate: 23.41 builds per hour
8919 x86_64-linux: 11.16 builds per hour
8920 i686-linux: 6.03 builds per hour
8921 aarch64-linux: 6.41 builds per hour
8922@end example
8923
8924@cindex continuous integration, statistics
8925As you can see, it reports the fraction of all the packages for which
8926substitutes are available on the server---regardless of whether substitutes
8927are enabled, and regardless of whether this server's signing key is
8928authorized. It also reports the size of the compressed archives (``nars'')
8929provided by the server, the size the corresponding store items occupy in the
8930store (assuming deduplication is turned off), and the server's throughput.
8931The second part gives continuous integration (CI) statistics, if the server
8932supports it.
8933
8934To achieve that, @command{guix weather} queries over HTTP(S) meta-data
8935(@dfn{narinfos}) for all the relevant store items. Like @command{guix
8936challenge}, it ignores signatures on those substitutes, which is innocuous
8937since the command only gathers statistics and cannot install those
8938substitutes.
8939
8940Among other things, it is possible to query specific system types and
8941specific package sets. The available options are listed below.
8942
8943@table @code
8944@item --substitute-urls=@var{URLs}
8945@var{urls} is the space-separated list of substitute server URLs to query.
8946When this option is omitted, the default set of substitute servers is
8947queried.
8948
8949@item --system=@var{System}
8950@itemx -s @var{system}
8951Query substitutes for @var{system}---e.g., @code{aarch64-linux}. This
8952option can be repeated, in which case @command{guix weather} will query
8953substitutes for several system types.
8954
8955@item --manifest=@var{Datei}
8956Instead of querying substitutes for all the packages, only ask for those
8957specified in @var{file}. @var{file} must contain a @dfn{manifest}, as with
8958the @code{-m} option of @command{guix package} (@pxref{Aufruf von guix package}).
8959@end table
8960
8961@node Invoking guix processes
8962@section Invoking @command{guix processes}
8963
8964The @command{guix processes} command can be useful to developers and system
8965administrators, especially on multi-user machines and on build farms: it
8966lists the current sessions (connections to the daemon), as well as
8967information about the processes involved@footnote{Remote sessions, when
8968@command{guix-daemon} is started with @option{--listen} specifying a TCP
8969endpoint, are @emph{not} listed.}. Here's an example of the information it
8970returns:
8971
8972@example
8973$ sudo guix processes
8974SessionPID: 19002
8975ClientPID: 19090
8976ClientCommand: guix environment --ad-hoc python
8977
8978SessionPID: 19402
8979ClientPID: 19367
8980ClientCommand: guix publish -u guix-publish -p 3000 -C 9 @dots{}
8981
8982SessionPID: 19444
8983ClientPID: 19419
8984ClientCommand: cuirass --cache-directory /var/cache/cuirass @dots{}
8985LockHeld: /gnu/store/@dots{}-perl-ipc-cmd-0.96.lock
8986LockHeld: /gnu/store/@dots{}-python-six-bootstrap-1.11.0.lock
8987LockHeld: /gnu/store/@dots{}-libjpeg-turbo-2.0.0.lock
8988ChildProcess: 20495: guix offload x86_64-linux 7200 1 28800
8989ChildProcess: 27733: guix offload x86_64-linux 7200 1 28800
8990ChildProcess: 27793: guix offload x86_64-linux 7200 1 28800
8991@end example
8992
8993In this example we see that @command{guix-daemon} has three clients:
8994@command{guix environment}, @command{guix publish}, and the Cuirass
8995continuous integration tool; their process identifier (PID) is given by the
8996@code{ClientPID} field. The @code{SessionPID} field gives the PID of the
8997@command{guix-daemon} sub-process of this particular session.
8998
8999The @code{LockHeld} fields show which store items are currently locked by
9000this session, which corresponds to store items being built or substituted
9001(the @code{LockHeld} field is not displayed when @command{guix processes} is
9002not running as root.) Last, by looking at the @code{ChildProcess} field, we
9003understand that these three builds are being offloaded (@pxref{Auslagern des Daemons einrichten}).
9004
9005The output is in Recutils format so we can use the handy @command{recsel}
9006command to select sessions of interest (@pxref{Selection Expressions,,,
9007recutils, GNU recutils manual}). As an example, the command shows the
9008command line and PID of the client that triggered the build of a Perl
9009package:
9010
9011@example
9012$ sudo guix processes | \
9013 recsel -p ClientPID,ClientCommand -e 'LockHeld ~ "perl"'
9014ClientPID: 19419
9015ClientCommand: cuirass --cache-directory /var/cache/cuirass @dots{}
9016@end example
9017
9018@c *********************************************************************
9019@node GNU-Distribution
9020@chapter GNU-Distribution
9021
9022@cindex Guix System Distribution
9023@cindex GuixSD
9024Guix comes with a distribution of the GNU system consisting entirely of free
9025software@footnote{The term ``free'' here refers to the
9026@url{http://www.gnu.org/philosophy/free-sw.html,freedom provided to users of
9027that software}.}. The distribution can be installed on its own
9028(@pxref{Systeminstallation}), but it is also possible to install Guix as a
9029package manager on top of an installed GNU/Linux system
9030(@pxref{Installation}). To distinguish between the two, we refer to the
9031standalone distribution as the Guix System Distribution, or GuixSD.
9032
9033The distribution provides core GNU packages such as GNU libc, GCC, and
9034Binutils, as well as many GNU and non-GNU applications. The complete list
9035of available packages can be browsed
9036@url{http://www.gnu.org/software/guix/packages,on-line} or by running
9037@command{guix package} (@pxref{Aufruf von guix package}):
9038
9039@example
9040guix package --list-available
9041@end example
9042
9043Our goal is to provide a practical 100% free software distribution of
9044Linux-based and other variants of GNU, with a focus on the promotion and
9045tight integration of GNU components, and an emphasis on programs and tools
9046that help users exert that freedom.
9047
9048Packages are currently available on the following platforms:
9049
9050@table @code
9051
9052@item x86_64-linux
9053Intel/AMD @code{x86_64} architecture, Linux-Libre kernel;
9054
9055@item i686-linux
9056Intel 32-bit architecture (IA32), Linux-Libre kernel;
9057
9058@item armhf-linux
9059ARMv7-A architecture with hard float, Thumb-2 and NEON, using the EABI
9060hard-float application binary interface (ABI), and Linux-Libre kernel.
9061
9062@item aarch64-linux
9063little-endian 64-bit ARMv8-A processors, Linux-Libre kernel. This is
9064currently in an experimental stage, with limited support.
9065@xref{Mitwirken}, for how to help!
9066
9067@item mips64el-linux
9068little-endian 64-bit MIPS processors, specifically the Loongson series, n32
9069ABI, and Linux-Libre kernel.
9070
9071@end table
9072
9073GuixSD itself is currently only available on @code{i686} and @code{x86_64}.
9074
9075@noindent
9076For information on porting to other architectures or kernels,
9077@pxref{Portierung}.
9078
9079@menu
9080* Systeminstallation:: Das ganze Betriebssystem installieren.
9081* Systemkonfiguration:: Das Betriebssystem konfigurieren.
9082* Dokumentation:: Wie man Nutzerhandbücher von Software liest.
9083* Dateien zur Fehlersuche installieren:: Womit man seinen Debugger
9084 füttert.
9085* Sicherheitsaktualisierungen:: Sicherheits-Patches schnell einspielen.
9086* Paketmodule:: Pakete aus Sicht des Programmierers.
9087* Paketrichtlinien:: Die Distribution wachsen lassen.
9088* Bootstrapping:: GNU/Linux von Grund auf selbst erstellen.
9089* Portierung:: Guix auf andere Plattformen und Kernels
9090 bringen.
9091@end menu
9092
9093Building this distribution is a cooperative effort, and you are invited to
9094join! @xref{Mitwirken}, for information about how you can help.
9095
9096@node Systeminstallation
9097@section Systeminstallation
9098
9099@cindex installing GuixSD
9100@cindex Guix System Distribution
9101This section explains how to install the Guix System Distribution (GuixSD)
9102on a machine. The Guix package manager can also be installed on top of a
9103running GNU/Linux system, @pxref{Installation}.
9104
9105@ifinfo
9106@quotation Anmerkung
9107@c This paragraph is for people reading this from tty2 of the
9108@c installation image.
9109You are reading this documentation with an Info reader. For details on how
9110to use it, hit the @key{RET} key (``return'' or ``enter'') on the link that
9111follows: @pxref{Top, Info reader,, info-stnd, Stand-alone GNU Info}. Hit
9112@kbd{l} afterwards to come back here.
9113
9114Alternately, run @command{info info} in another tty to keep the manual
9115available.
9116@end quotation
9117@end ifinfo
9118
9119@menu
9120* Einschränkungen:: Was Sie erwarten dürfen.
9121* Hardware-Überlegungen:: Unterstützte Hardware.
9122* Installation von USB-Stick oder DVD:: Das Installationsmedium
9123 vorbereiten.
9124* Vor der Installation:: Netzwerkanbindung, Partitionierung etc.
9125* Fortfahren mit der Installation:: Die Hauptsache.
9126* GuixSD in einer VM installieren:: Ein GuixSD-Spielplatz.
9127* Ein Abbild zur Installation erstellen:: Wie ein solches entsteht.
9128@end menu
9129
9130@node Einschränkungen
9131@subsection Einschränkungen
9132
9133As of version @value{VERSION}, the Guix System Distribution (GuixSD) is not
9134production-ready. It may contain bugs and lack important features. Thus,
9135if you are looking for a stable production system that respects your freedom
9136as a computer user, a good solution at this point is to consider
9137@url{http://www.gnu.org/distros/free-distros.html, one of the more
9138established GNU/Linux distributions}. We hope you can soon switch to the
9139GuixSD without fear, of course. In the meantime, you can also keep using
9140your distribution and try out the package manager on top of it
9141(@pxref{Installation}).
9142
9143Before you proceed with the installation, be aware of the following
9144noteworthy limitations applicable to version @value{VERSION}:
9145
9146@itemize
9147@item
9148The installation process does not include a graphical user interface and
9149requires familiarity with GNU/Linux (see the following subsections to get a
9150feel of what that means.)
9151
9152@item
9153Support for the Logical Volume Manager (LVM) is missing.
9154
9155@item
9156More and more system services are provided (@pxref{Dienste}), but some may
9157be missing.
9158
9159@item
9160More than 7,500 packages are available, but you might occasionally find that
9161a useful package is missing.
9162
9163@item
9164GNOME, Xfce, LXDE, and Enlightenment are available (@pxref{Desktop-Dienste}), as well as a number of X11 window managers. However, some
9165graphical applications may be missing, as well as KDE.
9166@end itemize
9167
9168You have been warned! But more than a disclaimer, this is an invitation to
9169report issues (and success stories!), and to join us in improving it.
9170@xref{Mitwirken}, for more info.
9171
9172
9173@node Hardware-Überlegungen
9174@subsection Hardware-Überlegungen
9175
9176@cindex hardware support on GuixSD
9177GNU@tie{}GuixSD focuses on respecting the user's computing freedom. It
9178builds around the kernel Linux-libre, which means that only hardware for
9179which free software drivers and firmware exist is supported. Nowadays, a
9180wide range of off-the-shelf hardware is supported on GNU/Linux-libre---from
9181keyboards to graphics cards to scanners and Ethernet controllers.
9182Unfortunately, there are still areas where hardware vendors deny users
9183control over their own computing, and such hardware is not supported on
9184GuixSD.
9185
9186@cindex WiFi, hardware support
9187One of the main areas where free drivers or firmware are lacking is WiFi
9188devices. WiFi devices known to work include those using Atheros chips
9189(AR9271 and AR7010), which corresponds to the @code{ath9k} Linux-libre
9190driver, and those using Broadcom/AirForce chips (BCM43xx with Wireless-Core
9191Revision 5), which corresponds to the @code{b43-open} Linux-libre driver.
9192Free firmware exists for both and is available out-of-the-box on GuixSD, as
9193part of @var{%base-firmware} (@pxref{„operating-system“-Referenz,
9194@code{firmware}}).
9195
9196@cindex RYF, Respects Your Freedom
9197The @uref{https://www.fsf.org/, Free Software Foundation} runs
9198@uref{https://www.fsf.org/ryf, @dfn{Respects Your Freedom}} (RYF), a
9199certification program for hardware products that respect your freedom and
9200your privacy and ensure that you have control over your device. We
9201encourage you to check the list of RYF-certified devices.
9202
9203Another useful resource is the @uref{https://www.h-node.org/, H-Node} web
9204site. It contains a catalog of hardware devices with information about
9205their support in GNU/Linux.
9206
9207
9208@node Installation von USB-Stick oder DVD
9209@subsection Installation von USB-Stick oder DVD
9210
9211An ISO-9660 installation image that can be written to a USB stick or burnt
9212to a DVD can be downloaded from
9213@indicateurl{https://alpha.gnu.org/gnu/guix/guixsd-install-@value{VERSION}.@var{system}.iso.xz},
9214where @var{system} is one of:
9215
9216@table @code
9217@item x86_64-linux
9218for a GNU/Linux system on Intel/AMD-compatible 64-bit CPUs;
9219
9220@item i686-linux
9221for a 32-bit GNU/Linux system on Intel-compatible CPUs.
9222@end table
9223
9224@c start duplication of authentication part from ``Binary Installation''
9225Make sure to download the associated @file{.sig} file and to verify the
9226authenticity of the image against it, along these lines:
9227
9228@example
9229$ wget https://alpha.gnu.org/gnu/guix/guixsd-install-@value{VERSION}.@var{system}.iso.xz.sig
9230$ gpg --verify guixsd-install-@value{VERSION}.@var{system}.iso.xz.sig
9231@end example
9232
9233Falls dieser Befehl fehlschlägt, weil Sie nicht über den nötigen
9234öffentlichen Schlüssel verfügen, können Sie ihn mit diesem Befehl
9235importieren:
9236
9237@example
793dcd8c
LC
9238$ gpg --keyserver @value{KEY-SERVER} \
9239 --recv-keys @value{OPENPGP-SIGNING-KEY-ID}
1e40e70b
JL
9240@end example
9241
9242@noindent
9243@c end duplication
9244und den Befehl @code{gpg --verify} erneut ausführen.
9245
9246This image contains the tools necessary for an installation. It is meant to
9247be copied @emph{as is} to a large-enough USB stick or DVD.
9248
9249@unnumberedsubsubsec Copying to a USB Stick
9250
9251To copy the image to a USB stick, follow these steps:
9252
9253@enumerate
9254@item
9255Decompress the image using the @command{xz} command:
9256
9257@example
9258xz -d guixsd-install-@value{VERSION}.@var{system}.iso.xz
9259@end example
9260
9261@item
9262Insert a USB stick of 1@tie{}GiB or more into your machine, and determine
9263its device name. Assuming that the USB stick is known as @file{/dev/sdX},
9264copy the image with:
9265
9266@example
9267dd if=guixsd-install-@value{VERSION}.x86_64-linux.iso of=/dev/sdX
9268sync
9269@end example
9270
9271Access to @file{/dev/sdX} usually requires root privileges.
9272@end enumerate
9273
9274@unnumberedsubsubsec Burning on a DVD
9275
9276To copy the image to a DVD, follow these steps:
9277
9278@enumerate
9279@item
9280Decompress the image using the @command{xz} command:
9281
9282@example
9283xz -d guixsd-install-@value{VERSION}.@var{system}.iso.xz
9284@end example
9285
9286@item
9287Insert a blank DVD into your machine, and determine its device name.
9288Assuming that the DVD drive is known as @file{/dev/srX}, copy the image
9289with:
9290
9291@example
9292growisofs -dvd-compat -Z /dev/srX=guixsd-install-@value{VERSION}.x86_64.iso
9293@end example
9294
9295Access to @file{/dev/srX} usually requires root privileges.
9296@end enumerate
9297
9298@unnumberedsubsubsec Booting
9299
9300Once this is done, you should be able to reboot the system and boot from the
9301USB stick or DVD. The latter usually requires you to get in the BIOS or
9302UEFI boot menu, where you can choose to boot from the USB stick.
9303
9304@xref{GuixSD in einer VM installieren}, if, instead, you would like to install
9305GuixSD in a virtual machine (VM).
9306
9307
9308@node Vor der Installation
9309@subsection Vor der Installation
9310
9311Once you have successfully booted your computer using the installation
9312medium, you should end up with a root prompt. Several console TTYs are
9313configured and can be used to run commands as root. TTY2 shows this
9314documentation, browsable using the Info reader commands (@pxref{Top,,,
9315info-stnd, Stand-alone GNU Info}). The installation system runs the GPM
9316mouse daemon, which allows you to select text with the left mouse button and
9317to paste it with the middle button.
9318
9319@quotation Anmerkung
9320Installation requires access to the Internet so that any missing
9321dependencies of your system configuration can be downloaded. See the
9322``Networking'' section below.
9323@end quotation
9324
9325The installation system includes many common tools needed for this task.
9326But it is also a full-blown GuixSD system, which means that you can install
9327additional packages, should you need it, using @command{guix package}
9328(@pxref{Aufruf von guix package}).
9329
9330@subsubsection Keyboard Layout
9331
9332@cindex keyboard layout
9333The installation image uses the US qwerty keyboard layout. If you want to
9334change it, you can use the @command{loadkeys} command. For example, the
9335following command selects the Dvorak keyboard layout:
9336
9337@example
9338loadkeys dvorak
9339@end example
9340
9341See the files under @file{/run/current-system/profile/share/keymaps} for a
9342list of available keyboard layouts. Run @command{man loadkeys} for more
9343information.
9344
9345@subsubsection Networking
9346
9347Run the following command to see what your network interfaces are called:
9348
9349@example
9350ifconfig -a
9351@end example
9352
9353@noindent
9354@dots{} or, using the GNU/Linux-specific @command{ip} command:
9355
9356@example
9357ip a
9358@end example
9359
9360@c http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-net_id.c#n20
9361Wired interfaces have a name starting with @samp{e}; for example, the
9362interface corresponding to the first on-board Ethernet controller is called
9363@samp{eno1}. Wireless interfaces have a name starting with @samp{w}, like
9364@samp{w1p2s0}.
9365
9366@table @asis
9367@item Wired connection
9368To configure a wired network run the following command, substituting
9369@var{interface} with the name of the wired interface you want to use.
9370
9371@example
9372ifconfig @var{interface} up
9373@end example
9374
9375@item Wireless connection
9376@cindex wireless
9377@cindex WiFi
9378To configure wireless networking, you can create a configuration file for
9379the @command{wpa_supplicant} configuration tool (its location is not
9380important) using one of the available text editors such as @command{nano}:
9381
9382@example
9383nano wpa_supplicant.conf
9384@end example
9385
9386As an example, the following stanza can go to this file and will work for
9387many wireless networks, provided you give the actual SSID and passphrase for
9388the network you are connecting to:
9389
9390@example
9391network=@{
9392 ssid="@var{my-ssid}"
9393 key_mgmt=WPA-PSK
9394 psk="the network's secret passphrase"
9395@}
9396@end example
9397
9398Start the wireless service and run it in the background with the following
9399command (substitute @var{interface} with the name of the network interface
9400you want to use):
9401
9402@example
9403wpa_supplicant -c wpa_supplicant.conf -i @var{interface} -B
9404@end example
9405
9406Run @command{man wpa_supplicant} for more information.
9407@end table
9408
9409@cindex DHCP
9410At this point, you need to acquire an IP address. On a network where IP
9411addresses are automatically assigned @i{via} DHCP, you can run:
9412
9413@example
9414dhclient -v @var{interface}
9415@end example
9416
9417Try to ping a server to see if networking is up and running:
9418
9419@example
9420ping -c 3 gnu.org
9421@end example
9422
9423Setting up network access is almost always a requirement because the image
9424does not contain all the software and tools that may be needed.
9425
9426@cindex installing over SSH
9427If you want to, you can continue the installation remotely by starting an
9428SSH server:
9429
9430@example
9431herd start ssh-daemon
9432@end example
9433
9434Make sure to either set a password with @command{passwd}, or configure
9435OpenSSH public key authentication before logging in.
9436
9437@subsubsection Disk Partitioning
9438
9439Unless this has already been done, the next step is to partition, and then
9440format the target partition(s).
9441
9442The installation image includes several partitioning tools, including Parted
9443(@pxref{Overview,,, parted, GNU Parted User Manual}), @command{fdisk}, and
9444@command{cfdisk}. Run it and set up your disk with the partition layout you
9445want:
9446
9447@example
9448cfdisk
9449@end example
9450
9451If your disk uses the GUID Partition Table (GPT) format and you plan to
9452install BIOS-based GRUB (which is the default), make sure a BIOS Boot
9453Partition is available (@pxref{BIOS installation,,, grub, GNU GRUB manual}).
9454
9455@cindex EFI, installation
9456@cindex UEFI, installation
9457@cindex ESP, EFI system partition
9458If you instead wish to use EFI-based GRUB, a FAT32 @dfn{EFI System
9459Partition} (ESP) is required. This partition should be mounted at
9460@file{/boot/efi} and must have the @code{esp} flag set. E.g., for
9461@command{parted}:
9462
9463@example
9464parted /dev/sda set 1 esp on
9465@end example
9466
9467@quotation Anmerkung
9468@vindex grub-bootloader
9469@vindex grub-efi-bootloader
9470Unsure whether to use EFI- or BIOS-based GRUB? If the directory
9471@file{/sys/firmware/efi} exists in the installation image, then you should
9472probably perform an EFI installation, using @code{grub-efi-bootloader}.
9473Otherwise you should use the BIOS-based GRUB, known as
9474@code{grub-bootloader}. @xref{Bootloader-Konfiguration}, for more info on
9475bootloaders.
9476@end quotation
9477
9478Once you are done partitioning the target hard disk drive, you have to
9479create a file system on the relevant partition(s)@footnote{Currently GuixSD
9480only supports ext4 and btrfs file systems. In particular, code that reads
9481file system UUIDs and labels only works for these file system types.}. For
9482the ESP, if you have one and assuming it is @file{/dev/sda1}, run:
9483
9484@example
9485mkfs.fat -F32 /dev/sda1
9486@end example
9487
9488Preferably, assign file systems a label so that you can easily and reliably
9489refer to them in @code{file-system} declarations (@pxref{Dateisysteme}).
9490This is typically done using the @code{-L} option of @command{mkfs.ext4} and
9491related commands. So, assuming the target root partition lives at
9492@file{/dev/sda2}, a file system with the label @code{my-root} can be created
9493with:
9494
9495@example
9496mkfs.ext4 -L my-root /dev/sda2
9497@end example
9498
9499@cindex encrypted disk
9500If you are instead planning to encrypt the root partition, you can use the
9501Cryptsetup/LUKS utilities to do that (see @inlinefmtifelse{html,
9502@uref{https://linux.die.net/man/8/cryptsetup, @code{man cryptsetup}},
9503@code{man cryptsetup}} for more information.) Assuming you want to store
9504the root partition on @file{/dev/sda2}, the command sequence would be along
9505these lines:
9506
9507@example
9508cryptsetup luksFormat /dev/sda2
9509cryptsetup open --type luks /dev/sda2 my-partition
9510mkfs.ext4 -L my-root /dev/mapper/my-partition
9511@end example
9512
9513Once that is done, mount the target file system under @file{/mnt} with a
9514command like (again, assuming @code{my-root} is the label of the root file
9515system):
9516
9517@example
9518mount LABEL=my-root /mnt
9519@end example
9520
9521Also mount any other file systems you would like to use on the target system
9522relative to this path. If you have @file{/boot} on a separate partition for
9523example, mount it at @file{/mnt/boot} now so it is found by @code{guix
9524system init} afterwards.
9525
9526Finally, if you plan to use one or more swap partitions (@pxref{Memory
9527Concepts, swap space,, libc, The GNU C Library Reference Manual}), make sure
9528to initialize them with @command{mkswap}. Assuming you have one swap
9529partition on @file{/dev/sda3}, you would run:
9530
9531@example
9532mkswap /dev/sda3
9533swapon /dev/sda3
9534@end example
9535
9536Alternatively, you may use a swap file. For example, assuming that in the
9537new system you want to use the file @file{/swapfile} as a swap file, you
9538would run@footnote{This example will work for many types of file systems
9539(e.g., ext4). However, for copy-on-write file systems (e.g., btrfs), the
9540required steps may be different. For details, see the manual pages for
9541@command{mkswap} and @command{swapon}.}:
9542
9543@example
9544# This is 10 GiB of swap space. Adjust "count" to change the size.
9545dd if=/dev/zero of=/mnt/swapfile bs=1MiB count=10240
9546# For security, make the file readable and writable only by root.
9547chmod 600 /mnt/swapfile
9548mkswap /mnt/swapfile
9549swapon /mnt/swapfile
9550@end example
9551
9552Note that if you have encrypted the root partition and created a swap file
9553in its file system as described above, then the encryption also protects the
9554swap file, just like any other file in that file system.
9555
9556@node Fortfahren mit der Installation
9557@subsection Fortfahren mit der Installation
9558
9559With the target partitions ready and the target root mounted on @file{/mnt},
9560we're ready to go. First, run:
9561
9562@example
9563herd start cow-store /mnt
9564@end example
9565
9566This makes @file{/gnu/store} copy-on-write, such that packages added to it
9567during the installation phase are written to the target disk on @file{/mnt}
9568rather than kept in memory. This is necessary because the first phase of
9569the @command{guix system init} command (see below) entails downloads or
9570builds to @file{/gnu/store} which, initially, is an in-memory file system.
9571
9572Next, you have to edit a file and provide the declaration of the operating
9573system to be installed. To that end, the installation system comes with
9574three text editors. We recommend GNU nano (@pxref{Top,,, nano, GNU nano
9575Manual}), which supports syntax highlighting and parentheses matching; other
9576editors include GNU Zile (an Emacs clone), and nvi (a clone of the original
9577BSD @command{vi} editor). We strongly recommend storing that file on the
9578target root file system, say, as @file{/mnt/etc/config.scm}. Failing to do
9579that, you will have lost your configuration file once you have rebooted into
9580the newly-installed system.
9581
793dcd8c 9582@xref{Das Konfigurationssystem nutzen}, for an overview of the configuration
1e40e70b
JL
9583file. The example configurations discussed in that section are available
9584under @file{/etc/configuration} in the installation image. Thus, to get
9585started with a system configuration providing a graphical display server (a
9586``desktop'' system), you can run something along these lines:
9587
9588@example
9589# mkdir /mnt/etc
9590# cp /etc/configuration/desktop.scm /mnt/etc/config.scm
9591# nano /mnt/etc/config.scm
9592@end example
9593
9594You should pay attention to what your configuration file contains, and in
9595particular:
9596
9597@itemize
9598@item
9599Make sure the @code{bootloader-configuration} form refers to the target you
9600want to install GRUB on. It should mention @code{grub-bootloader} if you
9601are installing GRUB in the legacy way, or @code{grub-efi-bootloader} for
9602newer UEFI systems. For legacy systems, the @code{target} field names a
9603device, like @code{/dev/sda}; for UEFI systems it names a path to a mounted
9604EFI partition, like @code{/boot/efi}, and do make sure the path is actually
9605mounted.
9606
9607@item
9608Be sure that your file system labels match the value of their respective
9609@code{device} fields in your @code{file-system} configuration, assuming your
9610@code{file-system} configuration uses the @code{file-system-label} procedure
9611in its @code{device} field.
9612
9613@item
9614If there are encrypted or RAID partitions, make sure to add a
9615@code{mapped-devices} field to describe them (@pxref{Abgebildete Geräte}).
9616@end itemize
9617
9618Once you are done preparing the configuration file, the new system must be
9619initialized (remember that the target root file system is mounted under
9620@file{/mnt}):
9621
9622@example
9623guix system init /mnt/etc/config.scm /mnt
9624@end example
9625
9626@noindent
9627This copies all the necessary files and installs GRUB on @file{/dev/sdX},
9628unless you pass the @option{--no-bootloader} option. For more information,
9629@pxref{Aufruf von guix system}. This command may trigger downloads or builds
9630of missing packages, which can take some time.
9631
9632Once that command has completed---and hopefully succeeded!---you can run
9633@command{reboot} and boot into the new system. The @code{root} password in
9634the new system is initially empty; other users' passwords need to be
9635initialized by running the @command{passwd} command as @code{root}, unless
9636your configuration specifies otherwise (@pxref{user-account-password, user
9637account passwords}).
9638
9639@cindex upgrading GuixSD
9640From then on, you can update GuixSD whenever you want by running
9641@command{guix pull} as @code{root} (@pxref{Aufruf von guix pull}), and then
9642running @command{guix system reconfigure} to build a new system generation
9643with the latest packages and services (@pxref{Aufruf von guix system}). We
9644recommend doing that regularly so that your system includes the latest
9645security updates (@pxref{Sicherheitsaktualisierungen}).
9646
9647Join us on @code{#guix} on the Freenode IRC network or on
9648@file{guix-devel@@gnu.org} to share your experience---good or not so good.
9649
9650@node GuixSD in einer VM installieren
9651@subsection Installing GuixSD in a Virtual Machine
9652
9653@cindex virtual machine, GuixSD installation
9654@cindex virtual private server (VPS)
9655@cindex VPS (virtual private server)
9656If you'd like to install GuixSD in a virtual machine (VM) or on a virtual
9657private server (VPS) rather than on your beloved machine, this section is
9658for you.
9659
9660To boot a @uref{http://qemu.org/,QEMU} VM for installing GuixSD in a disk
9661image, follow these steps:
9662
9663@enumerate
9664@item
9665First, retrieve and decompress the GuixSD installation image as described
9666previously (@pxref{Installation von USB-Stick oder DVD}).
9667
9668@item
9669Create a disk image that will hold the installed system. To make a
9670qcow2-formatted disk image, use the @command{qemu-img} command:
9671
9672@example
9673qemu-img create -f qcow2 guixsd.img 50G
9674@end example
9675
9676The resulting file will be much smaller than 50 GB (typically less than 1
9677MB), but it will grow as the virtualized storage device is filled up.
9678
9679@item
9680Boot the USB installation image in an VM:
9681
9682@example
9683qemu-system-x86_64 -m 1024 -smp 1 \
9684 -net user -net nic,model=virtio -boot menu=on \
9685 -drive file=guixsd-install-@value{VERSION}.@var{system}.iso \
9686 -drive file=guixsd.img
9687@end example
9688
9689The ordering of the drives matters.
9690
9691In the VM console, quickly press the @kbd{F12} key to enter the boot menu.
9692Then press the @kbd{2} key and the @kbd{RET} key to validate your selection.
9693
9694@item
9695You're now root in the VM, proceed with the installation process.
9696@xref{Vor der Installation}, and follow the instructions.
9697@end enumerate
9698
9699Once installation is complete, you can boot the system that's on your
9700@file{guixsd.img} image. @xref{GuixSD in einer VM starten}, for how to do that.
9701
9702@node Ein Abbild zur Installation erstellen
9703@subsection Ein Abbild zur Installation erstellen
9704
9705@cindex installation image
9706The installation image described above was built using the @command{guix
9707system} command, specifically:
9708
9709@example
9710guix system disk-image gnu/system/install.scm
9711@end example
9712
9713Have a look at @file{gnu/system/install.scm} in the source tree, and see
9714also @ref{Aufruf von guix system} for more information about the installation
9715image.
9716
9717@subsection Building the Installation Image for ARM Boards
9718
9719Many ARM boards require a specific variant of the
9720@uref{http://www.denx.de/wiki/U-Boot/, U-Boot} bootloader.
9721
9722If you build a disk image and the bootloader is not available otherwise (on
9723another boot drive etc), it's advisable to build an image that includes the
9724bootloader, specifically:
9725
9726@example
9727guix system disk-image --system=armhf-linux -e '((@@ (gnu system install) os-with-u-boot) (@@ (gnu system install) installation-os) "A20-OLinuXino-Lime2")'
9728@end example
9729
9730@code{A20-OLinuXino-Lime2} is the name of the board. If you specify an
9731invalid board, a list of possible boards will be printed.
9732
9733@node Systemkonfiguration
9734@section Systemkonfiguration
9735
9736@cindex system configuration
9737The Guix System Distribution supports a consistent whole-system
9738configuration mechanism. By that we mean that all aspects of the global
9739system configuration---such as the available system services, timezone and
9740locale settings, user accounts---are declared in a single place. Such a
9741@dfn{system configuration} can be @dfn{instantiated}---i.e., effected.
9742
9743@c Yes, we're talking of Puppet, Chef, & co. here. ↑
9744One of the advantages of putting all the system configuration under the
9745control of Guix is that it supports transactional system upgrades, and makes
9746it possible to roll back to a previous system instantiation, should
9747something go wrong with the new one (@pxref{Funktionalitäten}). Another advantage
9748is that it makes it easy to replicate the exact same configuration across
9749different machines, or at different points in time, without having to resort
9750to additional administration tools layered on top of the own tools of the
9751system.
9752
9753This section describes this mechanism. First we focus on the system
9754administrator's viewpoint---explaining how the system is configured and
9755instantiated. Then we show how this mechanism can be extended, for instance
9756to support new system services.
9757
9758@menu
793dcd8c 9759* Das Konfigurationssystem nutzen:: Ihr GNU-System anpassen.
1e40e70b
JL
9760* „operating-system“-Referenz:: Details der
9761 Betriebssystem-Deklarationen.
9762* Dateisysteme:: Die Dateisystemeinbindungen konfigurieren.
793dcd8c 9763* Abgebildete Geräte:: Näheres zu blockorientierten Speichermedien.
1e40e70b 9764* Benutzerkonten:: Benutzerkonten festlegen.
793dcd8c 9765* Locales:: Sprache und kulturelle Konventionen.
1e40e70b 9766* Dienste:: Systemdienste festlegen.
793dcd8c 9767* Setuid-Programme:: Mit Administratorrechten startende Programme.
1e40e70b
JL
9768* X.509-Zertifikate:: HTTPS-Server authentifizieren.
9769* Name Service Switch:: Den Name Service Switch von libc konfigurieren.
9770* Initiale RAM-Disk:: Linux-libre hochfahren.
9771* Bootloader-Konfiguration:: Den Bootloader konfigurieren.
793dcd8c 9772* Aufruf von guix system:: Instanzierung einer Systemkonfiguration.
1e40e70b
JL
9773* GuixSD in einer VM starten:: Wie man GuixSD in einer virtuellen Maschine
9774 startet.
9775* Dienste definieren:: Neue Dienstdefinitionen hinzufügen.
9776@end menu
9777
793dcd8c
LC
9778@node Das Konfigurationssystem nutzen
9779@subsection Das Konfigurationssystem nutzen
1e40e70b
JL
9780
9781The operating system is configured by providing an @code{operating-system}
9782declaration in a file that can then be passed to the @command{guix system}
9783command (@pxref{Aufruf von guix system}). A simple setup, with the default
9784system services, the default Linux-Libre kernel, initial RAM disk, and boot
9785loader looks like this:
9786
9787@findex operating-system
9788@lisp
9789@include os-config-bare-bones.texi
9790@end lisp
9791
9792This example should be self-describing. Some of the fields defined above,
9793such as @code{host-name} and @code{bootloader}, are mandatory. Others, such
9794as @code{packages} and @code{services}, can be omitted, in which case they
9795get a default value.
9796
9797Below we discuss the effect of some of the most important fields
9798(@pxref{„operating-system“-Referenz}, for details about all the available
9799fields), and how to @dfn{instantiate} the operating system using
9800@command{guix system}.
9801
9802@unnumberedsubsubsec Bootloader
9803
9804@cindex legacy boot, on Intel machines
9805@cindex BIOS boot, on Intel machines
9806@cindex UEFI boot
9807@cindex EFI boot
9808The @code{bootloader} field describes the method that will be used to boot
9809your system. Machines based on Intel processors can boot in ``legacy'' BIOS
9810mode, as in the example above. However, more recent machines rely instead
9811on the @dfn{Unified Extensible Firmware Interface} (UEFI) to boot. In that
9812case, the @code{bootloader} field should contain something along these
9813lines:
9814
9815@example
9816(bootloader-configuration
9817 (bootloader grub-efi-bootloader)
9818 (target "/boot/efi"))
9819@end example
9820
9821@xref{Bootloader-Konfiguration}, for more information on the available
9822configuration options.
9823
9824@unnumberedsubsubsec Globally-Visible Packages
9825
9826@vindex %base-packages
9827The @code{packages} field lists packages that will be globally visible on
9828the system, for all user accounts---i.e., in every user's @code{PATH}
9829environment variable---in addition to the per-user profiles (@pxref{Aufruf von guix package}). The @var{%base-packages} variable provides all the tools
9830one would expect for basic user and administrator tasks---including the GNU
9831Core Utilities, the GNU Networking Utilities, the GNU Zile lightweight text
9832editor, @command{find}, @command{grep}, etc. The example above adds
793dcd8c
LC
9833GNU@tie{}Screen to those, taken from the @code{(gnu packages screen)} module
9834(@pxref{Paketmodule}). The @code{(list package output)} syntax can be
9835used to add a specific output of a package:
1e40e70b
JL
9836
9837@lisp
9838(use-modules (gnu packages))
9839(use-modules (gnu packages dns))
9840
9841(operating-system
9842 ;; ...
9843 (packages (cons (list bind "utils")
9844 %base-packages)))
9845@end lisp
9846
9847@findex specification->package
9848Referring to packages by variable name, like @code{bind} above, has the
9849advantage of being unambiguous; it also allows typos and such to be
9850diagnosed right away as ``unbound variables''. The downside is that one
9851needs to know which module defines which package, and to augment the
9852@code{use-package-modules} line accordingly. To avoid that, one can use the
9853@code{specification->package} procedure of the @code{(gnu packages)} module,
9854which returns the best package for a given name or name and version:
9855
9856@lisp
9857(use-modules (gnu packages))
9858
9859(operating-system
9860 ;; ...
9861 (packages (append (map specification->package
9862 '("tcpdump" "htop" "gnupg@@2.0"))
9863 %base-packages)))
9864@end lisp
9865
9866@unnumberedsubsubsec System Services
9867
9868@cindex services
9869@vindex %base-services
9870The @code{services} field lists @dfn{system services} to be made available
9871when the system starts (@pxref{Dienste}). The @code{operating-system}
9872declaration above specifies that, in addition to the basic services, we want
9873the @command{lshd} secure shell daemon listening on port 2222
9874(@pxref{Netzwerkdienste, @code{lsh-service}}). Under the hood,
9875@code{lsh-service} arranges so that @code{lshd} is started with the right
9876command-line options, possibly with supporting configuration files generated
9877as needed (@pxref{Dienste definieren}).
9878
9879@cindex customization, of services
9880@findex modify-services
9881Occasionally, instead of using the base services as is, you will want to
9882customize them. To do this, use @code{modify-services} (@pxref{Service-Referenz, @code{modify-services}}) to modify the list.
9883
9884For example, suppose you want to modify @code{guix-daemon} and Mingetty (the
9885console log-in) in the @var{%base-services} list (@pxref{Basisdienste,
9886@code{%base-services}}). To do that, you can write the following in your
9887operating system declaration:
9888
9889@lisp
9890(define %my-services
9891 ;; My very own list of services.
9892 (modify-services %base-services
9893 (guix-service-type config =>
9894 (guix-configuration
9895 (inherit config)
9896 (use-substitutes? #f)
9897 (extra-options '("--gc-keep-derivations"))))
9898 (mingetty-service-type config =>
9899 (mingetty-configuration
9900 (inherit config)))))
9901
9902(operating-system
9903 ;; @dots{}
9904 (services %my-services))
9905@end lisp
9906
9907This changes the configuration---i.e., the service parameters---of the
9908@code{guix-service-type} instance, and that of all the
9909@code{mingetty-service-type} instances in the @var{%base-services} list.
9910Observe how this is accomplished: first, we arrange for the original
9911configuration to be bound to the identifier @code{config} in the @var{body},
9912and then we write the @var{body} so that it evaluates to the desired
9913configuration. In particular, notice how we use @code{inherit} to create a
9914new configuration which has the same values as the old configuration, but
9915with a few modifications.
9916
9917@cindex encrypted disk
9918The configuration for a typical ``desktop'' usage, with an encrypted root
9919partition, the X11 display server, GNOME and Xfce (users can choose which of
9920these desktop environments to use at the log-in screen by pressing
9921@kbd{F1}), network management, power management, and more, would look like
9922this:
9923
9924@lisp
9925@include os-config-desktop.texi
9926@end lisp
9927
9928A graphical system with a choice of lightweight window managers instead of
9929full-blown desktop environments would look like this:
9930
9931@lisp
9932@include os-config-lightweight-desktop.texi
9933@end lisp
9934
9935This example refers to the @file{/boot/efi} file system by its UUID,
9936@code{1234-ABCD}. Replace this UUID with the right UUID on your system, as
9937returned by the @command{blkid} command.
9938
9939@xref{Desktop-Dienste}, for the exact list of services provided by
9940@var{%desktop-services}. @xref{X.509-Zertifikate}, for background
9941information about the @code{nss-certs} package that is used here.
9942
9943Again, @var{%desktop-services} is just a list of service objects. If you
9944want to remove services from there, you can do so using the procedures for
9945list filtering (@pxref{SRFI-1 Filtering and Partitioning,,, guile, GNU Guile
9946Reference Manual}). For instance, the following expression returns a list
9947that contains all the services in @var{%desktop-services} minus the Avahi
9948service:
9949
9950@example
9951(remove (lambda (service)
9952 (eq? (service-kind service) avahi-service-type))
9953 %desktop-services)
9954@end example
9955
9956@unnumberedsubsubsec Instantiating the System
9957
9958Assuming the @code{operating-system} declaration is stored in the
9959@file{my-system-config.scm} file, the @command{guix system reconfigure
9960my-system-config.scm} command instantiates that configuration, and makes it
9961the default GRUB boot entry (@pxref{Aufruf von guix system}).
9962
9963The normal way to change the system configuration is by updating this file
9964and re-running @command{guix system reconfigure}. One should never have to
9965touch files in @file{/etc} or to run commands that modify the system state
9966such as @command{useradd} or @command{grub-install}. In fact, you must
9967avoid that since that would not only void your warranty but also prevent you
9968from rolling back to previous versions of your system, should you ever need
9969to.
9970
9971@cindex roll-back, of the operating system
9972Speaking of roll-back, each time you run @command{guix system reconfigure},
9973a new @dfn{generation} of the system is created---without modifying or
9974deleting previous generations. Old system generations get an entry in the
9975bootloader boot menu, allowing you to boot them in case something went wrong
9976with the latest generation. Reassuring, no? The @command{guix system
9977list-generations} command lists the system generations available on disk.
9978It is also possible to roll back the system via the commands @command{guix
9979system roll-back} and @command{guix system switch-generation}.
9980
9981Although the @command{guix system reconfigure} command will not modify
9982previous generations, you must take care when the current generation is not
9983the latest (e.g., after invoking @command{guix system roll-back}), since the
9984operation might overwrite a later generation (@pxref{Aufruf von guix system}).
9985
9986@unnumberedsubsubsec The Programming Interface
9987
9988At the Scheme level, the bulk of an @code{operating-system} declaration is
9989instantiated with the following monadic procedure (@pxref{Die Store-Monade}):
9990
9991@deffn {Monadic Procedure} operating-system-derivation os
9992Return a derivation that builds @var{os}, an @code{operating-system} object
9993(@pxref{Ableitungen}).
9994
9995The output of the derivation is a single directory that refers to all the
9996packages, configuration files, and other supporting files needed to
9997instantiate @var{os}.
9998@end deffn
9999
10000This procedure is provided by the @code{(gnu system)} module. Along with
10001@code{(gnu services)} (@pxref{Dienste}), this module contains the guts of
10002GuixSD. Make sure to visit it!
10003
10004
10005@node „operating-system“-Referenz
10006@subsection @code{operating-system} Reference
10007
10008This section summarizes all the options available in @code{operating-system}
793dcd8c 10009declarations (@pxref{Das Konfigurationssystem nutzen}).
1e40e70b
JL
10010
10011@deftp {Data Type} operating-system
10012This is the data type representing an operating system configuration. By
10013that, we mean all the global system configuration, not per-user
793dcd8c 10014configuration (@pxref{Das Konfigurationssystem nutzen}).
1e40e70b
JL
10015
10016@table @asis
10017@item @code{kernel} (default: @var{linux-libre})
10018The package object of the operating system kernel to use@footnote{Currently
10019only the Linux-libre kernel is supported. In the future, it will be
10020possible to use the GNU@tie{}Hurd.}.
10021
10022@item @code{kernel-arguments} (default: @code{'()})
10023List of strings or gexps representing additional arguments to pass on the
10024command-line of the kernel---e.g., @code{("console=ttyS0")}.
10025
10026@item @code{bootloader}
10027The system bootloader configuration object. @xref{Bootloader-Konfiguration}.
10028
10029@item @code{initrd-modules} (default: @code{%base-initrd-modules})
10030@cindex initrd
10031@cindex initial RAM disk
10032The list of Linux kernel modules that need to be available in the initial
10033RAM disk. @xref{Initiale RAM-Disk}.
10034
10035@item @code{initrd} (default: @code{base-initrd})
793dcd8c
LC
10036A procedure that returns an initial RAM disk for the Linux kernel. This
10037field is provided to support low-level customization and should rarely be
10038needed for casual use. @xref{Initiale RAM-Disk}.
1e40e70b
JL
10039
10040@item @code{firmware} (default: @var{%base-firmware})
10041@cindex firmware
10042List of firmware packages loadable by the operating system kernel.
10043
10044The default includes firmware needed for Atheros- and Broadcom-based WiFi
10045devices (Linux-libre modules @code{ath9k} and @code{b43-open},
10046respectively). @xref{Hardware-Überlegungen}, for more info on supported
10047hardware.
10048
10049@item @code{host-name}
10050The host name.
10051
10052@item @code{hosts-file}
10053@cindex hosts file
10054A file-like object (@pxref{G-Ausdrücke, file-like objects}) for use as
10055@file{/etc/hosts} (@pxref{Host Names,,, libc, The GNU C Library Reference
10056Manual}). The default is a file with entries for @code{localhost} and
10057@var{host-name}.
10058
10059@item @code{mapped-devices} (default: @code{'()})
10060A list of mapped devices. @xref{Abgebildete Geräte}.
10061
10062@item @code{file-systems}
10063A list of file systems. @xref{Dateisysteme}.
10064
10065@item @code{swap-devices} (default: @code{'()})
10066@cindex swap devices
10067A list of strings identifying devices or files to be used for ``swap space''
10068(@pxref{Memory Concepts,,, libc, The GNU C Library Reference Manual}). For
10069example, @code{'("/dev/sda3")} or @code{'("/swapfile")}. It is possible to
10070specify a swap file in a file system on a mapped device, provided that the
10071necessary device mapping and file system are also specified. @xref{Abgebildete Geräte} and @ref{Dateisysteme}.
10072
10073@item @code{users} (default: @code{%base-user-accounts})
10074@itemx @code{groups} (default: @var{%base-groups})
10075List of user accounts and groups. @xref{Benutzerkonten}.
10076
10077If the @code{users} list lacks a user account with UID@tie{}0, a ``root''
10078account with UID@tie{}0 is automatically added.
10079
10080@item @code{skeletons} (default: @code{(default-skeletons)})
10081A list target file name/file-like object tuples (@pxref{G-Ausdrücke,
10082file-like objects}). These are the skeleton files that will be added to the
10083home directory of newly-created user accounts.
10084
10085For instance, a valid value may look like this:
10086
10087@example
10088`((".bashrc" ,(plain-file "bashrc" "echo Hello\n"))
10089 (".guile" ,(plain-file "guile"
10090 "(use-modules (ice-9 readline))
10091 (activate-readline)")))
10092@end example
10093
10094@item @code{issue} (default: @var{%default-issue})
10095A string denoting the contents of the @file{/etc/issue} file, which is
10096displayed when users log in on a text console.
10097
10098@item @code{packages} (default: @var{%base-packages})
10099The set of packages installed in the global profile, which is accessible at
10100@file{/run/current-system/profile}.
10101
10102The default set includes core utilities and it is good practice to install
10103non-core utilities in user profiles (@pxref{Aufruf von guix package}).
10104
10105@item @code{timezone}
10106A timezone identifying string---e.g., @code{"Europe/Paris"}.
10107
10108You can run the @command{tzselect} command to find out which timezone string
10109corresponds to your region. Choosing an invalid timezone name causes
10110@command{guix system} to fail.
10111
10112@item @code{locale} (default: @code{"en_US.utf8"})
10113The name of the default locale (@pxref{Locale Names,,, libc, The GNU C
10114Library Reference Manual}). @xref{Locales}, for more information.
10115
10116@item @code{locale-definitions} (default: @var{%default-locale-definitions})
10117The list of locale definitions to be compiled and that may be used at run
10118time. @xref{Locales}.
10119
10120@item @code{locale-libcs} (default: @code{(list @var{glibc})})
10121The list of GNU@tie{}libc packages whose locale data and tools are used to
10122build the locale definitions. @xref{Locales}, for compatibility
10123considerations that justify this option.
10124
10125@item @code{name-service-switch} (default: @var{%default-nss})
10126Configuration of the libc name service switch (NSS)---a
10127@code{<name-service-switch>} object. @xref{Name Service Switch}, for
10128details.
10129
10130@item @code{services} (default: @var{%base-services})
10131A list of service objects denoting system services. @xref{Dienste}.
10132
10133@item @code{pam-services} (default: @code{(base-pam-services)})
10134@cindex PAM
10135@cindex pluggable authentication modules
10136@c FIXME: Add xref to PAM services section.
10137Linux @dfn{pluggable authentication module} (PAM) services.
10138
10139@item @code{setuid-programs} (default: @var{%setuid-programs})
10140List of string-valued G-expressions denoting setuid programs. @xref{Setuid-Programme}.
10141
10142@item @code{sudoers-file} (default: @var{%sudoers-specification})
10143@cindex sudoers file
10144The contents of the @file{/etc/sudoers} file as a file-like object
10145(@pxref{G-Ausdrücke, @code{local-file} and @code{plain-file}}).
10146
10147This file specifies which users can use the @command{sudo} command, what
10148they are allowed to do, and what privileges they may gain. The default is
10149that only @code{root} and members of the @code{wheel} group may use
10150@code{sudo}.
10151
10152@end table
10153@end deftp
10154
10155@node Dateisysteme
10156@subsection Dateisysteme
10157
10158The list of file systems to be mounted is specified in the
793dcd8c 10159@code{file-systems} field of the operating system declaration (@pxref{Das Konfigurationssystem nutzen}). Each file system is declared using the
1e40e70b
JL
10160@code{file-system} form, like this:
10161
10162@example
10163(file-system
10164 (mount-point "/home")
10165 (device "/dev/sda3")
10166 (type "ext4"))
10167@end example
10168
10169As usual, some of the fields are mandatory---those shown in the example
10170above---while others can be omitted. These are described below.
10171
10172@deftp {Data Type} file-system
10173Objects of this type represent file systems to be mounted. They contain the
10174following members:
10175
10176@table @asis
10177@item @code{type}
10178This is a string specifying the type of the file system---e.g.,
10179@code{"ext4"}.
10180
10181@item @code{mount-point}
10182This designates the place where the file system is to be mounted.
10183
10184@item @code{device}
10185This names the ``source'' of the file system. It can be one of three
10186things: a file system label, a file system UUID, or the name of a
10187@file{/dev} node. Labels and UUIDs offer a way to refer to file systems
10188without having to hard-code their actual device name@footnote{Note that,
10189while it is tempting to use @file{/dev/disk/by-uuid} and similar device
10190names to achieve the same result, this is not recommended: These special
10191device nodes are created by the udev daemon and may be unavailable at the
10192time the device is mounted.}.
10193
10194@findex file-system-label
10195File system labels are created using the @code{file-system-label} procedure,
10196UUIDs are created using @code{uuid}, and @file{/dev} node are plain
10197strings. Here's an example of a file system referred to by its label, as
10198shown by the @command{e2label} command:
10199
10200@example
10201(file-system
10202 (mount-point "/home")
10203 (type "ext4")
10204 (device (file-system-label "my-home")))
10205@end example
10206
10207@findex uuid
10208UUIDs are converted from their string representation (as shown by the
10209@command{tune2fs -l} command) using the @code{uuid} form@footnote{The
10210@code{uuid} form expects 16-byte UUIDs as defined in
10211@uref{https://tools.ietf.org/html/rfc4122, RFC@tie{}4122}. This is the form
10212of UUID used by the ext2 family of file systems and others, but it is
10213different from ``UUIDs'' found in FAT file systems, for instance.}, like
10214this:
10215
10216@example
10217(file-system
10218 (mount-point "/home")
10219 (type "ext4")
10220 (device (uuid "4dab5feb-d176-45de-b287-9b0a6e4c01cb")))
10221@end example
10222
10223When the source of a file system is a mapped device (@pxref{Abgebildete Geräte}), its @code{device} field @emph{must} refer to the mapped device
10224name---e.g., @file{"/dev/mapper/root-partition"}. This is required so that
10225the system knows that mounting the file system depends on having the
10226corresponding device mapping established.
10227
10228@item @code{flags} (default: @code{'()})
10229This is a list of symbols denoting mount flags. Recognized flags include
10230@code{read-only}, @code{bind-mount}, @code{no-dev} (disallow access to
10231special files), @code{no-suid} (ignore setuid and setgid bits), and
10232@code{no-exec} (disallow program execution.)
10233
10234@item @code{options} (default: @code{#f})
10235This is either @code{#f}, or a string denoting mount options.
10236
10237@item @code{mount?} (default: @code{#t})
10238This value indicates whether to automatically mount the file system when the
10239system is brought up. When set to @code{#f}, the file system gets an entry
10240in @file{/etc/fstab} (read by the @command{mount} command) but is not
10241automatically mounted.
10242
10243@item @code{needed-for-boot?} (default: @code{#f})
10244This Boolean value indicates whether the file system is needed when
10245booting. If that is true, then the file system is mounted when the initial
10246RAM disk (initrd) is loaded. This is always the case, for instance, for the
10247root file system.
10248
10249@item @code{check?} (default: @code{#t})
10250This Boolean indicates whether the file system needs to be checked for
10251errors before being mounted.
10252
10253@item @code{create-mount-point?} (default: @code{#f})
10254When true, the mount point is created if it does not exist yet.
10255
10256@item @code{dependencies} (default: @code{'()})
10257This is a list of @code{<file-system>} or @code{<mapped-device>} objects
10258representing file systems that must be mounted or mapped devices that must
10259be opened before (and unmounted or closed after) this one.
10260
10261As an example, consider a hierarchy of mounts: @file{/sys/fs/cgroup} is a
10262dependency of @file{/sys/fs/cgroup/cpu} and @file{/sys/fs/cgroup/memory}.
10263
10264Another example is a file system that depends on a mapped device, for
10265example for an encrypted partition (@pxref{Abgebildete Geräte}).
10266@end table
10267@end deftp
10268
10269The @code{(gnu system file-systems)} exports the following useful variables.
10270
10271@defvr {Scheme Variable} %base-file-systems
10272These are essential file systems that are required on normal systems, such
10273as @var{%pseudo-terminal-file-system} and @var{%immutable-store} (see
10274below.) Operating system declarations should always contain at least these.
10275@end defvr
10276
10277@defvr {Scheme Variable} %pseudo-terminal-file-system
10278This is the file system to be mounted as @file{/dev/pts}. It supports
10279@dfn{pseudo-terminals} created @i{via} @code{openpty} and similar functions
10280(@pxref{Pseudo-Terminals,,, libc, The GNU C Library Reference Manual}).
10281Pseudo-terminals are used by terminal emulators such as @command{xterm}.
10282@end defvr
10283
10284@defvr {Scheme Variable} %shared-memory-file-system
10285This file system is mounted as @file{/dev/shm} and is used to support memory
10286sharing across processes (@pxref{Memory-mapped I/O, @code{shm_open},, libc,
10287The GNU C Library Reference Manual}).
10288@end defvr
10289
10290@defvr {Scheme Variable} %immutable-store
10291This file system performs a read-only ``bind mount'' of @file{/gnu/store},
10292making it read-only for all the users including @code{root}. This prevents
10293against accidental modification by software running as @code{root} or by
10294system administrators.
10295
10296The daemon itself is still able to write to the store: it remounts it
10297read-write in its own ``name space.''
10298@end defvr
10299
10300@defvr {Scheme Variable} %binary-format-file-system
10301The @code{binfmt_misc} file system, which allows handling of arbitrary
10302executable file types to be delegated to user space. This requires the
10303@code{binfmt.ko} kernel module to be loaded.
10304@end defvr
10305
10306@defvr {Scheme Variable} %fuse-control-file-system
10307The @code{fusectl} file system, which allows unprivileged users to mount and
10308unmount user-space FUSE file systems. This requires the @code{fuse.ko}
10309kernel module to be loaded.
10310@end defvr
10311
10312@node Abgebildete Geräte
10313@subsection Abgebildete Geräte
10314
10315@cindex device mapping
10316@cindex mapped devices
10317The Linux kernel has a notion of @dfn{device mapping}: a block device, such
10318as a hard disk partition, can be @dfn{mapped} into another device, usually
10319in @code{/dev/mapper/}, with additional processing over the data that flows
10320through it@footnote{Note that the GNU@tie{}Hurd makes no difference between
10321the concept of a ``mapped device'' and that of a file system: both boil down
10322to @emph{translating} input/output operations made on a file to operations
10323on its backing store. Thus, the Hurd implements mapped devices, like file
10324systems, using the generic @dfn{translator} mechanism (@pxref{Translators,,,
10325hurd, The GNU Hurd Reference Manual}).}. A typical example is encryption
10326device mapping: all writes to the mapped device are encrypted, and all reads
10327are deciphered, transparently. Guix extends this notion by considering any
10328device or set of devices that are @dfn{transformed} in some way to create a
10329new device; for instance, RAID devices are obtained by @dfn{assembling}
10330several other devices, such as hard disks or partitions, into a new one that
10331behaves as one partition. Other examples, not yet implemented, are LVM
10332logical volumes.
10333
10334Mapped devices are declared using the @code{mapped-device} form, defined as
10335follows; for examples, see below.
10336
10337@deftp {Data Type} mapped-device
10338Objects of this type represent device mappings that will be made when the
10339system boots up.
10340
10341@table @code
10342@item source
10343This is either a string specifying the name of the block device to be
10344mapped, such as @code{"/dev/sda3"}, or a list of such strings when several
10345devices need to be assembled for creating a new one.
10346
10347@item target
10348This string specifies the name of the resulting mapped device. For kernel
10349mappers such as encrypted devices of type @code{luks-device-mapping},
10350specifying @code{"my-partition"} leads to the creation of the
10351@code{"/dev/mapper/my-partition"} device. For RAID devices of type
10352@code{raid-device-mapping}, the full device name such as @code{"/dev/md0"}
10353needs to be given.
10354
10355@item type
10356This must be a @code{mapped-device-kind} object, which specifies how
10357@var{source} is mapped to @var{target}.
10358@end table
10359@end deftp
10360
10361@defvr {Scheme Variable} luks-device-mapping
10362This defines LUKS block device encryption using the @command{cryptsetup}
10363command from the package with the same name. It relies on the
10364@code{dm-crypt} Linux kernel module.
10365@end defvr
10366
10367@defvr {Scheme Variable} raid-device-mapping
10368This defines a RAID device, which is assembled using the @code{mdadm}
10369command from the package with the same name. It requires a Linux kernel
10370module for the appropriate RAID level to be loaded, such as @code{raid456}
10371for RAID-4, RAID-5 or RAID-6, or @code{raid10} for RAID-10.
10372@end defvr
10373
10374@cindex disk encryption
10375@cindex LUKS
10376The following example specifies a mapping from @file{/dev/sda3} to
10377@file{/dev/mapper/home} using LUKS---the
10378@url{https://gitlab.com/cryptsetup/cryptsetup,Linux Unified Key Setup}, a
10379standard mechanism for disk encryption. The @file{/dev/mapper/home} device
10380can then be used as the @code{device} of a @code{file-system} declaration
10381(@pxref{Dateisysteme}).
10382
10383@example
10384(mapped-device
10385 (source "/dev/sda3")
10386 (target "home")
10387 (type luks-device-mapping))
10388@end example
10389
10390Alternatively, to become independent of device numbering, one may obtain the
10391LUKS UUID (@dfn{unique identifier}) of the source device by a command like:
10392
10393@example
10394cryptsetup luksUUID /dev/sda3
10395@end example
10396
10397and use it as follows:
10398
10399@example
10400(mapped-device
10401 (source (uuid "cb67fc72-0d54-4c88-9d4b-b225f30b0f44"))
10402 (target "home")
10403 (type luks-device-mapping))
10404@end example
10405
10406@cindex swap encryption
10407It is also desirable to encrypt swap space, since swap space may contain
10408sensitive data. One way to accomplish that is to use a swap file in a file
10409system on a device mapped via LUKS encryption. In this way, the swap file
10410is encrypted because the entire device is encrypted. @xref{Vor der Installation,,Disk Partitioning}, for an example.
10411
10412A RAID device formed of the partitions @file{/dev/sda1} and @file{/dev/sdb1}
10413may be declared as follows:
10414
10415@example
10416(mapped-device
10417 (source (list "/dev/sda1" "/dev/sdb1"))
10418 (target "/dev/md0")
10419 (type raid-device-mapping))
10420@end example
10421
10422The @file{/dev/md0} device can then be used as the @code{device} of a
10423@code{file-system} declaration (@pxref{Dateisysteme}). Note that the RAID
10424level need not be given; it is chosen during the initial creation and
10425formatting of the RAID device and is determined automatically later.
10426
10427
10428@node Benutzerkonten
10429@subsection Benutzerkonten
10430
10431@cindex users
10432@cindex accounts
10433@cindex user accounts
10434User accounts and groups are entirely managed through the
10435@code{operating-system} declaration. They are specified with the
10436@code{user-account} and @code{user-group} forms:
10437
10438@example
10439(user-account
10440 (name "alice")
10441 (group "users")
10442 (supplementary-groups '("wheel" ;allow use of sudo, etc.
10443 "audio" ;sound card
10444 "video" ;video devices such as webcams
10445 "cdrom")) ;the good ol' CD-ROM
10446 (comment "Bob's sister")
10447 (home-directory "/home/alice"))
10448@end example
10449
10450When booting or upon completion of @command{guix system reconfigure}, the
10451system ensures that only the user accounts and groups specified in the
10452@code{operating-system} declaration exist, and with the specified
10453properties. Thus, account or group creations or modifications made by
10454directly invoking commands such as @command{useradd} are lost upon
10455reconfiguration or reboot. This ensures that the system remains exactly as
10456declared.
10457
10458@deftp {Data Type} user-account
10459Objects of this type represent user accounts. The following members may be
10460specified:
10461
10462@table @asis
10463@item @code{name}
10464The name of the user account.
10465
10466@item @code{group}
10467@cindex groups
10468This is the name (a string) or identifier (a number) of the user group this
10469account belongs to.
10470
10471@item @code{supplementary-groups} (default: @code{'()})
10472Optionally, this can be defined as a list of group names that this account
10473belongs to.
10474
10475@item @code{uid} (default: @code{#f})
10476This is the user ID for this account (a number), or @code{#f}. In the
10477latter case, a number is automatically chosen by the system when the account
10478is created.
10479
10480@item @code{comment} (default: @code{""})
10481A comment about the account, such as the account owner's full name.
10482
10483@item @code{home-directory}
10484This is the name of the home directory for the account.
10485
10486@item @code{create-home-directory?} (default: @code{#t})
10487Indicates whether the home directory of this account should be created if it
10488does not exist yet.
10489
10490@item @code{shell} (default: Bash)
10491This is a G-expression denoting the file name of a program to be used as the
10492shell (@pxref{G-Ausdrücke}).
10493
10494@item @code{system?} (default: @code{#f})
10495This Boolean value indicates whether the account is a ``system'' account.
10496System accounts are sometimes treated specially; for instance, graphical
10497login managers do not list them.
10498
10499@anchor{user-account-password}
10500@item @code{password} (default: @code{#f})
10501You would normally leave this field to @code{#f}, initialize user passwords
10502as @code{root} with the @command{passwd} command, and then let users change
10503it with @command{passwd}. Passwords set with @command{passwd} are of course
10504preserved across reboot and reconfiguration.
10505
10506If you @emph{do} want to have a preset password for an account, then this
10507field must contain the encrypted password, as a string. @xref{crypt,,,
10508libc, The GNU C Library Reference Manual}, for more information on password
10509encryption, and @ref{Encryption,,, guile, GNU Guile Reference Manual}, for
10510information on Guile's @code{crypt} procedure.
10511
10512@end table
10513@end deftp
10514
10515@cindex groups
10516User group declarations are even simpler:
10517
10518@example
10519(user-group (name "students"))
10520@end example
10521
10522@deftp {Data Type} user-group
10523This type is for, well, user groups. There are just a few fields:
10524
10525@table @asis
10526@item @code{name}
10527The name of the group.
10528
10529@item @code{id} (default: @code{#f})
10530The group identifier (a number). If @code{#f}, a new number is
10531automatically allocated when the group is created.
10532
10533@item @code{system?} (default: @code{#f})
10534This Boolean value indicates whether the group is a ``system'' group.
10535System groups have low numerical IDs.
10536
10537@item @code{password} (default: @code{#f})
10538What, user groups can have a password? Well, apparently yes. Unless
10539@code{#f}, this field specifies the password of the group.
10540
10541@end table
10542@end deftp
10543
10544For convenience, a variable lists all the basic user groups one may expect:
10545
10546@defvr {Scheme Variable} %base-groups
10547This is the list of basic user groups that users and/or packages expect to
10548be present on the system. This includes groups such as ``root'', ``wheel'',
10549and ``users'', as well as groups used to control access to specific devices
10550such as ``audio'', ``disk'', and ``cdrom''.
10551@end defvr
10552
10553@defvr {Scheme Variable} %base-user-accounts
10554This is the list of basic system accounts that programs may expect to find
10555on a GNU/Linux system, such as the ``nobody'' account.
10556
10557Note that the ``root'' account is not included here. It is a special-case
10558and is automatically added whether or not it is specified.
10559@end defvr
10560
10561@node Locales
10562@subsection Locales
10563
10564@cindex locale
10565A @dfn{locale} defines cultural conventions for a particular language and
10566region of the world (@pxref{Locales,,, libc, The GNU C Library Reference
10567Manual}). Each locale has a name that typically has the form
10568@code{@var{language}_@var{territory}.@var{codeset}}---e.g.,
10569@code{fr_LU.utf8} designates the locale for the French language, with
10570cultural conventions from Luxembourg, and using the UTF-8 encoding.
10571
10572@cindex locale definition
10573Usually, you will want to specify the default locale for the machine using
10574the @code{locale} field of the @code{operating-system} declaration
10575(@pxref{„operating-system“-Referenz, @code{locale}}).
10576
10577The selected locale is automatically added to the @dfn{locale definitions}
10578known to the system if needed, with its codeset inferred from its
10579name---e.g., @code{bo_CN.utf8} will be assumed to use the @code{UTF-8}
10580codeset. Additional locale definitions can be specified in the
10581@code{locale-definitions} slot of @code{operating-system}---this is useful,
10582for instance, if the codeset could not be inferred from the locale name.
10583The default set of locale definitions includes some widely used locales, but
10584not all the available locales, in order to save space.
10585
10586For instance, to add the North Frisian locale for Germany, the value of that
10587field may be:
10588
10589@example
10590(cons (locale-definition
10591 (name "fy_DE.utf8") (source "fy_DE"))
10592 %default-locale-definitions)
10593@end example
10594
10595Likewise, to save space, one might want @code{locale-definitions} to list
10596only the locales that are actually used, as in:
10597
10598@example
10599(list (locale-definition
10600 (name "ja_JP.eucjp") (source "ja_JP")
10601 (charset "EUC-JP")))
10602@end example
10603
10604@vindex LOCPATH
10605The compiled locale definitions are available at
10606@file{/run/current-system/locale/X.Y}, where @code{X.Y} is the libc version,
10607which is the default location where the GNU@tie{}libc provided by Guix looks
10608for locale data. This can be overridden using the @code{LOCPATH}
10609environment variable (@pxref{locales-and-locpath, @code{LOCPATH} and locale
10610packages}).
10611
10612The @code{locale-definition} form is provided by the @code{(gnu system
10613locale)} module. Details are given below.
10614
10615@deftp {Data Type} locale-definition
10616This is the data type of a locale definition.
10617
10618@table @asis
10619
10620@item @code{name}
10621The name of the locale. @xref{Locale Names,,, libc, The GNU C Library
10622Reference Manual}, for more information on locale names.
10623
10624@item @code{source}
10625The name of the source for that locale. This is typically the
10626@code{@var{language}_@var{territory}} part of the locale name.
10627
10628@item @code{charset} (default: @code{"UTF-8"})
10629The ``character set'' or ``code set'' for that locale,
10630@uref{http://www.iana.org/assignments/character-sets, as defined by IANA}.
10631
10632@end table
10633@end deftp
10634
10635@defvr {Scheme Variable} %default-locale-definitions
10636A list of commonly used UTF-8 locales, used as the default value of the
10637@code{locale-definitions} field of @code{operating-system} declarations.
10638
10639@cindex locale name
10640@cindex normalized codeset in locale names
10641These locale definitions use the @dfn{normalized codeset} for the part that
10642follows the dot in the name (@pxref{Using gettextized software, normalized
10643codeset,, libc, The GNU C Library Reference Manual}). So for instance it
10644has @code{uk_UA.utf8} but @emph{not}, say, @code{uk_UA.UTF-8}.
10645@end defvr
10646
10647@subsubsection Locale Data Compatibility Considerations
10648
10649@cindex incompatibility, of locale data
10650@code{operating-system} declarations provide a @code{locale-libcs} field to
10651specify the GNU@tie{}libc packages that are used to compile locale
10652declarations (@pxref{„operating-system“-Referenz}). ``Why would I care?'',
10653you may ask. Well, it turns out that the binary format of locale data is
10654occasionally incompatible from one libc version to another.
10655
10656@c See <https://sourceware.org/ml/libc-alpha/2015-09/msg00575.html>
10657@c and <https://lists.gnu.org/archive/html/guix-devel/2015-08/msg00737.html>.
10658For instance, a program linked against libc version 2.21 is unable to read
10659locale data produced with libc 2.22; worse, that program @emph{aborts}
10660instead of simply ignoring the incompatible locale data@footnote{Versions
106612.23 and later of GNU@tie{}libc will simply skip the incompatible locale
10662data, which is already an improvement.}. Similarly, a program linked
10663against libc 2.22 can read most, but not all, of the locale data from libc
106642.21 (specifically, @code{LC_COLLATE} data is incompatible); thus calls to
10665@code{setlocale} may fail, but programs will not abort.
10666
10667The ``problem'' in GuixSD is that users have a lot of freedom: They can
10668choose whether and when to upgrade software in their profiles, and might be
10669using a libc version different from the one the system administrator used to
10670build the system-wide locale data.
10671
10672Fortunately, unprivileged users can also install their own locale data and
10673define @var{GUIX_LOCPATH} accordingly (@pxref{locales-and-locpath,
10674@code{GUIX_LOCPATH} and locale packages}).
10675
10676Still, it is best if the system-wide locale data at
10677@file{/run/current-system/locale} is built for all the libc versions
10678actually in use on the system, so that all the programs can access it---this
10679is especially crucial on a multi-user system. To do that, the administrator
10680can specify several libc packages in the @code{locale-libcs} field of
10681@code{operating-system}:
10682
10683@example
10684(use-package-modules base)
10685
10686(operating-system
10687 ;; @dots{}
10688 (locale-libcs (list glibc-2.21 (canonical-package glibc))))
10689@end example
10690
10691This example would lead to a system containing locale definitions for both
10692libc 2.21 and the current version of libc in
10693@file{/run/current-system/locale}.
10694
10695
10696@node Dienste
10697@subsection Dienste
10698
10699@cindex system services
10700An important part of preparing an @code{operating-system} declaration is
793dcd8c 10701listing @dfn{system services} and their configuration (@pxref{Das Konfigurationssystem nutzen}). System services are typically daemons launched when
1e40e70b
JL
10702the system boots, or other actions needed at that time---e.g., configuring
10703network access.
10704
10705GuixSD has a broad definition of ``service'' (@pxref{Dienstkompositionen}),
10706but many services are managed by the GNU@tie{}Shepherd (@pxref{Shepherd-Dienste}). On a running system, the @command{herd} command allows you to
10707list the available services, show their status, start and stop them, or do
10708other specific operations (@pxref{Jump Start,,, shepherd, The GNU Shepherd
10709Manual}). For example:
10710
10711@example
10712# herd status
10713@end example
10714
10715The above command, run as @code{root}, lists the currently defined
10716services. The @command{herd doc} command shows a synopsis of the given
793dcd8c 10717service and its associated actions:
1e40e70b
JL
10718
10719@example
10720# herd doc nscd
10721Run libc's name service cache daemon (nscd).
793dcd8c
LC
10722
10723# herd doc nscd action invalidate
10724invalidate: Invalidate the given cache--e.g., 'hosts' for host name lookups.
1e40e70b
JL
10725@end example
10726
10727The @command{start}, @command{stop}, and @command{restart} sub-commands have
10728the effect you would expect. For instance, the commands below stop the nscd
10729service and restart the Xorg display server:
10730
10731@example
10732# herd stop nscd
10733Service nscd has been stopped.
10734# herd restart xorg-server
10735Service xorg-server has been stopped.
10736Service xorg-server has been started.
10737@end example
10738
10739The following sections document the available services, starting with the
10740core services, that may be used in an @code{operating-system} declaration.
10741
10742@menu
793dcd8c 10743* Basisdienste:: Essenzielle Systemdienste.
1e40e70b
JL
10744* Geplante Auftragsausführung:: Der mcron-Dienst.
10745* Log-Rotation:: Der rottlog-Dienst.
10746* Netzwerkdienste:: Netzwerkeinrichtung, SSH-Daemon etc.
10747* X Window:: Graphische Anzeige.
10748* Druckdienste:: Unterstützung für lokale und entfernte
10749 Drucker.
10750* Desktop-Dienste:: D-Bus- und Desktop-Dienste.
793dcd8c 10751* Sound Services:: ALSA and Pulseaudio services.
1e40e70b
JL
10752* Datenbankdienste:: SQL-Datenbanken, Schlüssel-Wert-Speicher etc.
10753* Mail-Dienste:: IMAP, POP3, SMTP und so weiter.
10754* Kurznachrichtendienste:: Dienste für Kurznachrichten.
10755* Telefondienste:: Telefoniedienste.
10756* Überwachungsdienste:: Dienste zur Systemüberwachung.
10757* Kerberos-Dienste:: Kerberos-Dienste.
10758* Web-Dienste:: Web-Server.
10759* Zertifikatsdienste:: TLS-Zertifikate via Let’s Encrypt.
10760* DNS-Dienste:: DNS-Daemons.
10761* VPN-Dienste:: VPN-Daemons.
10762* Network File System:: Dienste mit Bezug zum Netzwerkdateisystem.
793dcd8c 10763* Kontinuierliche Integration:: Der Cuirass-Dienst.
1e40e70b
JL
10764* Power Management Services:: Extending battery life.
10765* Audio-Dienste:: Der MPD.
10766* Virtualisierungsdienste:: Dienste für virtuelle Maschinen.
10767* Versionskontrolldienste:: Entfernten Zugang zu Git-Repositorys bieten.
10768* Spieldienste:: Spielserver.
10769* Verschiedene Dienste:: Andere Dienste.
10770@end menu
10771
10772@node Basisdienste
10773@subsubsection Basisdienste
10774
10775The @code{(gnu services base)} module provides definitions for the basic
10776services that one expects from the system. The services exported by this
10777module are listed below.
10778
10779@defvr {Scheme Variable} %base-services
10780This variable contains a list of basic services (@pxref{Diensttypen und Dienste}, for more information on service objects) one would expect from
10781the system: a login service (mingetty) on each tty, syslogd, the libc name
10782service cache daemon (nscd), the udev device manager, and more.
10783
10784This is the default value of the @code{services} field of
10785@code{operating-system} declarations. Usually, when customizing a system,
10786you will want to append services to @var{%base-services}, like this:
10787
10788@example
10789(cons* (avahi-service) (lsh-service) %base-services)
10790@end example
10791@end defvr
10792
10793@defvr {Scheme Variable} special-files-service-type
10794This is the service that sets up ``special files'' such as @file{/bin/sh};
10795an instance of it is part of @code{%base-services}.
10796
10797The value associated with @code{special-files-service-type} services must be
10798a list of tuples where the first element is the ``special file'' and the
10799second element is its target. By default it is:
10800
10801@cindex @file{/bin/sh}
10802@cindex @file{sh}, in @file{/bin}
10803@example
10804`(("/bin/sh" ,(file-append @var{bash} "/bin/sh")))
10805@end example
10806
10807@cindex @file{/usr/bin/env}
10808@cindex @file{env}, in @file{/usr/bin}
10809If you want to add, say, @code{/usr/bin/env} to your system, you can change
10810it to:
10811
10812@example
10813`(("/bin/sh" ,(file-append @var{bash} "/bin/sh"))
10814 ("/usr/bin/env" ,(file-append @var{coreutils} "/bin/env")))
10815@end example
10816
10817Since this is part of @code{%base-services}, you can use
10818@code{modify-services} to customize the set of special files (@pxref{Service-Referenz, @code{modify-services}}). But the simple way to add a special
10819file is @i{via} the @code{extra-special-file} procedure (see below.)
10820@end defvr
10821
10822@deffn {Scheme Procedure} extra-special-file @var{file} @var{target}
10823Use @var{target} as the ``special file'' @var{file}.
10824
10825For example, adding the following lines to the @code{services} field of your
10826operating system declaration leads to a @file{/usr/bin/env} symlink:
10827
10828@example
10829(extra-special-file "/usr/bin/env"
10830 (file-append coreutils "/bin/env"))
10831@end example
10832@end deffn
10833
10834@deffn {Scheme Procedure} host-name-service @var{name}
10835Return a service that sets the host name to @var{name}.
10836@end deffn
10837
10838@deffn {Scheme Procedure} login-service @var{config}
10839Return a service to run login according to @var{config}, a
10840@code{<login-configuration>} object, which specifies the message of the day,
10841among other things.
10842@end deffn
10843
10844@deftp {Data Type} login-configuration
10845This is the data type representing the configuration of login.
10846
10847@table @asis
10848
10849@item @code{motd}
10850@cindex message of the day
10851A file-like object containing the ``message of the day''.
10852
10853@item @code{allow-empty-passwords?} (default: @code{#t})
10854Allow empty passwords by default so that first-time users can log in when
10855the 'root' account has just been created.
10856
10857@end table
10858@end deftp
10859
10860@deffn {Scheme Procedure} mingetty-service @var{config}
10861Return a service to run mingetty according to @var{config}, a
10862@code{<mingetty-configuration>} object, which specifies the tty to run,
10863among other things.
10864@end deffn
10865
10866@deftp {Data Type} mingetty-configuration
10867This is the data type representing the configuration of Mingetty, which
10868provides the default implementation of virtual console log-in.
10869
10870@table @asis
10871
10872@item @code{tty}
10873The name of the console this Mingetty runs on---e.g., @code{"tty1"}.
10874
10875@item @code{auto-login} (default: @code{#f})
10876When true, this field must be a string denoting the user name under which
10877the system automatically logs in. When it is @code{#f}, a user name and
10878password must be entered to log in.
10879
10880@item @code{login-program} (default: @code{#f})
10881This must be either @code{#f}, in which case the default log-in program is
10882used (@command{login} from the Shadow tool suite), or a gexp denoting the
10883name of the log-in program.
10884
10885@item @code{login-pause?} (default: @code{#f})
10886When set to @code{#t} in conjunction with @var{auto-login}, the user will
10887have to press a key before the log-in shell is launched.
10888
10889@item @code{mingetty} (default: @var{mingetty})
10890The Mingetty package to use.
10891
10892@end table
10893@end deftp
10894
10895@deffn {Scheme Procedure} agetty-service @var{config}
10896Return a service to run agetty according to @var{config}, an
10897@code{<agetty-configuration>} object, which specifies the tty to run, among
10898other things.
10899@end deffn
10900
10901@deftp {Data Type} agetty-configuration
10902This is the data type representing the configuration of agetty, which
10903implements virtual and serial console log-in. See the @code{agetty(8)} man
10904page for more information.
10905
10906@table @asis
10907
10908@item @code{tty}
10909The name of the console this agetty runs on, as a string---e.g.,
10910@code{"ttyS0"}. This argument is optional, it will default to a reasonable
10911default serial port used by the kernel Linux.
10912
10913For this, if there is a value for an option @code{agetty.tty} in the kernel
10914command line, agetty will extract the device name of the serial port from it
10915and use that.
10916
10917If not and if there is a value for an option @code{console} with a tty in
10918the Linux command line, agetty will extract the device name of the serial
10919port from it and use that.
10920
10921In both cases, agetty will leave the other serial device settings (baud rate
793dcd8c 10922etc.)@: alone---in the hope that Linux pinned them to the correct values.
1e40e70b
JL
10923
10924@item @code{baud-rate} (default: @code{#f})
10925A string containing a comma-separated list of one or more baud rates, in
10926descending order.
10927
10928@item @code{term} (default: @code{#f})
10929A string containing the value used for the @code{TERM} environment variable.
10930
10931@item @code{eight-bits?} (default: @code{#f})
10932When @code{#t}, the tty is assumed to be 8-bit clean, and parity detection
10933is disabled.
10934
10935@item @code{auto-login} (default: @code{#f})
10936When passed a login name, as a string, the specified user will be logged in
10937automatically without prompting for their login name or password.
10938
10939@item @code{no-reset?} (default: @code{#f})
10940When @code{#t}, don't reset terminal cflags (control modes).
10941
10942@item @code{host} (default: @code{#f})
10943This accepts a string containing the "login_host", which will be written
10944into the @file{/var/run/utmpx} file.
10945
10946@item @code{remote?} (default: @code{#f})
10947When set to @code{#t} in conjunction with @var{host}, this will add an
10948@code{-r} fakehost option to the command line of the login program specified
10949in @var{login-program}.
10950
10951@item @code{flow-control?} (default: @code{#f})
10952When set to @code{#t}, enable hardware (RTS/CTS) flow control.
10953
10954@item @code{no-issue?} (default: @code{#f})
10955When set to @code{#t}, the contents of the @file{/etc/issue} file will not
10956be displayed before presenting the login prompt.
10957
10958@item @code{init-string} (default: @code{#f})
10959This accepts a string that will be sent to the tty or modem before sending
10960anything else. It can be used to initialize a modem.
10961
10962@item @code{no-clear?} (default: @code{#f})
10963When set to @code{#t}, agetty will not clear the screen before showing the
10964login prompt.
10965
10966@item @code{login-program} (default: (file-append shadow "/bin/login"))
10967This must be either a gexp denoting the name of a log-in program, or unset,
10968in which case the default value is the @command{login} from the Shadow tool
10969suite.
10970
10971@item @code{local-line} (default: @code{#f})
10972Control the CLOCAL line flag. This accepts one of three symbols as
10973arguments, @code{'auto}, @code{'always}, or @code{'never}. If @code{#f}, the
10974default value chosen by agetty is @code{'auto}.
10975
10976@item @code{extract-baud?} (default: @code{#f})
10977When set to @code{#t}, instruct agetty to try to extract the baud rate from
10978the status messages produced by certain types of modems.
10979
10980@item @code{skip-login?} (default: @code{#f})
10981When set to @code{#t}, do not prompt the user for a login name. This can be
10982used with @var{login-program} field to use non-standard login systems.
10983
10984@item @code{no-newline?} (default: @code{#f})
10985When set to @code{#t}, do not print a newline before printing the
10986@file{/etc/issue} file.
10987
10988@c Is this dangerous only when used with login-program, or always?
10989@item @code{login-options} (default: @code{#f})
10990This option accepts a string containing options that are passed to the login
10991program. When used with the @var{login-program}, be aware that a malicious
10992user could try to enter a login name containing embedded options that could
10993be parsed by the login program.
10994
10995@item @code{login-pause} (default: @code{#f})
10996When set to @code{#t}, wait for any key before showing the login prompt.
10997This can be used in conjunction with @var{auto-login} to save memory by
10998lazily spawning shells.
10999
11000@item @code{chroot} (default: @code{#f})
11001Change root to the specified directory. This option accepts a directory
11002path as a string.
11003
11004@item @code{hangup?} (default: @code{#f})
11005Use the Linux system call @code{vhangup} to do a virtual hangup of the
11006specified terminal.
11007
11008@item @code{keep-baud?} (default: @code{#f})
11009When set to @code{#t}, try to keep the existing baud rate. The baud rates
11010from @var{baud-rate} are used when agetty receives a @key{BREAK} character.
11011
11012@item @code{timeout} (default: @code{#f})
11013When set to an integer value, terminate if no user name could be read within
11014@var{timeout} seconds.
11015
11016@item @code{detect-case?} (default: @code{#f})
11017When set to @code{#t}, turn on support for detecting an uppercase-only
11018terminal. This setting will detect a login name containing only uppercase
11019letters as indicating an uppercase-only terminal and turn on some
11020upper-to-lower case conversions. Note that this will not support Unicode
11021characters.
11022
11023@item @code{wait-cr?} (default: @code{#f})
11024When set to @code{#t}, wait for the user or modem to send a carriage-return
11025or linefeed character before displaying @file{/etc/issue} or login prompt.
11026This is typically used with the @var{init-string} option.
11027
11028@item @code{no-hints?} (default: @code{#f})
11029When set to @code{#t}, do not print hints about Num, Caps, and Scroll locks.
11030
11031@item @code{no-hostname?} (default: @code{#f})
11032By default, the hostname is printed. When this option is set to @code{#t},
11033no hostname will be shown at all.
11034
11035@item @code{long-hostname?} (default: @code{#f})
11036By default, the hostname is only printed until the first dot. When this
11037option is set to @code{#t}, the fully qualified hostname by
11038@code{gethostname} or @code{getaddrinfo} is shown.
11039
11040@item @code{erase-characters} (default: @code{#f})
11041This option accepts a string of additional characters that should be
11042interpreted as backspace when the user types their login name.
11043
11044@item @code{kill-characters} (default: @code{#f})
11045This option accepts a string that should be interpreted to mean "ignore all
11046previous characters" (also called a "kill" character) when the types their
11047login name.
11048
11049@item @code{chdir} (default: @code{#f})
11050This option accepts, as a string, a directory path that will be changed to
11051before login.
11052
11053@item @code{delay} (default: @code{#f})
11054This options accepts, as an integer, the number of seconds to sleep before
11055opening the tty and displaying the login prompt.
11056
11057@item @code{nice} (default: @code{#f})
11058This option accepts, as an integer, the nice value with which to run the
11059@command{login} program.
11060
11061@item @code{extra-options} (default: @code{'()})
11062This option provides an "escape hatch" for the user to provide arbitrary
11063command-line arguments to @command{agetty} as a list of strings.
11064
11065@end table
11066@end deftp
11067
11068@deffn {Scheme Procedure} kmscon-service-type @var{config}
11069Return a service to run
11070@uref{https://www.freedesktop.org/wiki/Software/kmscon,kmscon} according to
11071@var{config}, a @code{<kmscon-configuration>} object, which specifies the
11072tty to run, among other things.
11073@end deffn
11074
11075@deftp {Data Type} kmscon-configuration
11076This is the data type representing the configuration of Kmscon, which
11077implements virtual console log-in.
11078
11079@table @asis
11080
11081@item @code{virtual-terminal}
11082The name of the console this Kmscon runs on---e.g., @code{"tty1"}.
11083
11084@item @code{login-program} (default: @code{#~(string-append #$shadow "/bin/login")})
11085A gexp denoting the name of the log-in program. The default log-in program
11086is @command{login} from the Shadow tool suite.
11087
11088@item @code{login-arguments} (default: @code{'("-p")})
11089A list of arguments to pass to @command{login}.
11090
793dcd8c
LC
11091@item @code{auto-login} (default: @code{#f})
11092When passed a login name, as a string, the specified user will be logged in
11093automatically without prompting for their login name or password.
11094
1e40e70b
JL
11095@item @code{hardware-acceleration?} (default: #f)
11096Whether to use hardware acceleration.
11097
11098@item @code{kmscon} (default: @var{kmscon})
11099The Kmscon package to use.
11100
11101@end table
11102@end deftp
11103
11104@cindex name service cache daemon
11105@cindex nscd
11106@deffn {Scheme Procedure} nscd-service [@var{config}] [#:glibc glibc] @
11107 [#:name-services '()] Return a service that runs the libc name service cache
11108daemon (nscd) with the given @var{config}---an @code{<nscd-configuration>}
11109object. @xref{Name Service Switch}, for an example.
793dcd8c
LC
11110
11111For convenience, the Shepherd service for nscd provides the following
11112actions:
11113
11114@table @code
11115@item invalidate
11116@cindex cache invalidation, nscd
11117@cindex nscd, cache invalidation
11118This invalidate the given cache. For instance, running:
11119
11120@example
11121herd invalidate nscd hosts
11122@end example
11123
11124@noindent
11125invalidates the host name lookup cache of nscd.
11126
11127@item statistics
11128Running @command{herd statistics nscd} displays information about nscd usage
11129and caches.
11130@end table
11131
1e40e70b
JL
11132@end deffn
11133
11134@defvr {Scheme Variable} %nscd-default-configuration
11135This is the default @code{<nscd-configuration>} value (see below) used by
11136@code{nscd-service}. It uses the caches defined by
11137@var{%nscd-default-caches}; see below.
11138@end defvr
11139
11140@deftp {Data Type} nscd-configuration
11141This is the data type representing the name service cache daemon (nscd)
11142configuration.
11143
11144@table @asis
11145
11146@item @code{name-services} (default: @code{'()})
11147List of packages denoting @dfn{name services} that must be visible to the
11148nscd---e.g., @code{(list @var{nss-mdns})}.
11149
11150@item @code{glibc} (default: @var{glibc})
11151Package object denoting the GNU C Library providing the @command{nscd}
11152command.
11153
11154@item @code{log-file} (default: @code{"/var/log/nscd.log"})
11155Name of the nscd log file. This is where debugging output goes when
11156@code{debug-level} is strictly positive.
11157
11158@item @code{debug-level} (default: @code{0})
11159Integer denoting the debugging levels. Higher numbers mean that more
11160debugging output is logged.
11161
11162@item @code{caches} (default: @var{%nscd-default-caches})
11163List of @code{<nscd-cache>} objects denoting things to be cached; see below.
11164
11165@end table
11166@end deftp
11167
11168@deftp {Data Type} nscd-cache
11169Data type representing a cache database of nscd and its parameters.
11170
11171@table @asis
11172
11173@item @code{database}
11174This is a symbol representing the name of the database to be cached. Valid
11175values are @code{passwd}, @code{group}, @code{hosts}, and @code{services},
11176which designate the corresponding NSS database (@pxref{NSS Basics,,, libc,
11177The GNU C Library Reference Manual}).
11178
11179@item @code{positive-time-to-live}
11180@itemx @code{negative-time-to-live} (default: @code{20})
11181A number representing the number of seconds during which a positive or
11182negative lookup result remains in cache.
11183
11184@item @code{check-files?} (default: @code{#t})
11185Whether to check for updates of the files corresponding to @var{database}.
11186
11187For instance, when @var{database} is @code{hosts}, setting this flag
11188instructs nscd to check for updates in @file{/etc/hosts} and to take them
11189into account.
11190
11191@item @code{persistent?} (default: @code{#t})
11192Whether the cache should be stored persistently on disk.
11193
11194@item @code{shared?} (default: @code{#t})
11195Whether the cache should be shared among users.
11196
11197@item @code{max-database-size} (default: 32@tie{}MiB)
11198Maximum size in bytes of the database cache.
11199
11200@c XXX: 'suggested-size' and 'auto-propagate?' seem to be expert
11201@c settings, so leave them out.
11202
11203@end table
11204@end deftp
11205
11206@defvr {Scheme Variable} %nscd-default-caches
11207List of @code{<nscd-cache>} objects used by default by
11208@code{nscd-configuration} (see above).
11209
11210It enables persistent and aggressive caching of service and host name
11211lookups. The latter provides better host name lookup performance,
11212resilience in the face of unreliable name servers, and also better
11213privacy---often the result of host name lookups is in local cache, so
11214external name servers do not even need to be queried.
11215@end defvr
11216
11217@anchor{syslog-configuration-type}
11218@cindex syslog
11219@cindex logging
11220@deftp {Data Type} syslog-configuration
11221This data type represents the configuration of the syslog daemon.
11222
11223@table @asis
11224@item @code{syslogd} (default: @code{#~(string-append #$inetutils "/libexec/syslogd")})
11225The syslog daemon to use.
11226
11227@item @code{config-file} (default: @code{%default-syslog.conf})
11228The syslog configuration file to use.
11229
11230@end table
11231@end deftp
11232
11233@anchor{syslog-service}
11234@cindex syslog
11235@deffn {Scheme Procedure} syslog-service @var{config}
11236Return a service that runs a syslog daemon according to @var{config}.
11237
11238@xref{syslogd invocation,,, inetutils, GNU Inetutils}, for more information
11239on the configuration file syntax.
11240@end deffn
11241
11242@defvr {Scheme Variable} guix-service-type
11243This is the type of the service that runs the build daemon,
11244@command{guix-daemon} (@pxref{Aufruf des guix-daemon}). Its value must be a
11245@code{guix-configuration} record as described below.
11246@end defvr
11247
11248@anchor{guix-configuration-type}
11249@deftp {Data Type} guix-configuration
11250This data type represents the configuration of the Guix build daemon.
11251@xref{Aufruf des guix-daemon}, for more information.
11252
11253@table @asis
11254@item @code{guix} (default: @var{guix})
11255The Guix package to use.
11256
11257@item @code{build-group} (default: @code{"guixbuild"})
11258Name of the group for build user accounts.
11259
11260@item @code{build-accounts} (default: @code{10})
11261Number of build user accounts to create.
11262
11263@item @code{authorize-key?} (default: @code{#t})
11264@cindex Substitute, deren Autorisierung
11265Whether to authorize the substitute keys listed in
11266@code{authorized-keys}---by default that of @code{hydra.gnu.org}
11267(@pxref{Substitute}).
11268
11269@vindex %default-authorized-guix-keys
11270@item @code{authorized-keys} (default: @var{%default-authorized-guix-keys})
11271The list of authorized key files for archive imports, as a list of
11272string-valued gexps (@pxref{Aufruf von guix archive}). By default, it
11273contains that of @code{hydra.gnu.org} (@pxref{Substitute}).
11274
11275@item @code{use-substitutes?} (default: @code{#t})
11276Whether to use substitutes.
11277
11278@item @code{substitute-urls} (default: @var{%default-substitute-urls})
11279The list of URLs where to look for substitutes by default.
11280
11281@item @code{max-silent-time} (default: @code{0})
11282@itemx @code{timeout} (default: @code{0})
11283The number of seconds of silence and the number of seconds of activity,
11284respectively, after which a build process times out. A value of zero
11285disables the timeout.
11286
11287@item @code{log-compression} (default: @code{'bzip2})
11288The type of compression used for build logs---one of @code{gzip},
11289@code{bzip2}, or @code{none}.
11290
11291@item @code{extra-options} (default: @code{'()})
11292List of extra command-line options for @command{guix-daemon}.
11293
11294@item @code{log-file} (default: @code{"/var/log/guix-daemon.log"})
11295File where @command{guix-daemon}'s standard output and standard error are
11296written.
11297
11298@item @code{http-proxy} (default: @code{#f})
11299The HTTP proxy used for downloading fixed-output derivations and
11300substitutes.
11301
11302@item @code{tmpdir} (default: @code{#f})
11303A directory path where the @command{guix-daemon} will perform builds.
11304
11305@end table
11306@end deftp
11307
11308@deffn {Scheme Procedure} udev-service [#:udev @var{eudev} #:rules @code{'()}]
11309Run @var{udev}, which populates the @file{/dev} directory dynamically. udev
11310rules can be provided as a list of files through the @var{rules} variable.
11311The procedures @var{udev-rule} and @var{file->udev-rule} from @code{(gnu
11312services base)} simplify the creation of such rule files.
11313
11314@deffn {Scheme Procedure} udev-rule [@var{file-name} @var{contents}]
11315Return a udev-rule file named @var{file-name} containing the rules defined
11316by the @var{contents} literal.
11317
11318In the following example, a rule for a USB device is defined to be stored in
11319the file @file{90-usb-thing.rules}. The rule runs a script upon detecting a
11320USB device with a given product identifier.
11321
11322@example
11323(define %example-udev-rule
11324 (udev-rule
11325 "90-usb-thing.rules"
11326 (string-append "ACTION==\"add\", SUBSYSTEM==\"usb\", "
11327 "ATTR@{product@}==\"Example\", "
11328 "RUN+=\"/path/to/script\"")))
11329@end example
11330@end deffn
11331
11332Here we show how the default @var{udev-service} can be extended with it.
11333
11334@example
11335(operating-system
11336 ;; @dots{}
11337 (services
11338 (modify-services %desktop-services
11339 (udev-service-type config =>
11340 (udev-configuration (inherit config)
11341 (rules (append (udev-configuration-rules config)
11342 (list %example-udev-rule))))))))
11343@end example
11344
11345@deffn {Scheme Procedure} file->udev-rule [@var{file-name} @var{file}]
11346Return a udev file named @var{file-name} containing the rules defined within
11347@var{file}, a file-like object.
11348
11349The following example showcases how we can use an existing rule file.
11350
11351@example
11352(use-modules (guix download) ;for url-fetch
11353 (guix packages) ;for origin
11354 ;; @dots{})
11355
11356(define %android-udev-rules
11357 (file->udev-rule
11358 "51-android-udev.rules"
11359 (let ((version "20170910"))
11360 (origin
11361 (method url-fetch)
11362 (uri (string-append "https://raw.githubusercontent.com/M0Rf30/"
11363 "android-udev-rules/" version "/51-android.rules"))
11364 (sha256
11365 (base32 "0lmmagpyb6xsq6zcr2w1cyx9qmjqmajkvrdbhjx32gqf1d9is003"))))))
11366@end example
11367@end deffn
11368
11369Additionally, Guix package definitions can be included in @var{rules} in
11370order to extend the udev rules with the definitions found under their
11371@file{lib/udev/rules.d} sub-directory. In lieu of the previous
11372@var{file->udev-rule} example, we could have used the
11373@var{android-udev-rules} package which exists in Guix in the @code{(gnu
11374packages android)} module.
11375
11376The following example shows how to use the @var{android-udev-rules} package
11377so that the Android tool @command{adb} can detect devices without root
11378privileges. It also details how to create the @code{adbusers} group, which
11379is required for the proper functioning of the rules defined within the
11380@var{android-udev-rules} package. To create such a group, we must define it
11381both as part of the @var{supplementary-groups} of our @var{user-account}
11382declaration, as well as in the @var{groups} field of the
11383@var{operating-system} record.
11384
11385@example
11386(use-modules (gnu packages android) ;for android-udev-rules
11387 (gnu system shadow) ;for user-group
11388 ;; @dots{})
11389
11390(operating-system
11391 ;; @dots{}
11392 (users (cons (user-acount
11393 ;; @dots{}
11394 (supplementary-groups
11395 '("adbusers" ;for adb
11396 "wheel" "netdev" "audio" "video"))
11397 ;; @dots{})))
11398
11399 (groups (cons (user-group (system? #t) (name "adbusers"))
11400 %base-groups))
11401
11402 ;; @dots{}
11403
11404 (services
11405 (modify-services %desktop-services
11406 (udev-service-type config =>
11407 (udev-configuration (inherit config)
11408 (rules (cons* android-udev-rules
11409 (udev-configuration-rules config))))))))
11410@end example
11411@end deffn
11412
11413@defvr {Scheme Variable} urandom-seed-service-type
11414Save some entropy in @var{%random-seed-file} to seed @file{/dev/urandom}
11415when rebooting. It also tries to seed @file{/dev/urandom} from
11416@file{/dev/hwrng} while booting, if @file{/dev/hwrng} exists and is
11417readable.
11418@end defvr
11419
11420@defvr {Scheme Variable} %random-seed-file
11421This is the name of the file where some random bytes are saved by
11422@var{urandom-seed-service} to seed @file{/dev/urandom} when rebooting. It
11423defaults to @file{/var/lib/random-seed}.
11424@end defvr
11425
11426@cindex keymap
11427@cindex keyboard
11428@deffn {Scheme Procedure} console-keymap-service @var{files} ...
11429@cindex keyboard layout
11430Return a service to load console keymaps from @var{files} using
11431@command{loadkeys} command. Most likely, you want to load some default
11432keymap, which can be done like this:
11433
11434@example
11435(console-keymap-service "dvorak")
11436@end example
11437
11438Or, for example, for a Swedish keyboard, you may need to combine the
11439following keymaps:
11440@example
11441(console-keymap-service "se-lat6" "se-fi-lat6")
11442@end example
11443
11444Also you can specify a full file name (or file names) of your keymap(s).
11445See @code{man loadkeys} for details.
11446
11447@end deffn
11448
11449@cindex mouse
11450@cindex gpm
11451@defvr {Scheme Variable} gpm-service-type
11452This is the type of the service that runs GPM, the @dfn{general-purpose
11453mouse daemon}, which provides mouse support to the Linux console. GPM
11454allows users to use the mouse in the console, notably to select, copy, and
11455paste text.
11456
11457The value for services of this type must be a @code{gpm-configuration} (see
11458below). This service is not part of @var{%base-services}.
11459@end defvr
11460
11461@deftp {Data Type} gpm-configuration
11462Data type representing the configuration of GPM.
11463
11464@table @asis
11465@item @code{options} (default: @code{%default-gpm-options})
11466Command-line options passed to @command{gpm}. The default set of options
11467instruct @command{gpm} to listen to mouse events on @file{/dev/input/mice}.
11468@xref{Command Line,,, gpm, gpm manual}, for more information.
11469
11470@item @code{gpm} (default: @code{gpm})
11471The GPM package to use.
11472
11473@end table
11474@end deftp
11475
11476@anchor{guix-publish-service-type}
11477@deffn {Scheme Variable} guix-publish-service-type
11478This is the service type for @command{guix publish} (@pxref{Aufruf von guix publish}). Its value must be a @code{guix-configuration} object, as
11479described below.
11480
11481This assumes that @file{/etc/guix} already contains a signing key pair as
11482created by @command{guix archive --generate-key} (@pxref{Aufruf von guix archive}). If that is not the case, the service will fail to start.
11483@end deffn
11484
11485@deftp {Data Type} guix-publish-configuration
11486Data type representing the configuration of the @code{guix publish} service.
11487
11488@table @asis
11489@item @code{guix} (default: @code{guix})
11490The Guix package to use.
11491
11492@item @code{port} (default: @code{80})
11493The TCP port to listen for connections.
11494
11495@item @code{host} (default: @code{"localhost"})
11496The host (and thus, network interface) to listen to. Use @code{"0.0.0.0"}
11497to listen on all the network interfaces.
11498
11499@item @code{compression-level} (Vorgabe: @code{3})
11500The gzip compression level at which substitutes are compressed. Use
11501@code{0} to disable compression altogether, and @code{9} to get the best
11502compression ratio at the expense of increased CPU usage.
11503
11504@item @code{nar-path} (default: @code{"nar"})
11505The URL path at which ``nars'' can be fetched. @xref{Aufruf von guix publish,
11506@code{--nar-path}}, for details.
11507
11508@item @code{cache} (default: @code{#f})
11509When it is @code{#f}, disable caching and instead generate archives on
11510demand. Otherwise, this should be the name of a directory---e.g.,
11511@code{"/var/cache/guix/publish"}---where @command{guix publish} caches
11512archives and meta-data ready to be sent. @xref{Aufruf von guix publish,
11513@option{--cache}}, for more information on the tradeoffs involved.
11514
11515@item @code{workers} (default: @code{#f})
11516When it is an integer, this is the number of worker threads used for
11517caching; when @code{#f}, the number of processors is used. @xref{Aufruf von guix publish, @option{--workers}}, for more information.
11518
11519@item @code{ttl} (default: @code{#f})
11520When it is an integer, this denotes the @dfn{time-to-live} in seconds of the
11521published archives. @xref{Aufruf von guix publish, @option{--ttl}}, for more
11522information.
11523@end table
11524@end deftp
11525
11526@anchor{rngd-service}
11527@deffn {Scheme Procedure} rngd-service [#:rng-tools @var{rng-tools}] @
11528 [#:device "/dev/hwrng"] Return a service that runs the @command{rngd}
11529program from @var{rng-tools} to add @var{device} to the kernel's entropy
11530pool. The service will fail if @var{device} does not exist.
11531@end deffn
11532
11533@anchor{pam-limits-service}
11534@cindex session limits
11535@cindex ulimit
11536@cindex priority
11537@cindex realtime
11538@cindex jackd
11539@deffn {Scheme Procedure} pam-limits-service [#:limits @code{'()}]
11540
11541Return a service that installs a configuration file for the
11542@uref{http://linux-pam.org/Linux-PAM-html/sag-pam_limits.html,
11543@code{pam_limits} module}. The procedure optionally takes a list of
11544@code{pam-limits-entry} values, which can be used to specify @code{ulimit}
11545limits and nice priority limits to user sessions.
11546
11547The following limits definition sets two hard and soft limits for all login
11548sessions of users in the @code{realtime} group:
11549
11550@example
11551(pam-limits-service
11552 (list
11553 (pam-limits-entry "@@realtime" 'both 'rtprio 99)
11554 (pam-limits-entry "@@realtime" 'both 'memlock 'unlimited)))
11555@end example
11556
11557The first entry increases the maximum realtime priority for non-privileged
11558processes; the second entry lifts any restriction of the maximum address
11559space that can be locked in memory. These settings are commonly used for
11560real-time audio systems.
11561@end deffn
11562
11563@node Geplante Auftragsausführung
11564@subsubsection Geplante Auftragsausführung
11565
11566@cindex cron
11567@cindex mcron
11568@cindex scheduling jobs
11569The @code{(gnu services mcron)} module provides an interface to
11570GNU@tie{}mcron, a daemon to run jobs at scheduled times (@pxref{Top,,,
11571mcron, GNU@tie{}mcron}). GNU@tie{}mcron is similar to the traditional Unix
11572@command{cron} daemon; the main difference is that it is implemented in
11573Guile Scheme, which provides a lot of flexibility when specifying the
11574scheduling of jobs and their actions.
11575
11576The example below defines an operating system that runs the
11577@command{updatedb} (@pxref{Invoking updatedb,,, find, Finding Files}) and
11578the @command{guix gc} commands (@pxref{Aufruf von guix gc}) daily, as well as
11579the @command{mkid} command on behalf of an unprivileged user (@pxref{mkid
11580invocation,,, idutils, ID Database Utilities}). It uses gexps to introduce
11581job definitions that are passed to mcron (@pxref{G-Ausdrücke}).
11582
11583@lisp
11584(use-modules (guix) (gnu) (gnu services mcron))
11585(use-package-modules base idutils)
11586
11587(define updatedb-job
11588 ;; Run 'updatedb' at 3AM every day. Here we write the
11589 ;; job's action as a Scheme procedure.
11590 #~(job '(next-hour '(3))
11591 (lambda ()
11592 (execl (string-append #$findutils "/bin/updatedb")
11593 "updatedb"
11594 "--prunepaths=/tmp /var/tmp /gnu/store"))))
11595
11596(define garbage-collector-job
11597 ;; Collect garbage 5 minutes after midnight every day.
11598 ;; The job's action is a shell command.
11599 #~(job "5 0 * * *" ;Vixie cron syntax
11600 "guix gc -F 1G"))
11601
11602(define idutils-job
11603 ;; Update the index database as user "charlie" at 12:15PM
11604 ;; and 19:15PM. This runs from the user's home directory.
11605 #~(job '(next-minute-from (next-hour '(12 19)) '(15))
11606 (string-append #$idutils "/bin/mkid src")
11607 #:user "charlie"))
11608
11609(operating-system
11610 ;; @dots{}
11611 (services (cons (mcron-service (list garbage-collector-job
11612 updatedb-job
11613 idutils-job))
11614 %base-services)))
11615@end lisp
11616
11617@xref{Guile Syntax, mcron job specifications,, mcron, GNU@tie{}mcron}, for
11618more information on mcron job specifications. Below is the reference of the
11619mcron service.
11620
11621On a running system, you can use the @code{schedule} action of the service
11622to visualize the mcron jobs that will be executed next:
11623
11624@example
11625# herd schedule mcron
11626@end example
11627
11628@noindent
11629The example above lists the next five tasks that will be executed, but you
11630can also specify the number of tasks to display:
11631
11632@example
11633# herd schedule mcron 10
11634@end example
11635
11636@deffn {Scheme Procedure} mcron-service @var{jobs} [#:mcron @var{mcron}]
11637Return an mcron service running @var{mcron} that schedules @var{jobs}, a
11638list of gexps denoting mcron job specifications.
11639
11640This is a shorthand for:
11641@example
11642(service mcron-service-type
11643 (mcron-configuration (mcron mcron) (jobs jobs)))
11644@end example
11645@end deffn
11646
11647@defvr {Scheme Variable} mcron-service-type
11648This is the type of the @code{mcron} service, whose value is an
11649@code{mcron-configuration} object.
11650
11651This service type can be the target of a service extension that provides it
11652additional job specifications (@pxref{Dienstkompositionen}). In other
11653words, it is possible to define services that provide additional mcron jobs
11654to run.
11655@end defvr
11656
11657@deftp {Data Type} mcron-configuration
11658Data type representing the configuration of mcron.
11659
11660@table @asis
11661@item @code{mcron} (default: @var{mcron})
11662The mcron package to use.
11663
11664@item @code{jobs}
11665This is a list of gexps (@pxref{G-Ausdrücke}), where each gexp corresponds
11666to an mcron job specification (@pxref{Syntax, mcron job specifications,,
11667mcron, GNU@tie{}mcron}).
11668@end table
11669@end deftp
11670
11671
11672@node Log-Rotation
11673@subsubsection Log-Rotation
11674
11675@cindex rottlog
11676@cindex log rotation
11677@cindex logging
11678Log files such as those found in @file{/var/log} tend to grow endlessly, so
11679it's a good idea to @dfn{rotate} them once in a while---i.e., archive their
11680contents in separate files, possibly compressed. The @code{(gnu services
11681admin)} module provides an interface to GNU@tie{}Rot[t]log, a log rotation
11682tool (@pxref{Top,,, rottlog, GNU Rot[t]log Manual}).
11683
11684The example below defines an operating system that provides log rotation
11685with the default settings, for commonly encountered log files.
11686
11687@lisp
11688(use-modules (guix) (gnu))
11689(use-service-modules admin mcron)
11690(use-package-modules base idutils)
11691
11692(operating-system
11693 ;; @dots{}
11694 (services (cons (service rottlog-service-type)
11695 %base-services)))
11696@end lisp
11697
11698@defvr {Scheme Variable} rottlog-service-type
11699This is the type of the Rottlog service, whose value is a
11700@code{rottlog-configuration} object.
11701
11702Other services can extend this one with new @code{log-rotation} objects (see
11703below), thereby augmenting the set of files to be rotated.
11704
11705This service type can define mcron jobs (@pxref{Geplante Auftragsausführung}) to
11706run the rottlog service.
11707@end defvr
11708
11709@deftp {Data Type} rottlog-configuration
11710Data type representing the configuration of rottlog.
11711
11712@table @asis
11713@item @code{rottlog} (default: @code{rottlog})
11714The Rottlog package to use.
11715
11716@item @code{rc-file} (default: @code{(file-append rottlog "/etc/rc")})
11717The Rottlog configuration file to use (@pxref{Mandatory RC Variables,,,
11718rottlog, GNU Rot[t]log Manual}).
11719
11720@item @code{rotations} (default: @code{%default-rotations})
11721A list of @code{log-rotation} objects as defined below.
11722
11723@item @code{jobs}
11724This is a list of gexps where each gexp corresponds to an mcron job
11725specification (@pxref{Geplante Auftragsausführung}).
11726@end table
11727@end deftp
11728
11729@deftp {Data Type} log-rotation
11730Data type representing the rotation of a group of log files.
11731
11732Taking an example from the Rottlog manual (@pxref{Period Related File
11733Examples,,, rottlog, GNU Rot[t]log Manual}), a log rotation might be defined
11734like this:
11735
11736@example
11737(log-rotation
11738 (frequency 'daily)
11739 (files '("/var/log/apache/*"))
11740 (options '("storedir apache-archives"
11741 "rotate 6"
11742 "notifempty"
11743 "nocompress")))
11744@end example
11745
11746The list of fields is as follows:
11747
11748@table @asis
11749@item @code{frequency} (default: @code{'weekly})
11750The log rotation frequency, a symbol.
11751
11752@item @code{files}
11753The list of files or file glob patterns to rotate.
11754
11755@item @code{options} (default: @code{'()})
11756The list of rottlog options for this rotation (@pxref{Configuration
11757parameters,,, rottlog, GNU Rot[t]lg Manual}).
11758
11759@item @code{post-rotate} (default: @code{#f})
11760Either @code{#f} or a gexp to execute once the rotation has completed.
11761@end table
11762@end deftp
11763
11764@defvr {Scheme Variable} %default-rotations
11765Specifies weekly rotation of @var{%rotated-files} and a couple of other
11766files.
11767@end defvr
11768
11769@defvr {Scheme Variable} %rotated-files
11770The list of syslog-controlled files to be rotated. By default it is:
11771@code{'("/var/log/messages" "/var/log/secure")}.
11772@end defvr
11773
11774@node Netzwerkdienste
11775@subsubsection Netzwerkdienste
11776
11777The @code{(gnu services networking)} module provides services to configure
11778the network interface.
11779
11780@cindex DHCP, networking service
11781@defvr {Scheme Variable} dhcp-client-service-type
11782This is the type of services that run @var{dhcp}, a Dynamic Host
11783Configuration Protocol (DHCP) client, on all the non-loopback network
11784interfaces. Its value is the DHCP client package to use, @code{isc-dhcp} by
11785default.
11786@end defvr
11787
11788@deffn {Scheme Procedure} dhcpd-service-type
11789This type defines a service that runs a DHCP daemon. To create a service of
11790this type, you must supply a @code{<dhcpd-configuration>}. For example:
11791
11792@example
11793(service dhcpd-service-type
11794 (dhcpd-configuration
11795 (config-file (local-file "my-dhcpd.conf"))
11796 (interfaces '("enp0s25"))))
11797@end example
11798@end deffn
11799
11800@deftp {Data Type} dhcpd-configuration
11801@table @asis
11802@item @code{package} (default: @code{isc-dhcp})
11803The package that provides the DHCP daemon. This package is expected to
11804provide the daemon at @file{sbin/dhcpd} relative to its output directory.
11805The default package is the @uref{http://www.isc.org/products/DHCP, ISC's
11806DHCP server}.
11807@item @code{config-file} (default: @code{#f})
11808The configuration file to use. This is required. It will be passed to
11809@code{dhcpd} via its @code{-cf} option. This may be any ``file-like''
11810object (@pxref{G-Ausdrücke, file-like objects}). See @code{man
11811dhcpd.conf} for details on the configuration file syntax.
11812@item @code{version} (default: @code{"4"})
11813The DHCP version to use. The ISC DHCP server supports the values ``4'',
11814``6'', and ``4o6''. These correspond to the @code{dhcpd} program options
11815@code{-4}, @code{-6}, and @code{-4o6}. See @code{man dhcpd} for details.
11816@item @code{run-directory} (default: @code{"/run/dhcpd"})
11817The run directory to use. At service activation time, this directory will
11818be created if it does not exist.
11819@item @code{pid-file} (default: @code{"/run/dhcpd/dhcpd.pid"})
11820The PID file to use. This corresponds to the @code{-pf} option of
11821@code{dhcpd}. See @code{man dhcpd} for details.
11822@item @code{interfaces} (default: @code{'()})
11823The names of the network interfaces on which dhcpd should listen for
11824broadcasts. If this list is not empty, then its elements (which must be
11825strings) will be appended to the @code{dhcpd} invocation when starting the
11826daemon. It may not be necessary to explicitly specify any interfaces here;
11827see @code{man dhcpd} for details.
11828@end table
11829@end deftp
11830
11831@defvr {Scheme Variable} static-networking-service-type
11832@c TODO Document <static-networking> data structures.
11833This is the type for statically-configured network interfaces.
11834@end defvr
11835
11836@deffn {Scheme Procedure} static-networking-service @var{interface} @var{ip} @
11837 [#:netmask #f] [#:gateway #f] [#:name-servers @code{'()}] @ [#:requirement
11838@code{'(udev)}] Return a service that starts @var{interface} with address
11839@var{ip}. If @var{netmask} is true, use it as the network mask. If
11840@var{gateway} is true, it must be a string specifying the default network
11841gateway. @var{requirement} can be used to declare a dependency on another
11842service before configuring the interface.
11843
11844This procedure can be called several times, one for each network interface
11845of interest. Behind the scenes what it does is extend
11846@code{static-networking-service-type} with additional network interfaces to
11847handle.
11848
11849For example:
11850
11851@example
11852(static-networking-service "eno1" "192.168.1.82"
11853 #:gateway "192.168.1.2"
11854 #:name-servers '("192.168.1.2"))
11855@end example
11856@end deffn
11857
11858@cindex wicd
11859@cindex wireless
11860@cindex WiFi
11861@cindex network management
11862@deffn {Scheme Procedure} wicd-service [#:wicd @var{wicd}]
11863Return a service that runs @url{https://launchpad.net/wicd,Wicd}, a network
11864management daemon that aims to simplify wired and wireless networking.
11865
11866This service adds the @var{wicd} package to the global profile, providing
11867several commands to interact with the daemon and configure networking:
11868@command{wicd-client}, a graphical user interface, and the
11869@command{wicd-cli} and @command{wicd-curses} user interfaces.
11870@end deffn
11871
11872@cindex ModemManager
11873
11874@defvr {Scheme Variable} modem-manager-service-type
11875This is the service type for the
11876@uref{https://wiki.gnome.org/Projects/ModemManager, ModemManager}
11877service. The value for this service type is a
11878@code{modem-manager-configuration} record.
11879
11880This service is part of @code{%desktop-services} (@pxref{Desktop-Dienste}).
11881@end defvr
11882
11883@deftp {Data Type} modem-manager-configuration
11884Data type representing the configuration of ModemManager.
11885
11886@table @asis
11887@item @code{modem-manager} (default: @code{modem-manager})
11888The ModemManager package to use.
11889
11890@end table
11891@end deftp
11892
11893@cindex NetworkManager
11894
11895@defvr {Scheme Variable} network-manager-service-type
11896This is the service type for the
11897@uref{https://wiki.gnome.org/Projects/NetworkManager, NetworkManager}
11898service. The value for this service type is a
11899@code{network-manager-configuration} record.
11900
11901This service is part of @code{%desktop-services} (@pxref{Desktop-Dienste}).
11902@end defvr
11903
11904@deftp {Data Type} network-manager-configuration
11905Data type representing the configuration of NetworkManager.
11906
11907@table @asis
11908@item @code{network-manager} (default: @code{network-manager})
11909The NetworkManager package to use.
11910
11911@item @code{dns} (default: @code{"default"})
11912Processing mode for DNS, which affects how NetworkManager uses the
11913@code{resolv.conf} configuration file.
11914
11915@table @samp
11916@item default
11917NetworkManager will update @code{resolv.conf} to reflect the nameservers
11918provided by currently active connections.
11919
11920@item dnsmasq
11921NetworkManager will run @code{dnsmasq} as a local caching nameserver, using
11922a "split DNS" configuration if you are connected to a VPN, and then update
11923@code{resolv.conf} to point to the local nameserver.
11924
11925@item none
11926NetworkManager will not modify @code{resolv.conf}.
11927@end table
11928
11929@item @code{vpn-plugins} (default: @code{'()})
11930This is the list of available plugins for virtual private networks (VPNs).
11931An example of this is the @code{network-manager-openvpn} package, which
11932allows NetworkManager to manage VPNs @i{via} OpenVPN.
11933
11934@end table
11935@end deftp
11936
11937@cindex Connman
11938@deffn {Scheme Variable} connman-service-type
11939This is the service type to run @url{https://01.org/connman,Connman}, a
11940network connection manager.
11941
11942Its value must be an @code{connman-configuration} record as in this example:
11943
11944@example
11945(service connman-service-type
11946 (connman-configuration
11947 (disable-vpn? #t)))
11948@end example
11949
11950See below for details about @code{connman-configuration}.
11951@end deffn
11952
11953@deftp {Data Type} connman-configuration
11954Data Type representing the configuration of connman.
11955
11956@table @asis
11957@item @code{connman} (default: @var{connman})
11958The connman package to use.
11959
11960@item @code{disable-vpn?} (default: @code{#f})
793dcd8c 11961When true, disable connman's vpn plugin.
1e40e70b
JL
11962@end table
11963@end deftp
11964
11965@cindex WPA Supplicant
11966@defvr {Scheme Variable} wpa-supplicant-service-type
11967This is the service type to run @url{https://w1.fi/wpa_supplicant/,WPA
11968supplicant}, an authentication daemon required to authenticate against
11969encrypted WiFi or ethernet networks.
11970@end defvr
11971
11972@deftp {Data Type} wpa-supplicant-configuration
11973Data type representing the configuration of WPA Supplicant.
11974
11975It takes the following parameters:
11976
11977@table @asis
11978@item @code{wpa-supplicant} (default: @code{wpa-supplicant})
11979The WPA Supplicant package to use.
11980
11981@item @code{dbus?} (default: @code{#t})
11982Whether to listen for requests on D-Bus.
11983
11984@item @code{pid-file} (default: @code{"/var/run/wpa_supplicant.pid"})
11985Where to store the PID file.
11986
11987@item @code{interface} (default: @code{#f})
11988If this is set, it must specify the name of a network interface that WPA
11989supplicant will control.
11990
11991@item @code{config-file} (default: @code{#f})
11992Optional configuration file to use.
11993
11994@item @code{extra-options} (default: @code{'()})
11995List of additional command-line arguments to pass to the daemon.
11996@end table
11997@end deftp
11998
11999@cindex iptables
12000@defvr {Scheme Variable} iptables-service-type
793dcd8c 12001This is the service type to set up an iptables configuration. iptables is a
1e40e70b
JL
12002packet filtering framework supported by the Linux kernel. This service
12003supports configuring iptables for both IPv4 and IPv6. A simple example
12004configuration rejecting all incoming connections except those to the ssh
12005port 22 is shown below.
12006
12007@lisp
12008(service iptables-service-type
12009 (iptables-configuration
12010 (ipv4-rules (plain-file "iptables.rules" "*filter
12011:INPUT ACCEPT
12012:FORWARD ACCEPT
12013:OUTPUT ACCEPT
12014-A INPUT -p tcp --dport 22 -j ACCEPT
12015-A INPUT -j REJECT --reject-with icmp-port-unreachable
12016COMMIT
12017"))
12018 (ipv6-rules (plain-file "ip6tables.rules" "*filter
12019:INPUT ACCEPT
12020:FORWARD ACCEPT
12021:OUTPUT ACCEPT
12022-A INPUT -p tcp --dport 22 -j ACCEPT
12023-A INPUT -j REJECT --reject-with icmp6-port-unreachable
12024COMMIT
12025"))))
12026@end lisp
12027@end defvr
12028
12029@deftp {Data Type} iptables-configuration
12030The data type representing the configuration of iptables.
12031
12032@table @asis
12033@item @code{iptables} (default: @code{iptables})
12034The iptables package that provides @code{iptables-restore} and
12035@code{ip6tables-restore}.
12036@item @code{ipv4-rules} (default: @code{%iptables-accept-all-rules})
12037The iptables rules to use. It will be passed to @code{iptables-restore}.
12038This may be any ``file-like'' object (@pxref{G-Ausdrücke, file-like
12039objects}).
12040@item @code{ipv6-rules} (default: @code{%iptables-accept-all-rules})
12041The ip6tables rules to use. It will be passed to @code{ip6tables-restore}.
12042This may be any ``file-like'' object (@pxref{G-Ausdrücke, file-like
12043objects}).
12044@end table
12045@end deftp
12046
12047@cindex NTP (Network Time Protocol), service
12048@cindex real time clock
12049@defvr {Scheme Variable} ntp-service-type
793dcd8c 12050This is the type of the service running the @uref{http://www.ntp.org,
1e40e70b
JL
12051Network Time Protocol (NTP)} daemon, @command{ntpd}. The daemon will keep
12052the system clock synchronized with that of the specified NTP servers.
12053
12054The value of this service is an @code{ntpd-configuration} object, as
12055described below.
12056@end defvr
12057
12058@deftp {Data Type} ntp-configuration
12059This is the data type for the NTP service configuration.
12060
12061@table @asis
12062@item @code{servers} (default: @code{%ntp-servers})
12063This is the list of servers (host names) with which @command{ntpd} will be
12064synchronized.
12065
12066@item @code{allow-large-adjustment?} (default: @code{#f})
12067This determines whether @command{ntpd} is allowed to make an initial
12068adjustment of more than 1,000 seconds.
12069
12070@item @code{ntp} (default: @code{ntp})
12071The NTP package to use.
12072@end table
12073@end deftp
12074
12075@defvr {Scheme Variable} %ntp-servers
12076List of host names used as the default NTP servers. These are servers of
12077the @uref{https://www.ntppool.org/en/, NTP Pool Project}.
12078@end defvr
12079
12080@cindex OpenNTPD
12081@deffn {Scheme Procedure} openntpd-service-type
12082Run the @command{ntpd}, the Network Time Protocol (NTP) daemon, as
12083implemented by @uref{http://www.openntpd.org, OpenNTPD}. The daemon will
12084keep the system clock synchronized with that of the given servers.
12085
12086@example
12087(service
12088 openntpd-service-type
12089 (openntpd-configuration
12090 (listen-on '("127.0.0.1" "::1"))
12091 (sensor '("udcf0 correction 70000"))
12092 (constraint-from '("www.gnu.org"))
12093 (constraints-from '("https://www.google.com/"))
12094 (allow-large-adjustment? #t)))
12095
12096@end example
12097@end deffn
12098
12099@deftp {Data Type} openntpd-configuration
12100@table @asis
12101@item @code{openntpd} (default: @code{(file-append openntpd "/sbin/ntpd")})
12102The openntpd executable to use.
12103@item @code{listen-on} (default: @code{'("127.0.0.1" "::1")})
12104A list of local IP addresses or hostnames the ntpd daemon should listen on.
12105@item @code{query-from} (default: @code{'()})
12106A list of local IP address the ntpd daemon should use for outgoing queries.
12107@item @code{sensor} (default: @code{'()})
12108Specify a list of timedelta sensor devices ntpd should use. @code{ntpd}
12109will listen to each sensor that acutally exists and ignore non-existant
12110ones. See @uref{https://man.openbsd.org/ntpd.conf, upstream documentation}
12111for more information.
12112@item @code{server} (default: @var{%ntp-servers})
12113Specify a list of IP addresses or hostnames of NTP servers to synchronize
12114to.
12115@item @code{servers} (default: @code{'()})
12116Specify a list of IP addresses or hostnames of NTP pools to synchronize to.
12117@item @code{constraint-from} (default: @code{'()})
12118@code{ntpd} can be configured to query the ‘Date’ from trusted HTTPS servers
12119via TLS. This time information is not used for precision but acts as an
12120authenticated constraint, thereby reducing the impact of unauthenticated NTP
12121man-in-the-middle attacks. Specify a list of URLs, IP addresses or
12122hostnames of HTTPS servers to provide a constraint.
12123@item @code{constraints-from} (default: @code{'()})
12124As with constraint from, specify a list of URLs, IP addresses or hostnames
12125of HTTPS servers to provide a constraint. Should the hostname resolve to
12126multiple IP addresses, @code{ntpd} will calculate a median constraint from
12127all of them.
12128@item @code{allow-large-adjustment?} (default: @code{#f})
12129Determines if @code{ntpd} is allowed to make an initial adjustment of more
12130than 180 seconds.
12131@end table
12132@end deftp
12133
12134@cindex inetd
12135@deffn {Scheme variable} inetd-service-type
12136This service runs the @command{inetd} (@pxref{inetd invocation,,, inetutils,
12137GNU Inetutils}) daemon. @command{inetd} listens for connections on internet
12138sockets, and lazily starts the specified server program when a connection is
12139made on one of these sockets.
12140
12141The value of this service is an @code{inetd-configuration} object. The
12142following example configures the @command{inetd} daemon to provide the
12143built-in @command{echo} service, as well as an smtp service which forwards
12144smtp traffic over ssh to a server @code{smtp-server} behind a gateway
12145@code{hostname}:
12146
12147@example
12148(service
12149 inetd-service-type
12150 (inetd-configuration
12151 (entries (list
12152 (inetd-entry
12153 (name "echo")
12154 (socket-type 'stream)
12155 (protocol "tcp")
12156 (wait? #f)
12157 (user "root"))
12158 (inetd-entry
12159 (node "127.0.0.1")
12160 (name "smtp")
12161 (socket-type 'stream)
12162 (protocol "tcp")
12163 (wait? #f)
12164 (user "root")
12165 (program (file-append openssh "/bin/ssh"))
12166 (arguments
12167 '("ssh" "-qT" "-i" "/path/to/ssh_key"
12168 "-W" "smtp-server:25" "user@@hostname")))))
12169@end example
12170
12171See below for more details about @code{inetd-configuration}.
12172@end deffn
12173
12174@deftp {Data Type} inetd-configuration
12175Data type representing the configuration of @command{inetd}.
12176
12177@table @asis
12178@item @code{program} (default: @code{(file-append inetutils "/libexec/inetd")})
12179The @command{inetd} executable to use.
12180
12181@item @code{entries} (default: @code{'()})
12182A list of @command{inetd} service entries. Each entry should be created by
12183the @code{inetd-entry} constructor.
12184@end table
12185@end deftp
12186
12187@deftp {Data Type} inetd-entry
12188Data type representing an entry in the @command{inetd} configuration. Each
12189entry corresponds to a socket where @command{inetd} will listen for
12190requests.
12191
12192@table @asis
12193@item @code{node} (Vorgabe: @code{#f})
12194Optional string, a comma-separated list of local addresses @command{inetd}
12195should use when listening for this service. @xref{Configuration file,,,
12196inetutils, GNU Inetutils} for a complete description of all options.
12197@item @code{name}
12198A string, the name must correspond to an entry in @code{/etc/services}.
12199@item @code{socket-type}
12200One of @code{'stream}, @code{'dgram}, @code{'raw}, @code{'rdm} or
12201@code{'seqpacket}.
12202@item @code{protocol}
12203A string, must correspond to an entry in @code{/etc/protocols}.
12204@item @code{wait?} (Vorgabe: @code{#t})
12205Whether @command{inetd} should wait for the server to exit before listening
12206to new service requests.
12207@item @code{user}
12208A string containing the user (and, optionally, group) name of the user as
12209whom the server should run. The group name can be specified in a suffix,
793dcd8c 12210separated by a colon or period, i.e.@: @code{"user"}, @code{"user:group"} or
1e40e70b
JL
12211@code{"user.group"}.
12212@item @code{program} (default: @code{"internal"})
12213The server program which will serve the requests, or @code{"internal"} if
12214@command{inetd} should use a built-in service.
12215@item @code{arguments} (default: @code{'()})
12216A list strings or file-like objects, which are the server program's
793dcd8c 12217arguments, starting with the zeroth argument, i.e.@: the name of the program
1e40e70b
JL
12218itself. For @command{inetd}'s internal services, this entry must be
12219@code{'()} or @code{'("internal")}.
12220@end table
12221
12222@xref{Configuration file,,, inetutils, GNU Inetutils} for a more detailed
12223discussion of each configuration field.
12224@end deftp
12225
12226@cindex Tor
12227@defvr {Scheme Variable} tor-service-type
12228This is the type for a service that runs the @uref{https://torproject.org,
12229Tor} anonymous networking daemon. The service is configured using a
12230@code{<tor-configuration>} record. By default, the Tor daemon runs as the
12231@code{tor} unprivileged user, which is a member of the @code{tor} group.
12232
12233@end defvr
12234
12235@deffn {Scheme Procedure} tor-service [@var{config-file}] [#:tor @var{tor}]
12236This procedure is deprecated and will be removed in a future release.
12237Return a service of the @code{tor-service-type} type. @var{config-file} and
12238@var{tor} have the same meaning as in @code{<tor-configuration>}.
12239@end deffn
12240
12241@deftp {Data Type} tor-configuration
12242@table @asis
12243@item @code{tor} (default: @code{tor})
12244The package that provides the Tor daemon. This package is expected to
12245provide the daemon at @file{bin/tor} relative to its output directory. The
12246default package is the @uref{https://www.torproject.org, Tor Project's}
12247implementation.
12248
12249@item @code{config-file} (default: @code{(plain-file "empty" "")})
12250The configuration file to use. It will be appended to a default
12251configuration file, and the final configuration file will be passed to
12252@code{tor} via its @code{-f} option. This may be any ``file-like'' object
12253(@pxref{G-Ausdrücke, file-like objects}). See @code{man tor} for details
12254on the configuration file syntax.
12255
12256@item @code{hidden-services} (default: @code{'()})
12257The list of @code{<hidden-service>} records to use. For any hidden service
12258you include in this list, appropriate configuration to enable the hidden
12259service will be automatically added to the default configuration file. You
12260may conveniently create @code{<hidden-service>} records using the
12261@code{tor-hidden-service} procedure described below.
12262
12263@item @code{socks-socket-type} (default: @code{'tcp})
12264The default socket type that Tor should use for its SOCKS socket. This must
12265be either @code{'tcp} or @code{'unix}. If it is @code{'tcp}, then by
12266default Tor will listen on TCP port 9050 on the loopback interface (i.e.,
12267localhost). If it is @code{'unix}, then Tor will listen on the UNIX domain
12268socket @file{/var/run/tor/socks-sock}, which will be made writable by
12269members of the @code{tor} group.
12270
12271If you want to customize the SOCKS socket in more detail, leave
12272@code{socks-socket-type} at its default value of @code{'tcp} and use
12273@code{config-file} to override the default by providing your own
12274@code{SocksPort} option.
12275@end table
12276@end deftp
12277
12278@cindex hidden service
12279@deffn {Scheme Procedure} tor-hidden-service @var{name} @var{mapping}
12280Define a new Tor @dfn{hidden service} called @var{name} and implementing
12281@var{mapping}. @var{mapping} is a list of port/host tuples, such as:
12282
12283@example
12284 '((22 "127.0.0.1:22")
12285 (80 "127.0.0.1:8080"))
12286@end example
12287
12288In this example, port 22 of the hidden service is mapped to local port 22,
12289and port 80 is mapped to local port 8080.
12290
12291This creates a @file{/var/lib/tor/hidden-services/@var{name}} directory,
12292where the @file{hostname} file contains the @code{.onion} host name for the
12293hidden service.
12294
12295See @uref{https://www.torproject.org/docs/tor-hidden-service.html.en, the
12296Tor project's documentation} for more information.
12297@end deffn
12298
12299The @code{(gnu services rsync)} module provides the following services:
12300
12301You might want an rsync daemon if you have files that you want available so
12302anyone (or just yourself) can download existing files or upload new files.
12303
12304@deffn {Scheme Variable} rsync-service-type
12305This is the type for the @uref{https://rsync.samba.org, rsync} rsync daemon,
12306@command{rsync-configuration} record as in this example:
12307
12308@example
12309(service rsync-service-type)
12310@end example
12311
12312See below for details about @code{rsync-configuration}.
12313@end deffn
12314
12315@deftp {Data Type} rsync-configuration
12316Data type representing the configuration for @code{rsync-service}.
12317
12318@table @asis
12319@item @code{package} (default: @var{rsync})
12320@code{rsync} package to use.
12321
12322@item @code{port-number} (default: @code{873})
12323TCP port on which @command{rsync} listens for incoming connections. If port
12324is less than @code{1024} @command{rsync} needs to be started as the
12325@code{root} user and group.
12326
12327@item @code{pid-file} (default: @code{"/var/run/rsyncd/rsyncd.pid"})
12328Name of the file where @command{rsync} writes its PID.
12329
12330@item @code{lock-file} (default: @code{"/var/run/rsyncd/rsyncd.lock"})
12331Name of the file where @command{rsync} writes its lock file.
12332
12333@item @code{log-file} (default: @code{"/var/log/rsyncd.log"})
12334Name of the file where @command{rsync} writes its log file.
12335
12336@item @code{use-chroot?} (default: @var{#t})
12337Whether to use chroot for @command{rsync} shared directory.
12338
12339@item @code{share-path} (default: @file{/srv/rsync})
12340Location of the @command{rsync} shared directory.
12341
12342@item @code{share-comment} (default: @code{"Rsync share"})
12343Comment of the @command{rsync} shared directory.
12344
12345@item @code{read-only?} (default: @var{#f})
12346Read-write permissions to shared directory.
12347
12348@item @code{timeout} (default: @code{300})
12349I/O timeout in seconds.
12350
12351@item @code{user} (default: @var{"root"})
12352Owner of the @code{rsync} process.
12353
12354@item @code{group} (default: @var{"root"})
12355Group of the @code{rsync} process.
12356
12357@item @code{uid} (default: @var{"rsyncd"})
12358User name or user ID that file transfers to and from that module should take
12359place as when the daemon was run as @code{root}.
12360
12361@item @code{gid} (default: @var{"rsyncd"})
12362Group name or group ID that will be used when accessing the module.
12363
12364@end table
12365@end deftp
12366
12367Furthermore, @code{(gnu services ssh)} provides the following services.
12368@cindex SSH
12369@cindex SSH server
12370
12371@deffn {Scheme Procedure} lsh-service [#:host-key "/etc/lsh/host-key"] @
12372 [#:daemonic? #t] [#:interfaces '()] [#:port-number 22] @
12373[#:allow-empty-passwords? #f] [#:root-login? #f] @ [#:syslog-output? #t]
12374[#:x11-forwarding? #t] @ [#:tcp/ip-forwarding? #t]
12375[#:password-authentication? #t] @ [#:public-key-authentication? #t]
12376[#:initialize? #t] Run the @command{lshd} program from @var{lsh} to listen
12377on port @var{port-number}. @var{host-key} must designate a file containing
12378the host key, and readable only by root.
12379
12380When @var{daemonic?} is true, @command{lshd} will detach from the
12381controlling terminal and log its output to syslogd, unless one sets
12382@var{syslog-output?} to false. Obviously, it also makes lsh-service depend
12383on existence of syslogd service. When @var{pid-file?} is true,
12384@command{lshd} writes its PID to the file called @var{pid-file}.
12385
12386When @var{initialize?} is true, automatically create the seed and host key
12387upon service activation if they do not exist yet. This may take long and
12388require interaction.
12389
12390When @var{initialize?} is false, it is up to the user to initialize the
12391randomness generator (@pxref{lsh-make-seed,,, lsh, LSH Manual}), and to
12392create a key pair with the private key stored in file @var{host-key}
12393(@pxref{lshd basics,,, lsh, LSH Manual}).
12394
12395When @var{interfaces} is empty, lshd listens for connections on all the
12396network interfaces; otherwise, @var{interfaces} must be a list of host names
12397or addresses.
12398
12399@var{allow-empty-passwords?} specifies whether to accept log-ins with empty
12400passwords, and @var{root-login?} specifies whether to accept log-ins as
12401root.
12402
12403The other options should be self-descriptive.
12404@end deffn
12405
12406@cindex SSH
12407@cindex SSH server
12408@deffn {Scheme Variable} openssh-service-type
12409This is the type for the @uref{http://www.openssh.org, OpenSSH} secure shell
12410daemon, @command{sshd}. Its value must be an @code{openssh-configuration}
12411record as in this example:
12412
12413@example
12414(service openssh-service-type
12415 (openssh-configuration
12416 (x11-forwarding? #t)
12417 (permit-root-login 'without-password)
12418 (authorized-keys
12419 `(("alice" ,(local-file "alice.pub"))
12420 ("bob" ,(local-file "bob.pub"))))))
12421@end example
12422
12423See below for details about @code{openssh-configuration}.
12424
12425This service can be extended with extra authorized keys, as in this example:
12426
12427@example
12428(service-extension openssh-service-type
12429 (const `(("charlie"
12430 ,(local-file "charlie.pub")))))
12431@end example
12432@end deffn
12433
12434@deftp {Data Type} openssh-configuration
12435This is the configuration record for OpenSSH's @command{sshd}.
12436
12437@table @asis
12438@item @code{pid-file} (default: @code{"/var/run/sshd.pid"})
12439Name of the file where @command{sshd} writes its PID.
12440
12441@item @code{port-number} (default: @code{22})
12442TCP port on which @command{sshd} listens for incoming connections.
12443
12444@item @code{permit-root-login} (default: @code{#f})
12445This field determines whether and when to allow logins as root. If
12446@code{#f}, root logins are disallowed; if @code{#t}, they are allowed. If
12447it's the symbol @code{'without-password}, then root logins are permitted but
12448not with password-based authentication.
12449
12450@item @code{allow-empty-passwords?} (default: @code{#f})
12451When true, users with empty passwords may log in. When false, they may not.
12452
12453@item @code{password-authentication?} (default: @code{#t})
12454When true, users may log in with their password. When false, they have
12455other authentication methods.
12456
12457@item @code{public-key-authentication?} (default: @code{#t})
12458When true, users may log in using public key authentication. When false,
12459users have to use other authentication method.
12460
12461Authorized public keys are stored in @file{~/.ssh/authorized_keys}. This is
12462used only by protocol version 2.
12463
12464@item @code{x11-forwarding?} (default: @code{#f})
12465When true, forwarding of X11 graphical client connections is enabled---in
12466other words, @command{ssh} options @option{-X} and @option{-Y} will work.
12467
12468@item @code{allow-agent-forwarding?} (default: @code{#t})
12469Whether to allow agent forwarding.
12470
12471@item @code{allow-tcp-forwarding?} (default: @code{#t})
12472Whether to allow TCP forwarding.
12473
12474@item @code{gateway-ports?} (default: @code{#f})
12475Whether to allow gateway ports.
12476
12477@item @code{challenge-response-authentication?} (default: @code{#f})
793dcd8c 12478Specifies whether challenge response authentication is allowed (e.g.@: via
1e40e70b
JL
12479PAM).
12480
12481@item @code{use-pam?} (default: @code{#t})
12482Enables the Pluggable Authentication Module interface. If set to @code{#t},
12483this will enable PAM authentication using
12484@code{challenge-response-authentication?} and
12485@code{password-authentication?}, in addition to PAM account and session
12486module processing for all authentication types.
12487
12488Because PAM challenge response authentication usually serves an equivalent
12489role to password authentication, you should disable either
12490@code{challenge-response-authentication?} or
12491@code{password-authentication?}.
12492
12493@item @code{print-last-log?} (default: @code{#t})
12494Specifies whether @command{sshd} should print the date and time of the last
12495user login when a user logs in interactively.
12496
12497@item @code{subsystems} (default: @code{'(("sftp" "internal-sftp"))})
793dcd8c 12498Configures external subsystems (e.g.@: file transfer daemon).
1e40e70b
JL
12499
12500This is a list of two-element lists, each of which containing the subsystem
12501name and a command (with optional arguments) to execute upon subsystem
12502request.
12503
12504The command @command{internal-sftp} implements an in-process SFTP server.
12505Alternately, one can specify the @command{sftp-server} command:
12506@example
12507(service openssh-service-type
12508 (openssh-configuration
12509 (subsystems
12510 `(("sftp" ,(file-append openssh "/libexec/sftp-server"))))))
12511@end example
12512
12513@item @code{accepted-environment} (default: @code{'()})
12514List of strings describing which environment variables may be exported.
12515
12516Each string gets on its own line. See the @code{AcceptEnv} option in
12517@code{man sshd_config}.
12518
12519This example allows ssh-clients to export the @code{COLORTERM} variable. It
12520is set by terminal emulators, which support colors. You can use it in your
12521shell's ressource file to enable colors for the prompt and commands if this
12522variable is set.
12523
12524@example
12525(service openssh-service-type
12526 (openssh-configuration
12527 (accepted-environment '("COLORTERM"))))
12528@end example
12529
12530@item @code{authorized-keys} (default: @code{'()})
12531@cindex authorized keys, SSH
12532@cindex SSH authorized keys
12533This is the list of authorized keys. Each element of the list is a user
12534name followed by one or more file-like objects that represent SSH public
12535keys. For example:
12536
12537@example
12538(openssh-configuration
12539 (authorized-keys
12540 `(("rekado" ,(local-file "rekado.pub"))
12541 ("chris" ,(local-file "chris.pub"))
12542 ("root" ,(local-file "rekado.pub") ,(local-file "chris.pub")))))
12543@end example
12544
12545@noindent
12546registers the specified public keys for user accounts @code{rekado},
12547@code{chris}, and @code{root}.
12548
12549Additional authorized keys can be specified @i{via}
12550@code{service-extension}.
12551
12552Note that this does @emph{not} interfere with the use of
12553@file{~/.ssh/authorized_keys}.
12554
12555@item @code{log-level} (default: @code{'info})
12556This is a symbol specifying the logging level: @code{quiet}, @code{fatal},
12557@code{error}, @code{info}, @code{verbose}, @code{debug}, etc. See the man
12558page for @file{sshd_config} for the full list of level names.
12559
12560@end table
12561@end deftp
12562
12563@deffn {Scheme Procedure} dropbear-service [@var{config}]
12564Run the @uref{https://matt.ucc.asn.au/dropbear/dropbear.html,Dropbear SSH
12565daemon} with the given @var{config}, a @code{<dropbear-configuration>}
12566object.
12567
12568For example, to specify a Dropbear service listening on port 1234, add this
12569call to the operating system's @code{services} field:
12570
12571@example
12572(dropbear-service (dropbear-configuration
12573 (port-number 1234)))
12574@end example
12575@end deffn
12576
12577@deftp {Data Type} dropbear-configuration
12578This data type represents the configuration of a Dropbear SSH daemon.
12579
12580@table @asis
12581@item @code{dropbear} (default: @var{dropbear})
12582The Dropbear package to use.
12583
12584@item @code{port-number} (default: 22)
12585The TCP port where the daemon waits for incoming connections.
12586
12587@item @code{syslog-output?} (default: @code{#t})
12588Whether to enable syslog output.
12589
12590@item @code{pid-file} (default: @code{"/var/run/dropbear.pid"})
12591File name of the daemon's PID file.
12592
12593@item @code{root-login?} (default: @code{#f})
12594Whether to allow @code{root} logins.
12595
12596@item @code{allow-empty-passwords?} (default: @code{#f})
12597Whether to allow empty passwords.
12598
12599@item @code{password-authentication?} (default: @code{#t})
12600Whether to enable password-based authentication.
12601@end table
12602@end deftp
12603
12604@defvr {Scheme Variable} %facebook-host-aliases
12605This variable contains a string for use in @file{/etc/hosts} (@pxref{Host
12606Names,,, libc, The GNU C Library Reference Manual}). Each line contains a
12607entry that maps a known server name of the Facebook on-line service---e.g.,
12608@code{www.facebook.com}---to the local host---@code{127.0.0.1} or its IPv6
12609equivalent, @code{::1}.
12610
12611This variable is typically used in the @code{hosts-file} field of an
12612@code{operating-system} declaration (@pxref{„operating-system“-Referenz,
12613@file{/etc/hosts}}):
12614
12615@example
12616(use-modules (gnu) (guix))
12617
12618(operating-system
12619 (host-name "mymachine")
12620 ;; ...
12621 (hosts-file
12622 ;; Create a /etc/hosts file with aliases for "localhost"
12623 ;; and "mymachine", as well as for Facebook servers.
12624 (plain-file "hosts"
12625 (string-append (local-host-aliases host-name)
12626 %facebook-host-aliases))))
12627@end example
12628
12629This mechanism can prevent programs running locally, such as Web browsers,
12630from accessing Facebook.
12631@end defvr
12632
12633The @code{(gnu services avahi)} provides the following definition.
12634
12635@deffn {Scheme Procedure} avahi-service [#:avahi @var{avahi}] @
12636 [#:host-name #f] [#:publish? #t] [#:ipv4? #t] @ [#:ipv6? #t] [#:wide-area?
12637#f] @ [#:domains-to-browse '()] [#:debug? #f] Return a service that runs
12638@command{avahi-daemon}, a system-wide mDNS/DNS-SD responder that allows for
12639service discovery and "zero-configuration" host name lookups (see
12640@uref{http://avahi.org/}), and extends the name service cache daemon (nscd)
12641so that it can resolve @code{.local} host names using
12642@uref{http://0pointer.de/lennart/projects/nss-mdns/, nss-mdns}.
12643Additionally, add the @var{avahi} package to the system profile so that
12644commands such as @command{avahi-browse} are directly usable.
12645
12646If @var{host-name} is different from @code{#f}, use that as the host name to
12647publish for this machine; otherwise, use the machine's actual host name.
12648
12649When @var{publish?} is true, publishing of host names and services is
12650allowed; in particular, avahi-daemon will publish the machine's host name
12651and IP address via mDNS on the local network.
12652
12653When @var{wide-area?} is true, DNS-SD over unicast DNS is enabled.
12654
12655Boolean values @var{ipv4?} and @var{ipv6?} determine whether to use
12656IPv4/IPv6 sockets.
12657@end deffn
12658
12659@deffn {Scheme Variable} openvswitch-service-type
12660This is the type of the @uref{http://www.openvswitch.org, Open vSwitch}
12661service, whose value should be an @code{openvswitch-configuration} object.
12662@end deffn
12663
12664@deftp {Data Type} openvswitch-configuration
12665Data type representing the configuration of Open vSwitch, a multilayer
12666virtual switch which is designed to enable massive network automation
12667through programmatic extension.
12668
12669@table @asis
12670@item @code{package} (default: @var{openvswitch})
12671Package object of the Open vSwitch.
12672
12673@end table
12674@end deftp
12675
12676@node X Window
12677@subsubsection X Window
12678
12679@cindex X11
12680@cindex X Window System
12681@cindex login manager
12682Support for the X Window graphical display system---specifically Xorg---is
12683provided by the @code{(gnu services xorg)} module. Note that there is no
12684@code{xorg-service} procedure. Instead, the X server is started by the
12685@dfn{login manager}, by default SLiM.
12686
12687@cindex window manager
12688To use X11, you must install at least one @dfn{window manager}---for example
12689the @code{windowmaker} or @code{openbox} packages---preferably by adding it
12690to the @code{packages} field of your operating system definition
12691(@pxref{„operating-system“-Referenz, system-wide packages}).
12692
12693@defvr {Scheme Variable} slim-service-type
12694This is the type for the SLiM graphical login manager for X11.
12695
12696@cindex session types (X11)
12697@cindex X11 session types
12698SLiM looks for @dfn{session types} described by the @file{.desktop} files in
12699@file{/run/current-system/profile/share/xsessions} and allows users to
12700choose a session from the log-in screen using @kbd{F1}. Packages such as
12701@code{xfce}, @code{sawfish}, and @code{ratpoison} provide @file{.desktop}
12702files; adding them to the system-wide set of packages automatically makes
12703them available at the log-in screen.
12704
12705In addition, @file{~/.xsession} files are honored. When available,
12706@file{~/.xsession} must be an executable that starts a window manager and/or
12707other X clients.
12708@end defvr
12709
12710@deftp {Data Type} slim-configuration
12711Data type representing the configuration of @code{slim-service-type}.
12712
12713@table @asis
12714@item @code{allow-empty-passwords?} (default: @code{#t})
12715Whether to allow logins with empty passwords.
12716
12717@item @code{auto-login?} (default: @code{#f})
12718@itemx @code{default-user} (default: @code{""})
12719When @code{auto-login?} is false, SLiM presents a log-in screen.
12720
12721When @code{auto-login?} is true, SLiM logs in directly as
12722@code{default-user}.
12723
12724@item @code{theme} (default: @code{%default-slim-theme})
12725@itemx @code{theme-name} (default: @code{%default-slim-theme-name})
12726The graphical theme to use and its name.
12727
12728@item @code{auto-login-session} (default: @code{#f})
12729If true, this must be the name of the executable to start as the default
12730session---e.g., @code{(file-append windowmaker "/bin/windowmaker")}.
12731
12732If false, a session described by one of the available @file{.desktop} files
12733in @code{/run/current-system/profile} and @code{~/.guix-profile} will be
12734used.
12735
12736@quotation Anmerkung
12737You must install at least one window manager in the system profile or in
12738your user profile. Failing to do that, if @code{auto-login-session} is
12739false, you will be unable to log in.
12740@end quotation
12741
12742@item @code{startx} (default: @code{(xorg-start-command)})
12743The command used to start the X11 graphical server.
12744
12745@item @code{xauth} (default: @code{xauth})
12746The XAuth package to use.
12747
12748@item @code{shepherd} (default: @code{shepherd})
12749The Shepherd package used when invoking @command{halt} and @command{reboot}.
12750
12751@item @code{sessreg} (default: @code{sessreg})
12752The sessreg package used in order to register the session.
12753
12754@item @code{slim} (default: @code{slim})
12755The SLiM package to use.
12756@end table
12757@end deftp
12758
12759@defvr {Scheme Variable} %default-theme
12760@defvrx {Scheme Variable} %default-theme-name
12761The default SLiM theme and its name.
12762@end defvr
12763
12764
12765@deftp {Data Type} sddm-configuration
12766This is the data type representing the sddm service configuration.
12767
12768@table @asis
12769@item @code{display-server} (default: "x11")
12770Select display server to use for the greeter. Valid values are "x11" or
12771"wayland".
12772
12773@item @code{numlock} (default: "on")
12774Valid values are "on", "off" or "none".
12775
12776@item @code{halt-command} (default @code{#~(string-apppend #$shepherd "/sbin/halt")})
12777Command to run when halting.
12778
12779@item @code{reboot-command} (default @code{#~(string-append #$shepherd "/sbin/reboot")})
12780Command to run when rebooting.
12781
12782@item @code{theme} (default "maldives")
12783Theme to use. Default themes provided by SDDM are "elarun" or "maldives".
12784
12785@item @code{themes-directory} (default "/run/current-system/profile/share/sddm/themes")
12786Directory to look for themes.
12787
12788@item @code{faces-directory} (default "/run/current-system/profile/share/sddm/faces")
12789Directory to look for faces.
12790
12791@item @code{default-path} (default "/run/current-system/profile/bin")
12792Default PATH to use.
12793
12794@item @code{minimum-uid} (default 1000)
12795Minimum UID to display in SDDM.
12796
12797@item @code{maximum-uid} (default 2000)
12798Maximum UID to display in SDDM
12799
12800@item @code{remember-last-user?} (default #t)
12801Remember last user.
12802
12803@item @code{remember-last-session?} (default #t)
12804Remember last session.
12805
12806@item @code{hide-users} (default "")
12807Usernames to hide from SDDM greeter.
12808
12809@item @code{hide-shells} (default @code{#~(string-append #$shadow "/sbin/nologin")})
12810Users with shells listed will be hidden from the SDDM greeter.
12811
12812@item @code{session-command} (default @code{#~(string-append #$sddm "/share/sddm/scripts/wayland-session")})
12813Script to run before starting a wayland session.
12814
12815@item @code{sessions-directory} (default "/run/current-system/profile/share/wayland-sessions")
12816Directory to look for desktop files starting wayland sessions.
12817
12818@item @code{xorg-server-path} (default @code{xorg-start-command})
12819Path to xorg-server.
12820
12821@item @code{xauth-path} (default @code{#~(string-append #$xauth "/bin/xauth")})
12822Path to xauth.
12823
12824@item @code{xephyr-path} (default @code{#~(string-append #$xorg-server "/bin/Xephyr")})
12825Path to Xephyr.
12826
12827@item @code{xdisplay-start} (default @code{#~(string-append #$sddm "/share/sddm/scripts/Xsetup")})
12828Script to run after starting xorg-server.
12829
12830@item @code{xdisplay-stop} (default @code{#~(string-append #$sddm "/share/sddm/scripts/Xstop")})
12831Script to run before stopping xorg-server.
12832
12833@item @code{xsession-command} (default: @code{xinitrc})
12834Script to run before starting a X session.
12835
12836@item @code{xsessions-directory} (default: "/run/current-system/profile/share/xsessions")
12837Directory to look for desktop files starting X sessions.
12838
12839@item @code{minimum-vt} (default: 7)
12840Minimum VT to use.
12841
12842@item @code{xserver-arguments} (default "-nolisten tcp")
12843Arguments to pass to xorg-server.
12844
12845@item @code{auto-login-user} (default "")
12846User to use for auto-login.
12847
12848@item @code{auto-login-session} (default "")
12849Desktop file to use for auto-login.
12850
12851@item @code{relogin?} (default #f)
12852Relogin after logout.
12853
12854@end table
12855@end deftp
12856
12857@cindex login manager
12858@cindex X11 login
12859@deffn {Scheme Procedure} sddm-service config
12860Return a service that spawns the SDDM graphical login manager for config of
12861type @code{<sddm-configuration>}.
12862
12863@example
12864 (sddm-service (sddm-configuration
12865 (auto-login-user "Alice")
12866 (auto-login-session "xfce.desktop")))
12867@end example
12868@end deffn
12869
12870@deffn {Scheme Procedure} xorg-start-command [#:guile] @
12871 [#:modules %default-xorg-modules] @ [#:fonts %default-xorg-fonts] @
12872[#:configuration-file (xorg-configuration-file @dots{})] @ [#:xorg-server
12873@var{xorg-server}] Return a @code{startx} script in which @var{modules}, a
12874list of X module packages, and @var{fonts}, a list of X font directories,
12875are available. See @code{xorg-wrapper} for more details on the arguments.
12876The result should be used in place of @code{startx}.
12877
12878Usually the X server is started by a login manager.
12879@end deffn
12880
12881@deffn {Scheme Procedure} xorg-configuration-file @
12882 [#:modules %default-xorg-modules] @ [#:fonts %default-xorg-fonts] @
12883[#:drivers '()] [#:resolutions '()] [#:extra-config '()] Return a
12884configuration file for the Xorg server containing search paths for all the
12885common drivers.
12886
12887@var{modules} must be a list of @dfn{module packages} loaded by the Xorg
12888server---e.g., @code{xf86-video-vesa}, @code{xf86-input-keyboard}, and so
12889on. @var{fonts} must be a list of font directories to add to the server's
12890@dfn{font path}.
12891
12892@var{drivers} must be either the empty list, in which case Xorg chooses a
12893graphics driver automatically, or a list of driver names that will be tried
12894in this order---e.g., @code{("modesetting" "vesa")}.
12895
12896Likewise, when @var{resolutions} is the empty list, Xorg chooses an
12897appropriate screen resolution; otherwise, it must be a list of
12898resolutions---e.g., @code{((1024 768) (640 480))}.
12899
12900Last, @var{extra-config} is a list of strings or objects appended to the
12901configuration file. It is used to pass extra text to be added verbatim to
12902the configuration file.
12903
12904@cindex keymap
12905@cindex keyboard layout
12906This procedure is especially useful to configure a different keyboard layout
12907than the default US keymap. For instance, to use the ``bépo'' keymap by
12908default on the display manager:
12909
12910@example
12911(define bepo-evdev
12912 "Section \"InputClass\"
12913 Identifier \"evdev keyboard catchall\"
12914 Driver \"evdev\"
12915 MatchIsKeyboard \"on\"
12916 Option \"xkb_layout\" \"fr\"
12917 Option \"xkb_variant\" \"bepo\"
12918EndSection")
12919
12920(operating-system
12921 ...
12922 (services
12923 (modify-services %desktop-services
12924 (slim-service-type config =>
12925 (slim-configuration
12926 (inherit config)
12927 (startx (xorg-start-command
12928 #:configuration-file
12929 (xorg-configuration-file
12930 #:extra-config
12931 (list bepo-evdev)))))))))
12932@end example
12933
12934The @code{MatchIsKeyboard} line specifies that we only apply the
12935configuration to keyboards. Without this line, other devices such as
12936touchpad may not work correctly because they will be attached to the wrong
12937driver. In this example, the user typically used @code{setxkbmap fr bepo}
12938to set their favorite keymap once logged in. The first argument corresponds
12939to the layout, while the second argument corresponds to the variant. The
12940@code{xkb_variant} line can be omitted to select the default variant.
12941@end deffn
12942
12943@deffn {Scheme Procedure} screen-locker-service @var{package} [@var{program}]
12944Add @var{package}, a package for a screen locker or screen saver whose
12945command is @var{program}, to the set of setuid programs and add a PAM entry
12946for it. For example:
12947
12948@lisp
12949(screen-locker-service xlockmore "xlock")
12950@end lisp
12951
12952makes the good ol' XlockMore usable.
12953@end deffn
12954
12955
12956@node Druckdienste
12957@subsubsection Druckdienste
12958
12959@cindex printer support with CUPS
12960The @code{(gnu services cups)} module provides a Guix service definition for
12961the CUPS printing service. To add printer support to a GuixSD system, add a
12962@code{cups-service} to the operating system definition:
12963
12964@deffn {Scheme Variable} cups-service-type
12965The service type for the CUPS print server. Its value should be a valid
12966CUPS configuration (see below). To use the default settings, simply write:
12967@example
12968(service cups-service-type)
12969@end example
12970@end deffn
12971
12972The CUPS configuration controls the basic things about your CUPS
12973installation: what interfaces it listens on, what to do if a print job
12974fails, how much logging to do, and so on. To actually add a printer, you
12975have to visit the @url{http://localhost:631} URL, or use a tool such as
12976GNOME's printer configuration services. By default, configuring a CUPS
12977service will generate a self-signed certificate if needed, for secure
12978connections to the print server.
12979
12980Suppose you want to enable the Web interface of CUPS and also add support
12981for Epson printers @i{via} the @code{escpr} package and for HP printers
12982@i{via} the @code{hplip-minimal} package. You can do that directly, like
12983this (you need to use the @code{(gnu packages cups)} module):
12984
12985@example
12986(service cups-service-type
12987 (cups-configuration
12988 (web-interface? #t)
12989 (extensions
12990 (list cups-filters escpr hplip-minimal))))
12991@end example
12992
12993Note: If you wish to use the Qt5 based GUI which comes with the hplip
12994package then it is suggested that you install the @code{hplip} package,
12995either in your OS configuration file or as your user.
12996
12997The available configuration parameters follow. Each parameter definition is
12998preceded by its type; for example, @samp{string-list foo} indicates that the
12999@code{foo} parameter should be specified as a list of strings. There is
13000also a way to specify the configuration as a string, if you have an old
13001@code{cupsd.conf} file that you want to port over from some other system;
13002see the end for more details.
13003
13004@c The following documentation was initially generated by
13005@c (generate-documentation) in (gnu services cups). Manually maintained
13006@c documentation is better, so we shouldn't hesitate to edit below as
13007@c needed. However if the change you want to make to this documentation
13008@c can be done in an automated way, it's probably easier to change
13009@c (generate-documentation) than to make it below and have to deal with
13010@c the churn as CUPS updates.
13011
13012
13013Available @code{cups-configuration} fields are:
13014
13015@deftypevr {@code{cups-configuration} parameter} package cups
13016The CUPS package.
13017@end deftypevr
13018
13019@deftypevr {@code{cups-configuration} parameter} package-list extensions
13020Drivers and other extensions to the CUPS package.
13021@end deftypevr
13022
13023@deftypevr {@code{cups-configuration} parameter} files-configuration files-configuration
13024Configuration of where to write logs, what directories to use for print
13025spools, and related privileged configuration parameters.
13026
13027Available @code{files-configuration} fields are:
13028
13029@deftypevr {@code{files-configuration} parameter} log-location access-log
13030Defines the access log filename. Specifying a blank filename disables
13031access log generation. The value @code{stderr} causes log entries to be
13032sent to the standard error file when the scheduler is running in the
13033foreground, or to the system log daemon when run in the background. The
13034value @code{syslog} causes log entries to be sent to the system log daemon.
13035The server name may be included in filenames using the string @code{%s}, as
13036in @code{/var/log/cups/%s-access_log}.
13037
13038Defaults to @samp{"/var/log/cups/access_log"}.
13039@end deftypevr
13040
13041@deftypevr {@code{files-configuration} parameter} file-name cache-dir
13042Where CUPS should cache data.
13043
13044Defaults to @samp{"/var/cache/cups"}.
13045@end deftypevr
13046
13047@deftypevr {@code{files-configuration} parameter} string config-file-perm
13048Specifies the permissions for all configuration files that the scheduler
13049writes.
13050
13051Note that the permissions for the printers.conf file are currently masked to
13052only allow access from the scheduler user (typically root). This is done
13053because printer device URIs sometimes contain sensitive authentication
13054information that should not be generally known on the system. There is no
13055way to disable this security feature.
13056
13057Defaults to @samp{"0640"}.
13058@end deftypevr
13059
13060@deftypevr {@code{files-configuration} parameter} log-location error-log
13061Defines the error log filename. Specifying a blank filename disables access
13062log generation. The value @code{stderr} causes log entries to be sent to
13063the standard error file when the scheduler is running in the foreground, or
13064to the system log daemon when run in the background. The value
13065@code{syslog} causes log entries to be sent to the system log daemon. The
13066server name may be included in filenames using the string @code{%s}, as in
13067@code{/var/log/cups/%s-error_log}.
13068
13069Defaults to @samp{"/var/log/cups/error_log"}.
13070@end deftypevr
13071
13072@deftypevr {@code{files-configuration} parameter} string fatal-errors
13073Specifies which errors are fatal, causing the scheduler to exit. The kind
13074strings are:
13075
13076@table @code
13077@item none
13078No errors are fatal.
13079
13080@item all
13081All of the errors below are fatal.
13082
13083@item browse
13084Browsing initialization errors are fatal, for example failed connections to
13085the DNS-SD daemon.
13086
13087@item config
13088Configuration file syntax errors are fatal.
13089
13090@item listen
13091Listen or Port errors are fatal, except for IPv6 failures on the loopback or
13092@code{any} addresses.
13093
13094@item log
13095Log file creation or write errors are fatal.
13096
13097@item permissions
13098Bad startup file permissions are fatal, for example shared TLS certificate
13099and key files with world-read permissions.
13100@end table
13101
13102Defaults to @samp{"all -browse"}.
13103@end deftypevr
13104
13105@deftypevr {@code{files-configuration} parameter} boolean file-device?
13106Specifies whether the file pseudo-device can be used for new printer
13107queues. The URI @uref{file:///dev/null} is always allowed.
13108
13109Defaults to @samp{#f}.
13110@end deftypevr
13111
13112@deftypevr {@code{files-configuration} parameter} string group
13113Specifies the group name or ID that will be used when executing external
13114programs.
13115
13116Defaults to @samp{"lp"}.
13117@end deftypevr
13118
13119@deftypevr {@code{files-configuration} parameter} string log-file-perm
13120Specifies the permissions for all log files that the scheduler writes.
13121
13122Defaults to @samp{"0644"}.
13123@end deftypevr
13124
13125@deftypevr {@code{files-configuration} parameter} log-location page-log
13126Defines the page log filename. Specifying a blank filename disables access
13127log generation. The value @code{stderr} causes log entries to be sent to
13128the standard error file when the scheduler is running in the foreground, or
13129to the system log daemon when run in the background. The value
13130@code{syslog} causes log entries to be sent to the system log daemon. The
13131server name may be included in filenames using the string @code{%s}, as in
13132@code{/var/log/cups/%s-page_log}.
13133
13134Defaults to @samp{"/var/log/cups/page_log"}.
13135@end deftypevr
13136
13137@deftypevr {@code{files-configuration} parameter} string remote-root
13138Specifies the username that is associated with unauthenticated accesses by
13139clients claiming to be the root user. The default is @code{remroot}.
13140
13141Defaults to @samp{"remroot"}.
13142@end deftypevr
13143
13144@deftypevr {@code{files-configuration} parameter} file-name request-root
13145Specifies the directory that contains print jobs and other HTTP request
13146data.
13147
13148Defaults to @samp{"/var/spool/cups"}.
13149@end deftypevr
13150
13151@deftypevr {@code{files-configuration} parameter} sandboxing sandboxing
13152Specifies the level of security sandboxing that is applied to print filters,
13153backends, and other child processes of the scheduler; either @code{relaxed}
13154or @code{strict}. This directive is currently only used/supported on macOS.
13155
13156Defaults to @samp{strict}.
13157@end deftypevr
13158
13159@deftypevr {@code{files-configuration} parameter} file-name server-keychain
13160Specifies the location of TLS certificates and private keys. CUPS will look
13161for public and private keys in this directory: a @code{.crt} files for
13162PEM-encoded certificates and corresponding @code{.key} files for PEM-encoded
13163private keys.
13164
13165Defaults to @samp{"/etc/cups/ssl"}.
13166@end deftypevr
13167
13168@deftypevr {@code{files-configuration} parameter} file-name server-root
13169Specifies the directory containing the server configuration files.
13170
13171Defaults to @samp{"/etc/cups"}.
13172@end deftypevr
13173
13174@deftypevr {@code{files-configuration} parameter} boolean sync-on-close?
13175Specifies whether the scheduler calls fsync(2) after writing configuration
13176or state files.
13177
13178Defaults to @samp{#f}.
13179@end deftypevr
13180
13181@deftypevr {@code{files-configuration} parameter} space-separated-string-list system-group
13182Specifies the group(s) to use for @code{@@SYSTEM} group authentication.
13183@end deftypevr
13184
13185@deftypevr {@code{files-configuration} parameter} file-name temp-dir
13186Specifies the directory where temporary files are stored.
13187
13188Defaults to @samp{"/var/spool/cups/tmp"}.
13189@end deftypevr
13190
13191@deftypevr {@code{files-configuration} parameter} string user
13192Specifies the user name or ID that is used when running external programs.
13193
13194Defaults to @samp{"lp"}.
13195@end deftypevr
13196@end deftypevr
13197
13198@deftypevr {@code{cups-configuration} parameter} access-log-level access-log-level
13199Specifies the logging level for the AccessLog file. The @code{config} level
13200logs when printers and classes are added, deleted, or modified and when
13201configuration files are accessed or updated. The @code{actions} level logs
13202when print jobs are submitted, held, released, modified, or canceled, and
13203any of the conditions for @code{config}. The @code{all} level logs all
13204requests.
13205
13206Defaults to @samp{actions}.
13207@end deftypevr
13208
13209@deftypevr {@code{cups-configuration} parameter} boolean auto-purge-jobs?
13210Specifies whether to purge job history data automatically when it is no
13211longer required for quotas.
13212
13213Defaults to @samp{#f}.
13214@end deftypevr
13215
13216@deftypevr {@code{cups-configuration} parameter} browse-local-protocols browse-local-protocols
13217Specifies which protocols to use for local printer sharing.
13218
13219Defaults to @samp{dnssd}.
13220@end deftypevr
13221
13222@deftypevr {@code{cups-configuration} parameter} boolean browse-web-if?
13223Specifies whether the CUPS web interface is advertised.
13224
13225Defaults to @samp{#f}.
13226@end deftypevr
13227
13228@deftypevr {@code{cups-configuration} parameter} boolean browsing?
13229Specifies whether shared printers are advertised.
13230
13231Defaults to @samp{#f}.
13232@end deftypevr
13233
13234@deftypevr {@code{cups-configuration} parameter} string classification
13235Specifies the security classification of the server. Any valid banner name
13236can be used, including "classified", "confidential", "secret", "topsecret",
13237and "unclassified", or the banner can be omitted to disable secure printing
13238functions.
13239
13240Defaults to @samp{""}.
13241@end deftypevr
13242
13243@deftypevr {@code{cups-configuration} parameter} boolean classify-override?
13244Specifies whether users may override the classification (cover page) of
13245individual print jobs using the @code{job-sheets} option.
13246
13247Defaults to @samp{#f}.
13248@end deftypevr
13249
13250@deftypevr {@code{cups-configuration} parameter} default-auth-type default-auth-type
13251Specifies the default type of authentication to use.
13252
13253Defaults to @samp{Basic}.
13254@end deftypevr
13255
13256@deftypevr {@code{cups-configuration} parameter} default-encryption default-encryption
13257Specifies whether encryption will be used for authenticated requests.
13258
13259Defaults to @samp{Required}.
13260@end deftypevr
13261
13262@deftypevr {@code{cups-configuration} parameter} string default-language
13263Specifies the default language to use for text and web content.
13264
13265Defaults to @samp{"en"}.
13266@end deftypevr
13267
13268@deftypevr {@code{cups-configuration} parameter} string default-paper-size
13269Specifies the default paper size for new print queues. @samp{"Auto"} uses a
13270locale-specific default, while @samp{"None"} specifies there is no default
13271paper size. Specific size names are typically @samp{"Letter"} or
13272@samp{"A4"}.
13273
13274Defaults to @samp{"Auto"}.
13275@end deftypevr
13276
13277@deftypevr {@code{cups-configuration} parameter} string default-policy
13278Specifies the default access policy to use.
13279
13280Defaults to @samp{"default"}.
13281@end deftypevr
13282
13283@deftypevr {@code{cups-configuration} parameter} boolean default-shared?
13284Specifies whether local printers are shared by default.
13285
13286Defaults to @samp{#t}.
13287@end deftypevr
13288
13289@deftypevr {@code{cups-configuration} parameter} non-negative-integer dirty-clean-interval
13290Specifies the delay for updating of configuration and state files, in
13291seconds. A value of 0 causes the update to happen as soon as possible,
13292typically within a few milliseconds.
13293
13294Defaults to @samp{30}.
13295@end deftypevr
13296
13297@deftypevr {@code{cups-configuration} parameter} error-policy error-policy
13298Specifies what to do when an error occurs. Possible values are
13299@code{abort-job}, which will discard the failed print job; @code{retry-job},
13300which will retry the job at a later time; @code{retry-this-job}, which
13301retries the failed job immediately; and @code{stop-printer}, which stops the
13302printer.
13303
13304Defaults to @samp{stop-printer}.
13305@end deftypevr
13306
13307@deftypevr {@code{cups-configuration} parameter} non-negative-integer filter-limit
13308Specifies the maximum cost of filters that are run concurrently, which can
13309be used to minimize disk, memory, and CPU resource problems. A limit of 0
13310disables filter limiting. An average print to a non-PostScript printer
13311needs a filter limit of about 200. A PostScript printer needs about half
13312that (100). Setting the limit below these thresholds will effectively limit
13313the scheduler to printing a single job at any time.
13314
13315Defaults to @samp{0}.
13316@end deftypevr
13317
13318@deftypevr {@code{cups-configuration} parameter} non-negative-integer filter-nice
13319Specifies the scheduling priority of filters that are run to print a job.
13320The nice value ranges from 0, the highest priority, to 19, the lowest
13321priority.
13322
13323Defaults to @samp{0}.
13324@end deftypevr
13325
13326@deftypevr {@code{cups-configuration} parameter} host-name-lookups host-name-lookups
13327Specifies whether to do reverse lookups on connecting clients. The
13328@code{double} setting causes @code{cupsd} to verify that the hostname
13329resolved from the address matches one of the addresses returned for that
13330hostname. Double lookups also prevent clients with unregistered addresses
13331from connecting to your server. Only set this option to @code{#t} or
13332@code{double} if absolutely required.
13333
13334Defaults to @samp{#f}.
13335@end deftypevr
13336
13337@deftypevr {@code{cups-configuration} parameter} non-negative-integer job-kill-delay
13338Specifies the number of seconds to wait before killing the filters and
13339backend associated with a canceled or held job.
13340
13341Defaults to @samp{30}.
13342@end deftypevr
13343
13344@deftypevr {@code{cups-configuration} parameter} non-negative-integer job-retry-interval
13345Specifies the interval between retries of jobs in seconds. This is
13346typically used for fax queues but can also be used with normal print queues
13347whose error policy is @code{retry-job} or @code{retry-current-job}.
13348
13349Defaults to @samp{30}.
13350@end deftypevr
13351
13352@deftypevr {@code{cups-configuration} parameter} non-negative-integer job-retry-limit
13353Specifies the number of retries that are done for jobs. This is typically
13354used for fax queues but can also be used with normal print queues whose
13355error policy is @code{retry-job} or @code{retry-current-job}.
13356
13357Defaults to @samp{5}.
13358@end deftypevr
13359
13360@deftypevr {@code{cups-configuration} parameter} boolean keep-alive?
13361Specifies whether to support HTTP keep-alive connections.
13362
13363Defaults to @samp{#t}.
13364@end deftypevr
13365
13366@deftypevr {@code{cups-configuration} parameter} non-negative-integer keep-alive-timeout
13367Specifies how long an idle client connection remains open, in seconds.
13368
13369Defaults to @samp{30}.
13370@end deftypevr
13371
13372@deftypevr {@code{cups-configuration} parameter} non-negative-integer limit-request-body
13373Specifies the maximum size of print files, IPP requests, and HTML form
13374data. A limit of 0 disables the limit check.
13375
13376Defaults to @samp{0}.
13377@end deftypevr
13378
13379@deftypevr {@code{cups-configuration} parameter} multiline-string-list listen
13380Listens on the specified interfaces for connections. Valid values are of
13381the form @var{address}:@var{port}, where @var{address} is either an IPv6
13382address enclosed in brackets, an IPv4 address, or @code{*} to indicate all
13383addresses. Values can also be file names of local UNIX domain sockets. The
13384Listen directive is similar to the Port directive but allows you to restrict
13385access to specific interfaces or networks.
13386@end deftypevr
13387
13388@deftypevr {@code{cups-configuration} parameter} non-negative-integer listen-back-log
13389Specifies the number of pending connections that will be allowed. This
13390normally only affects very busy servers that have reached the MaxClients
13391limit, but can also be triggered by large numbers of simultaneous
13392connections. When the limit is reached, the operating system will refuse
13393additional connections until the scheduler can accept the pending ones.
13394
13395Defaults to @samp{128}.
13396@end deftypevr
13397
13398@deftypevr {@code{cups-configuration} parameter} location-access-control-list location-access-controls
13399Specifies a set of additional access controls.
13400
13401Available @code{location-access-controls} fields are:
13402
13403@deftypevr {@code{location-access-controls} parameter} file-name path
13404Specifies the URI path to which the access control applies.
13405@end deftypevr
13406
13407@deftypevr {@code{location-access-controls} parameter} access-control-list access-controls
13408Access controls for all access to this path, in the same format as the
13409@code{access-controls} of @code{operation-access-control}.
13410
13411Defaults to @samp{()}.
13412@end deftypevr
13413
13414@deftypevr {@code{location-access-controls} parameter} method-access-control-list method-access-controls
13415Access controls for method-specific access to this path.
13416
13417Defaults to @samp{()}.
13418
13419Available @code{method-access-controls} fields are:
13420
13421@deftypevr {@code{method-access-controls} parameter} boolean reverse?
13422If @code{#t}, apply access controls to all methods except the listed
13423methods. Otherwise apply to only the listed methods.
13424
13425Defaults to @samp{#f}.
13426@end deftypevr
13427
13428@deftypevr {@code{method-access-controls} parameter} method-list methods
13429Methods to which this access control applies.
13430
13431Defaults to @samp{()}.
13432@end deftypevr
13433
13434@deftypevr {@code{method-access-controls} parameter} access-control-list access-controls
13435Access control directives, as a list of strings. Each string should be one
13436directive, such as "Order allow,deny".
13437
13438Defaults to @samp{()}.
13439@end deftypevr
13440@end deftypevr
13441@end deftypevr
13442
13443@deftypevr {@code{cups-configuration} parameter} non-negative-integer log-debug-history
13444Specifies the number of debugging messages that are retained for logging if
13445an error occurs in a print job. Debug messages are logged regardless of the
13446LogLevel setting.
13447
13448Defaults to @samp{100}.
13449@end deftypevr
13450
13451@deftypevr {@code{cups-configuration} parameter} log-level log-level
13452Specifies the level of logging for the ErrorLog file. The value @code{none}
13453stops all logging while @code{debug2} logs everything.
13454
13455Defaults to @samp{info}.
13456@end deftypevr
13457
13458@deftypevr {@code{cups-configuration} parameter} log-time-format log-time-format
13459Specifies the format of the date and time in the log files. The value
13460@code{standard} logs whole seconds while @code{usecs} logs microseconds.
13461
13462Defaults to @samp{standard}.
13463@end deftypevr
13464
13465@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-clients
13466Specifies the maximum number of simultaneous clients that are allowed by the
13467scheduler.
13468
13469Defaults to @samp{100}.
13470@end deftypevr
13471
13472@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-clients-per-host
13473Specifies the maximum number of simultaneous clients that are allowed from a
13474single address.
13475
13476Defaults to @samp{100}.
13477@end deftypevr
13478
13479@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-copies
13480Specifies the maximum number of copies that a user can print of each job.
13481
13482Defaults to @samp{9999}.
13483@end deftypevr
13484
13485@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-hold-time
13486Specifies the maximum time a job may remain in the @code{indefinite} hold
13487state before it is canceled. A value of 0 disables cancellation of held
13488jobs.
13489
13490Defaults to @samp{0}.
13491@end deftypevr
13492
13493@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-jobs
13494Specifies the maximum number of simultaneous jobs that are allowed. Set to
134950 to allow an unlimited number of jobs.
13496
13497Defaults to @samp{500}.
13498@end deftypevr
13499
13500@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-jobs-per-printer
13501Specifies the maximum number of simultaneous jobs that are allowed per
13502printer. A value of 0 allows up to MaxJobs jobs per printer.
13503
13504Defaults to @samp{0}.
13505@end deftypevr
13506
13507@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-jobs-per-user
13508Specifies the maximum number of simultaneous jobs that are allowed per
13509user. A value of 0 allows up to MaxJobs jobs per user.
13510
13511Defaults to @samp{0}.
13512@end deftypevr
13513
13514@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-job-time
13515Specifies the maximum time a job may take to print before it is canceled, in
13516seconds. Set to 0 to disable cancellation of "stuck" jobs.
13517
13518Defaults to @samp{10800}.
13519@end deftypevr
13520
13521@deftypevr {@code{cups-configuration} parameter} non-negative-integer max-log-size
13522Specifies the maximum size of the log files before they are rotated, in
13523bytes. The value 0 disables log rotation.
13524
13525Defaults to @samp{1048576}.
13526@end deftypevr
13527
13528@deftypevr {@code{cups-configuration} parameter} non-negative-integer multiple-operation-timeout
13529Specifies the maximum amount of time to allow between files in a multiple
13530file print job, in seconds.
13531
13532Defaults to @samp{300}.
13533@end deftypevr
13534
13535@deftypevr {@code{cups-configuration} parameter} string page-log-format
13536Specifies the format of PageLog lines. Sequences beginning with percent
13537(@samp{%}) characters are replaced with the corresponding information, while
13538all other characters are copied literally. The following percent sequences
13539are recognized:
13540
13541@table @samp
13542@item %%
13543insert a single percent character
13544
13545@item %@{name@}
13546insert the value of the specified IPP attribute
13547
13548@item %C
13549insert the number of copies for the current page
13550
13551@item %P
13552insert the current page number
13553
13554@item %T
13555insert the current date and time in common log format
13556
13557@item %j
13558insert the job ID
13559
13560@item %p
13561insert the printer name
13562
13563@item %u
13564insert the username
13565@end table
13566
13567A value of the empty string disables page logging. The string @code{%p %u
13568%j %T %P %C %@{job-billing@} %@{job-originating-host-name@} %@{job-name@}
13569%@{media@} %@{sides@}} creates a page log with the standard items.
13570
13571Defaults to @samp{""}.
13572@end deftypevr
13573
13574@deftypevr {@code{cups-configuration} parameter} environment-variables environment-variables
13575Passes the specified environment variable(s) to child processes; a list of
13576strings.
13577
13578Defaults to @samp{()}.
13579@end deftypevr
13580
13581@deftypevr {@code{cups-configuration} parameter} policy-configuration-list policies
13582Specifies named access control policies.
13583
13584Available @code{policy-configuration} fields are:
13585
13586@deftypevr {@code{policy-configuration} parameter} string name
13587Name of the policy.
13588@end deftypevr
13589
13590@deftypevr {@code{policy-configuration} parameter} string job-private-access
13591Specifies an access list for a job's private values. @code{@@ACL} maps to
13592the printer's requesting-user-name-allowed or requesting-user-name-denied
13593values. @code{@@OWNER} maps to the job's owner. @code{@@SYSTEM} maps to
13594the groups listed for the @code{system-group} field of the
13595@code{files-config} configuration, which is reified into the
13596@code{cups-files.conf(5)} file. Other possible elements of the access list
13597include specific user names, and @code{@@@var{group}} to indicate members of
13598a specific group. The access list may also be simply @code{all} or
13599@code{default}.
13600
13601Defaults to @samp{"@@OWNER @@SYSTEM"}.
13602@end deftypevr
13603
13604@deftypevr {@code{policy-configuration} parameter} string job-private-values
13605Specifies the list of job values to make private, or @code{all},
13606@code{default}, or @code{none}.
13607
13608Defaults to @samp{"job-name job-originating-host-name
13609job-originating-user-name phone"}.
13610@end deftypevr
13611
13612@deftypevr {@code{policy-configuration} parameter} string subscription-private-access
13613Specifies an access list for a subscription's private values. @code{@@ACL}
13614maps to the printer's requesting-user-name-allowed or
13615requesting-user-name-denied values. @code{@@OWNER} maps to the job's
13616owner. @code{@@SYSTEM} maps to the groups listed for the
13617@code{system-group} field of the @code{files-config} configuration, which is
13618reified into the @code{cups-files.conf(5)} file. Other possible elements of
13619the access list include specific user names, and @code{@@@var{group}} to
13620indicate members of a specific group. The access list may also be simply
13621@code{all} or @code{default}.
13622
13623Defaults to @samp{"@@OWNER @@SYSTEM"}.
13624@end deftypevr
13625
13626@deftypevr {@code{policy-configuration} parameter} string subscription-private-values
13627Specifies the list of job values to make private, or @code{all},
13628@code{default}, or @code{none}.
13629
13630Defaults to @samp{"notify-events notify-pull-method notify-recipient-uri
13631notify-subscriber-user-name notify-user-data"}.
13632@end deftypevr
13633
13634@deftypevr {@code{policy-configuration} parameter} operation-access-control-list access-controls
13635Access control by IPP operation.
13636
13637Defaults to @samp{()}.
13638@end deftypevr
13639@end deftypevr
13640
13641@deftypevr {@code{cups-configuration} parameter} boolean-or-non-negative-integer preserve-job-files
13642Specifies whether job files (documents) are preserved after a job is
13643printed. If a numeric value is specified, job files are preserved for the
13644indicated number of seconds after printing. Otherwise a boolean value
13645applies indefinitely.
13646
13647Defaults to @samp{86400}.
13648@end deftypevr
13649
13650@deftypevr {@code{cups-configuration} parameter} boolean-or-non-negative-integer preserve-job-history
13651Specifies whether the job history is preserved after a job is printed. If a
13652numeric value is specified, the job history is preserved for the indicated
13653number of seconds after printing. If @code{#t}, the job history is
13654preserved until the MaxJobs limit is reached.
13655
13656Defaults to @samp{#t}.
13657@end deftypevr
13658
13659@deftypevr {@code{cups-configuration} parameter} non-negative-integer reload-timeout
13660Specifies the amount of time to wait for job completion before restarting
13661the scheduler.
13662
13663Defaults to @samp{30}.
13664@end deftypevr
13665
13666@deftypevr {@code{cups-configuration} parameter} string rip-cache
13667Specifies the maximum amount of memory to use when converting documents into
13668bitmaps for a printer.
13669
13670Defaults to @samp{"128m"}.
13671@end deftypevr
13672
13673@deftypevr {@code{cups-configuration} parameter} string server-admin
13674Specifies the email address of the server administrator.
13675
13676Defaults to @samp{"root@@localhost.localdomain"}.
13677@end deftypevr
13678
13679@deftypevr {@code{cups-configuration} parameter} host-name-list-or-* server-alias
13680The ServerAlias directive is used for HTTP Host header validation when
13681clients connect to the scheduler from external interfaces. Using the
13682special name @code{*} can expose your system to known browser-based DNS
13683rebinding attacks, even when accessing sites through a firewall. If the
13684auto-discovery of alternate names does not work, we recommend listing each
13685alternate name with a ServerAlias directive instead of using @code{*}.
13686
13687Defaults to @samp{*}.
13688@end deftypevr
13689
13690@deftypevr {@code{cups-configuration} parameter} string server-name
13691Specifies the fully-qualified host name of the server.
13692
13693Defaults to @samp{"localhost"}.
13694@end deftypevr
13695
13696@deftypevr {@code{cups-configuration} parameter} server-tokens server-tokens
13697Specifies what information is included in the Server header of HTTP
13698responses. @code{None} disables the Server header. @code{ProductOnly}
13699reports @code{CUPS}. @code{Major} reports @code{CUPS 2}. @code{Minor}
13700reports @code{CUPS 2.0}. @code{Minimal} reports @code{CUPS 2.0.0}.
13701@code{OS} reports @code{CUPS 2.0.0 (@var{uname})} where @var{uname} is the
13702output of the @code{uname} command. @code{Full} reports @code{CUPS 2.0.0
13703(@var{uname}) IPP/2.0}.
13704
13705Defaults to @samp{Minimal}.
13706@end deftypevr
13707
13708@deftypevr {@code{cups-configuration} parameter} string set-env
13709Set the specified environment variable to be passed to child processes.
13710
13711Defaults to @samp{"variable value"}.
13712@end deftypevr
13713
13714@deftypevr {@code{cups-configuration} parameter} multiline-string-list ssl-listen
13715Listens on the specified interfaces for encrypted connections. Valid values
13716are of the form @var{address}:@var{port}, where @var{address} is either an
13717IPv6 address enclosed in brackets, an IPv4 address, or @code{*} to indicate
13718all addresses.
13719
13720Defaults to @samp{()}.
13721@end deftypevr
13722
13723@deftypevr {@code{cups-configuration} parameter} ssl-options ssl-options
13724Sets encryption options. By default, CUPS only supports encryption using
13725TLS v1.0 or higher using known secure cipher suites. The @code{AllowRC4}
13726option enables the 128-bit RC4 cipher suites, which are required for some
13727older clients that do not implement newer ones. The @code{AllowSSL3} option
13728enables SSL v3.0, which is required for some older clients that do not
13729support TLS v1.0.
13730
13731Defaults to @samp{()}.
13732@end deftypevr
13733
13734@deftypevr {@code{cups-configuration} parameter} boolean strict-conformance?
13735Specifies whether the scheduler requires clients to strictly adhere to the
13736IPP specifications.
13737
13738Defaults to @samp{#f}.
13739@end deftypevr
13740
13741@deftypevr {@code{cups-configuration} parameter} non-negative-integer timeout
13742Specifies the HTTP request timeout, in seconds.
13743
13744Defaults to @samp{300}.
13745
13746@end deftypevr
13747
13748@deftypevr {@code{cups-configuration} parameter} boolean web-interface?
13749Specifies whether the web interface is enabled.
13750
13751Defaults to @samp{#f}.
13752@end deftypevr
13753
13754At this point you're probably thinking ``oh dear, Guix manual, I like you
13755but you can stop already with the configuration options''. Indeed.
13756However, one more point: it could be that you have an existing
13757@code{cupsd.conf} that you want to use. In that case, you can pass an
13758@code{opaque-cups-configuration} as the configuration of a
13759@code{cups-service-type}.
13760
13761Available @code{opaque-cups-configuration} fields are:
13762
13763@deftypevr {@code{opaque-cups-configuration} parameter} package cups
13764The CUPS package.
13765@end deftypevr
13766
13767@deftypevr {@code{opaque-cups-configuration} parameter} string cupsd.conf
13768The contents of the @code{cupsd.conf}, as a string.
13769@end deftypevr
13770
13771@deftypevr {@code{opaque-cups-configuration} parameter} string cups-files.conf
13772The contents of the @code{cups-files.conf} file, as a string.
13773@end deftypevr
13774
13775For example, if your @code{cupsd.conf} and @code{cups-files.conf} are in
13776strings of the same name, you could instantiate a CUPS service like this:
13777
13778@example
13779(service cups-service-type
13780 (opaque-cups-configuration
13781 (cupsd.conf cupsd.conf)
13782 (cups-files.conf cups-files.conf)))
13783@end example
13784
13785
13786@node Desktop-Dienste
13787@subsubsection Desktop-Dienste
13788
13789The @code{(gnu services desktop)} module provides services that are usually
13790useful in the context of a ``desktop'' setup---that is, on a machine running
13791a graphical display server, possibly with graphical user interfaces, etc.
13792It also defines services that provide specific desktop environments like
13793GNOME, XFCE or MATE.
13794
13795To simplify things, the module defines a variable containing the set of
13796services that users typically expect on a machine with a graphical
13797environment and networking:
13798
13799@defvr {Scheme Variable} %desktop-services
13800This is a list of services that builds upon @var{%base-services} and adds or
13801adjusts services for a typical ``desktop'' setup.
13802
13803In particular, it adds a graphical login manager (@pxref{X Window,
13804@code{slim-service}}), screen lockers, a network management tool
13805(@pxref{Netzwerkdienste, @code{network-manager-service-type}}), energy
13806and color management services, the @code{elogind} login and seat manager,
13807the Polkit privilege service, the GeoClue location service, the
13808AccountsService daemon that allows authorized users change system passwords,
13809an NTP client (@pxref{Netzwerkdienste}), the Avahi daemon, and has the
13810name service switch service configured to be able to use @code{nss-mdns}
13811(@pxref{Name Service Switch, mDNS}).
13812@end defvr
13813
13814The @var{%desktop-services} variable can be used as the @code{services}
13815field of an @code{operating-system} declaration (@pxref{„operating-system“-Referenz, @code{services}}).
13816
13817Additionally, the @code{gnome-desktop-service}, @code{xfce-desktop-service},
13818@code{mate-desktop-service} and @code{enlightenment-desktop-service-type}
13819procedures can add GNOME, XFCE, MATE and/or Enlightenment to a system. To
13820``add GNOME'' means that system-level services like the backlight adjustment
13821helpers and the power management utilities are added to the system,
13822extending @code{polkit} and @code{dbus} appropriately, allowing GNOME to
13823operate with elevated privileges on a limited number of special-purpose
13824system interfaces. Additionally, adding a service made by
13825@code{gnome-desktop-service} adds the GNOME metapackage to the system
13826profile. Likewise, adding the XFCE service not only adds the @code{xfce}
13827metapackage to the system profile, but it also gives the Thunar file manager
13828the ability to open a ``root-mode'' file management window, if the user
13829authenticates using the administrator's password via the standard polkit
13830graphical interface. To ``add MATE'' means that @code{polkit} and
13831@code{dbus} are extended appropriately, allowing MATE to operate with
13832elevated privileges on a limited number of special-purpose system
13833interfaces. Additionally, adding a service made by
13834@code{mate-desktop-service} adds the MATE metapackage to the system
13835profile. ``Adding ENLIGHTENMENT'' means that @code{dbus} is extended
13836appropriately, and several of Enlightenment's binaries are set as setuid,
13837allowing Enlightenment's screen locker and other functionality to work as
13838expetected.
13839
13840The desktop environments in Guix use the Xorg display server by default. If
13841you'd like to use the newer display server protocol called Wayland, you need
13842to use the @code{sddm-service} instead of the @code{slim-service} for the
13843graphical login manager. You should then select the ``GNOME (Wayland)''
13844session in SDDM. Alternatively you can also try starting GNOME on Wayland
13845manually from a TTY with the command ``XDG_SESSION_TYPE=wayland exec
13846dbus-run-session gnome-session``. Currently only GNOME has support for
13847Wayland.
13848
13849@deffn {Scheme Procedure} gnome-desktop-service
13850Return a service that adds the @code{gnome} package to the system profile,
13851and extends polkit with the actions from @code{gnome-settings-daemon}.
13852@end deffn
13853
13854@deffn {Scheme Procedure} xfce-desktop-service
13855Return a service that adds the @code{xfce} package to the system profile,
13856and extends polkit with the ability for @code{thunar} to manipulate the file
13857system as root from within a user session, after the user has authenticated
13858with the administrator's password.
13859@end deffn
13860
13861@deffn {Scheme Procedure} mate-desktop-service
13862Return a service that adds the @code{mate} package to the system profile,
13863and extends polkit with the actions from @code{mate-settings-daemon}.
13864@end deffn
13865
13866@deffn {Scheme Procedure} enlightenment-desktop-service-type
13867Return a service that adds the @code{enlightenment} package to the system
13868profile, and extends dbus with actions from @code{efl}.
13869@end deffn
13870
13871@deftp {Data Type} enlightenment-desktop-service-configuration
13872@table @asis
13873@item @code{enlightenment} (default @code{enlightenment})
13874The enlightenment package to use.
13875@end table
13876@end deftp
13877
13878Because the GNOME, XFCE and MATE desktop services pull in so many packages,
13879the default @code{%desktop-services} variable doesn't include any of them by
13880default. To add GNOME, XFCE or MATE, just @code{cons} them onto
13881@code{%desktop-services} in the @code{services} field of your
13882@code{operating-system}:
13883
13884@example
13885(use-modules (gnu))
13886(use-service-modules desktop)
13887(operating-system
13888 ...
13889 ;; cons* adds items to the list given as its last argument.
13890 (services (cons* (gnome-desktop-service)
13891 (xfce-desktop-service)
13892 %desktop-services))
13893 ...)
13894@end example
13895
13896These desktop environments will then be available as options in the
13897graphical login window.
13898
13899The actual service definitions included in @code{%desktop-services} and
13900provided by @code{(gnu services dbus)} and @code{(gnu services desktop)} are
13901described below.
13902
13903@deffn {Scheme Procedure} dbus-service [#:dbus @var{dbus}] [#:services '()]
13904Return a service that runs the ``system bus'', using @var{dbus}, with
13905support for @var{services}.
13906
13907@uref{http://dbus.freedesktop.org/, D-Bus} is an inter-process communication
13908facility. Its system bus is used to allow system services to communicate
13909and to be notified of system-wide events.
13910
13911@var{services} must be a list of packages that provide an
13912@file{etc/dbus-1/system.d} directory containing additional D-Bus
13913configuration and policy files. For example, to allow avahi-daemon to use
13914the system bus, @var{services} must be equal to @code{(list avahi)}.
13915@end deffn
13916
13917@deffn {Scheme Procedure} elogind-service [#:config @var{config}]
13918Return a service that runs the @code{elogind} login and seat management
13919daemon. @uref{https://github.com/elogind/elogind, Elogind} exposes a D-Bus
13920interface that can be used to know which users are logged in, know what kind
13921of sessions they have open, suspend the system, inhibit system suspend,
13922reboot the system, and other tasks.
13923
13924Elogind handles most system-level power events for a computer, for example
13925suspending the system when a lid is closed, or shutting it down when the
13926power button is pressed.
13927
13928The @var{config} keyword argument specifies the configuration for elogind,
13929and should be the result of an @code{(elogind-configuration (@var{parameter}
13930@var{value})...)} invocation. Available parameters and their default values
13931are:
13932
13933@table @code
13934@item kill-user-processes?
13935@code{#f}
13936@item kill-only-users
13937@code{()}
13938@item kill-exclude-users
13939@code{("root")}
13940@item inhibit-delay-max-seconds
13941@code{5}
13942@item handle-power-key
13943@code{poweroff}
13944@item handle-suspend-key
13945@code{suspend}
13946@item handle-hibernate-key
13947@code{hibernate}
13948@item handle-lid-switch
13949@code{suspend}
13950@item handle-lid-switch-docked
13951@code{ignore}
13952@item power-key-ignore-inhibited?
13953@code{#f}
13954@item suspend-key-ignore-inhibited?
13955@code{#f}
13956@item hibernate-key-ignore-inhibited?
13957@code{#f}
13958@item lid-switch-ignore-inhibited?
13959@code{#t}
13960@item holdoff-timeout-seconds
13961@code{30}
13962@item idle-action
13963@code{ignore}
13964@item idle-action-seconds
13965@code{(* 30 60)}
13966@item runtime-directory-size-percent
13967@code{10}
13968@item runtime-directory-size
13969@code{#f}
13970@item remove-ipc?
13971@code{#t}
13972@item suspend-state
13973@code{("mem" "standby" "freeze")}
13974@item suspend-mode
13975@code{()}
13976@item hibernate-state
13977@code{("disk")}
13978@item hibernate-mode
13979@code{("platform" "shutdown")}
13980@item hybrid-sleep-state
13981@code{("disk")}
13982@item hybrid-sleep-mode
13983@code{("suspend" "platform" "shutdown")}
13984@end table
13985@end deffn
13986
13987@deffn {Scheme Procedure} accountsservice-service @
13988 [#:accountsservice @var{accountsservice}] Return a service that runs
13989AccountsService, a system service that can list available accounts, change
13990their passwords, and so on. AccountsService integrates with PolicyKit to
13991enable unprivileged users to acquire the capability to modify their system
13992configuration.
13993@uref{https://www.freedesktop.org/wiki/Software/AccountsService/, the
13994accountsservice web site} for more information.
13995
13996The @var{accountsservice} keyword argument is the @code{accountsservice}
13997package to expose as a service.
13998@end deffn
13999
14000@deffn {Scheme Procedure} polkit-service @
14001 [#:polkit @var{polkit}] Return a service that runs the
14002@uref{http://www.freedesktop.org/wiki/Software/polkit/, Polkit privilege
14003management service}, which allows system administrators to grant access to
14004privileged operations in a structured way. By querying the Polkit service,
14005a privileged system component can know when it should grant additional
14006capabilities to ordinary users. For example, an ordinary user can be
14007granted the capability to suspend the system if the user is logged in
14008locally.
14009@end deffn
14010
14011@deffn {Scheme Procedure} upower-service [#:upower @var{upower}] @
14012 [#:watts-up-pro? #f] @ [#:poll-batteries? #t] @ [#:ignore-lid? #f] @
14013[#:use-percentage-for-policy? #f] @ [#:percentage-low 10] @
14014[#:percentage-critical 3] @ [#:percentage-action 2] @ [#:time-low 1200] @
14015[#:time-critical 300] @ [#:time-action 120] @ [#:critical-power-action
14016'hybrid-sleep] Return a service that runs
14017@uref{http://upower.freedesktop.org/, @command{upowerd}}, a system-wide
14018monitor for power consumption and battery levels, with the given
14019configuration settings. It implements the @code{org.freedesktop.UPower}
14020D-Bus interface, and is notably used by GNOME.
14021@end deffn
14022
14023@deffn {Scheme Procedure} udisks-service [#:udisks @var{udisks}]
14024Return a service for @uref{http://udisks.freedesktop.org/docs/latest/,
14025UDisks}, a @dfn{disk management} daemon that provides user interfaces with
14026notifications and ways to mount/unmount disks. Programs that talk to UDisks
14027include the @command{udisksctl} command, part of UDisks, and GNOME Disks.
14028@end deffn
14029
14030@deffn {Scheme Procedure} colord-service [#:colord @var{colord}]
14031Return a service that runs @command{colord}, a system service with a D-Bus
14032interface to manage the color profiles of input and output devices such as
14033screens and scanners. It is notably used by the GNOME Color Manager
14034graphical tool. See @uref{http://www.freedesktop.org/software/colord/, the
14035colord web site} for more information.
14036@end deffn
14037
14038@deffn {Scheme Procedure} geoclue-application name [#:allowed? #t] [#:system? #f] [#:users '()]
14039Return a configuration allowing an application to access GeoClue location
14040data. @var{name} is the Desktop ID of the application, without the
14041@code{.desktop} part. If @var{allowed?} is true, the application will have
14042access to location information by default. The boolean @var{system?} value
14043indicates whether an application is a system component or not. Finally
14044@var{users} is a list of UIDs of all users for which this application is
14045allowed location info access. An empty users list means that all users are
14046allowed.
14047@end deffn
14048
14049@defvr {Scheme Variable} %standard-geoclue-applications
14050The standard list of well-known GeoClue application configurations, granting
14051authority to the GNOME date-and-time utility to ask for the current location
14052in order to set the time zone, and allowing the IceCat and Epiphany web
14053browsers to request location information. IceCat and Epiphany both query
14054the user before allowing a web page to know the user's location.
14055@end defvr
14056
14057@deffn {Scheme Procedure} geoclue-service [#:colord @var{colord}] @
14058 [#:whitelist '()] @ [#:wifi-geolocation-url
14059"https://location.services.mozilla.com/v1/geolocate?key=geoclue"] @
14060[#:submit-data? #f] [#:wifi-submission-url
14061"https://location.services.mozilla.com/v1/submit?key=geoclue"] @
14062[#:submission-nick "geoclue"] @ [#:applications
14063%standard-geoclue-applications] Return a service that runs the GeoClue
14064location service. This service provides a D-Bus interface to allow
14065applications to request access to a user's physical location, and optionally
14066to add information to online location databases. See
14067@uref{https://wiki.freedesktop.org/www/Software/GeoClue/, the GeoClue web
14068site} for more information.
14069@end deffn
14070
14071@deffn {Scheme Procedure} bluetooth-service [#:bluez @var{bluez}] @
14072 [@w{#:auto-enable? #f}] Return a service that runs the @command{bluetoothd}
14073daemon, which manages all the Bluetooth devices and provides a number of
14074D-Bus interfaces. When AUTO-ENABLE? is true, the bluetooth controller is
14075powered automatically at boot, which can be useful when using a bluetooth
14076keyboard or mouse.
14077
14078Users need to be in the @code{lp} group to access the D-Bus service.
14079@end deffn
14080
793dcd8c
LC
14081@node Sound Services
14082@subsubsection Sound Services
1e40e70b
JL
14083
14084@cindex sound support
14085@cindex ALSA
14086@cindex PulseAudio, sound support
14087
14088The @code{(gnu services sound)} module provides a service to configure the
793dcd8c 14089Advanced Linux Sound Architecture (ALSA) system, which makes PulseAudio the
1e40e70b
JL
14090preferred ALSA output driver.
14091
14092@deffn {Scheme Variable} alsa-service-type
14093This is the type for the @uref{https://alsa-project.org/, Advanced Linux
14094Sound Architecture} (ALSA) system, which generates the
14095@file{/etc/asound.conf} configuration file. The value for this type is a
14096@command{alsa-configuration} record as in this example:
14097
14098@example
14099(service alsa-service-type)
14100@end example
14101
14102See below for details about @code{alsa-configuration}.
14103@end deffn
14104
14105@deftp {Data Type} alsa-configuration
14106Data type representing the configuration for @code{alsa-service}.
14107
14108@table @asis
14109@item @code{alsa-plugins} (default: @var{alsa-plugins})
14110@code{alsa-plugins} package to use.
14111
14112@item @code{pulseaudio?} (default: @var{#t})
14113Whether ALSA applications should transparently be made to use the
14114@uref{http://www.pulseaudio.org/, PulseAudio} sound server.
14115
14116Using PulseAudio allows you to run several sound-producing applications at
14117the same time and to individual control them @i{via} @command{pavucontrol},
14118among other things.
14119
14120@item @code{extra-options} (default: @var{""})
14121String to append to the @file{/etc/asound.conf} file.
14122
14123@end table
14124@end deftp
14125
14126Individual users who want to override the system configuration of ALSA can
14127do it with the @file{~/.asoundrc} file:
14128
14129@example
14130# In guix, we have to specify the absolute path for plugins.
14131pcm_type.jack @{
14132 lib "/home/alice/.guix-profile/lib/alsa-lib/libasound_module_pcm_jack.so"
14133@}
14134
14135# Routing ALSA to jack:
14136# <http://jackaudio.org/faq/routing_alsa.html>.
14137pcm.rawjack @{
14138 type jack
14139 playback_ports @{
14140 0 system:playback_1
14141 1 system:playback_2
14142 @}
14143
14144 capture_ports @{
14145 0 system:capture_1
14146 1 system:capture_2
14147 @}
14148@}
14149
14150pcm.!default @{
14151 type plug
14152 slave @{
14153 pcm "rawjack"
14154 @}
14155@}
14156@end example
14157
14158See @uref{https://www.alsa-project.org/main/index.php/Asoundrc} for the
14159details.
14160
14161
14162@node Datenbankdienste
14163@subsubsection Datenbankdienste
14164
14165@cindex database
14166@cindex SQL
14167The @code{(gnu services databases)} module provides the following services.
14168
14169@deffn {Scheme Procedure} postgresql-service [#:postgresql postgresql] @
14170 [#:config-file] [#:data-directory ``/var/lib/postgresql/data''] @ [#:port
141715432] [#:locale ``en_US.utf8''] Return a service that runs @var{postgresql},
14172the PostgreSQL database server.
14173
14174The PostgreSQL daemon loads its runtime configuration from
14175@var{config-file}, creates a database cluster with @var{locale} as the
14176default locale, stored in @var{data-directory}. It then listens on
14177@var{port}.
14178@end deffn
14179
14180@deffn {Scheme Procedure} mysql-service [#:config (mysql-configuration)]
14181Return a service that runs @command{mysqld}, the MySQL or MariaDB database
14182server.
14183
14184The optional @var{config} argument specifies the configuration for
14185@command{mysqld}, which should be a @code{<mysql-configuration>} object.
14186@end deffn
14187
14188@deftp {Data Type} mysql-configuration
14189Data type representing the configuration of @var{mysql-service}.
14190
14191@table @asis
14192@item @code{mysql} (default: @var{mariadb})
14193Package object of the MySQL database server, can be either @var{mariadb} or
14194@var{mysql}.
14195
14196For MySQL, a temporary root password will be displayed at activation time.
14197For MariaDB, the root password is empty.
14198
14199@item @code{port} (default: @code{3306})
14200TCP port on which the database server listens for incoming connections.
14201@end table
14202@end deftp
14203
14204@defvr {Scheme Variable} memcached-service-type
14205This is the service type for the @uref{https://memcached.org/, Memcached}
14206service, which provides a distributed in memory cache. The value for the
14207service type is a @code{memcached-configuration} object.
14208@end defvr
14209
14210@example
14211(service memcached-service-type)
14212@end example
14213
14214@deftp {Data Type} memcached-configuration
14215Data type representing the configuration of memcached.
14216
14217@table @asis
14218@item @code{memcached} (default: @code{memcached})
14219The Memcached package to use.
14220
14221@item @code{interfaces} (default: @code{'("0.0.0.0")})
14222Network interfaces on which to listen.
14223
14224@item @code{tcp-port} (default: @code{11211})
14225Port on which to accept connections on,
14226
14227@item @code{udp-port} (default: @code{11211})
14228Port on which to accept UDP connections on, a value of 0 will disable
14229listening on a UDP socket.
14230
14231@item @code{additional-options} (default: @code{'()})
14232Additional command line options to pass to @code{memcached}.
14233@end table
14234@end deftp
14235
14236@defvr {Scheme Variable} mongodb-service-type
14237This is the service type for @uref{https://www.mongodb.com/, MongoDB}. The
14238value for the service type is a @code{mongodb-configuration} object.
14239@end defvr
14240
14241@example
14242(service mongodb-service-type)
14243@end example
14244
14245@deftp {Data Type} mongodb-configuration
14246Data type representing the configuration of mongodb.
14247
14248@table @asis
14249@item @code{mongodb} (default: @code{mongodb})
14250The MongoDB package to use.
14251
14252@item @code{config-file} (default: @code{%default-mongodb-configuration-file})
14253The configuration file for MongoDB.
14254
14255@item @code{data-directory} (default: @code{"/var/lib/mongodb"})
14256This value is used to create the directory, so that it exists and is owned
14257by the mongodb user. It should match the data-directory which MongoDB is
14258configured to use through the configuration file.
14259@end table
14260@end deftp
14261
14262@defvr {Scheme Variable} redis-service-type
14263This is the service type for the @uref{https://redis.io/, Redis} key/value
14264store, whose value is a @code{redis-configuration} object.
14265@end defvr
14266
14267@deftp {Data Type} redis-configuration
14268Data type representing the configuration of redis.
14269
14270@table @asis
14271@item @code{redis} (default: @code{redis})
14272The Redis package to use.
14273
14274@item @code{bind} (default: @code{"127.0.0.1"})
14275Network interface on which to listen.
14276
14277@item @code{port} (default: @code{6379})
14278Port on which to accept connections on, a value of 0 will disable listening
14279on a TCP socket.
14280
14281@item @code{working-directory} (default: @code{"/var/lib/redis"})
14282Directory in which to store the database and related files.
14283@end table
14284@end deftp
14285
14286@node Mail-Dienste
14287@subsubsection Mail-Dienste
14288
14289@cindex mail
14290@cindex email
14291The @code{(gnu services mail)} module provides Guix service definitions for
14292email services: IMAP, POP3, and LMTP servers, as well as mail transport
14293agents (MTAs). Lots of acronyms! These services are detailed in the
14294subsections below.
14295
14296@subsubheading Dovecot Service
14297
14298@deffn {Scheme Procedure} dovecot-service [#:config (dovecot-configuration)]
14299Return a service that runs the Dovecot IMAP/POP3/LMTP mail server.
14300@end deffn
14301
14302By default, Dovecot does not need much configuration; the default
14303configuration object created by @code{(dovecot-configuration)} will suffice
14304if your mail is delivered to @code{~/Maildir}. A self-signed certificate
14305will be generated for TLS-protected connections, though Dovecot will also
14306listen on cleartext ports by default. There are a number of options,
14307though, which mail administrators might need to change, and as is the case
14308with other services, Guix allows the system administrator to specify these
14309parameters via a uniform Scheme interface.
14310
14311For example, to specify that mail is located at @code{maildir~/.mail}, one
14312would instantiate the Dovecot service like this:
14313
14314@example
14315(dovecot-service #:config
14316 (dovecot-configuration
14317 (mail-location "maildir:~/.mail")))
14318@end example
14319
14320The available configuration parameters follow. Each parameter definition is
14321preceded by its type; for example, @samp{string-list foo} indicates that the
14322@code{foo} parameter should be specified as a list of strings. There is
14323also a way to specify the configuration as a string, if you have an old
14324@code{dovecot.conf} file that you want to port over from some other system;
14325see the end for more details.
14326
14327@c The following documentation was initially generated by
14328@c (generate-documentation) in (gnu services mail). Manually maintained
14329@c documentation is better, so we shouldn't hesitate to edit below as
14330@c needed. However if the change you want to make to this documentation
14331@c can be done in an automated way, it's probably easier to change
14332@c (generate-documentation) than to make it below and have to deal with
14333@c the churn as dovecot updates.
14334
14335Available @code{dovecot-configuration} fields are:
14336
14337@deftypevr {@code{dovecot-configuration} parameter} package dovecot
14338The dovecot package.
14339@end deftypevr
14340
14341@deftypevr {@code{dovecot-configuration} parameter} comma-separated-string-list listen
14342A list of IPs or hosts where to listen for connections. @samp{*} listens on
14343all IPv4 interfaces, @samp{::} listens on all IPv6 interfaces. If you want
14344to specify non-default ports or anything more complex, customize the address
14345and port fields of the @samp{inet-listener} of the specific services you are
14346interested in.
14347@end deftypevr
14348
14349@deftypevr {@code{dovecot-configuration} parameter} protocol-configuration-list protocols
14350List of protocols we want to serve. Available protocols include
14351@samp{imap}, @samp{pop3}, and @samp{lmtp}.
14352
14353Available @code{protocol-configuration} fields are:
14354
14355@deftypevr {@code{protocol-configuration} parameter} string name
14356The name of the protocol.
14357@end deftypevr
14358
14359@deftypevr {@code{protocol-configuration} parameter} string auth-socket-path
14360UNIX socket path to the master authentication server to find users. This is
14361used by imap (for shared users) and lda. It defaults to
14362@samp{"/var/run/dovecot/auth-userdb"}.
14363@end deftypevr
14364
14365@deftypevr {@code{protocol-configuration} parameter} space-separated-string-list mail-plugins
14366Space separated list of plugins to load.
14367@end deftypevr
14368
14369@deftypevr {@code{protocol-configuration} parameter} non-negative-integer mail-max-userip-connections
14370Maximum number of IMAP connections allowed for a user from each IP address.
14371NOTE: The username is compared case-sensitively. Defaults to @samp{10}.
14372@end deftypevr
14373
14374@end deftypevr
14375
14376@deftypevr {@code{dovecot-configuration} parameter} service-configuration-list services
14377List of services to enable. Available services include @samp{imap},
14378@samp{imap-login}, @samp{pop3}, @samp{pop3-login}, @samp{auth}, and
14379@samp{lmtp}.
14380
14381Available @code{service-configuration} fields are:
14382
14383@deftypevr {@code{service-configuration} parameter} string kind
14384The service kind. Valid values include @code{director}, @code{imap-login},
14385@code{pop3-login}, @code{lmtp}, @code{imap}, @code{pop3}, @code{auth},
14386@code{auth-worker}, @code{dict}, @code{tcpwrap}, @code{quota-warning}, or
14387anything else.
14388@end deftypevr
14389
14390@deftypevr {@code{service-configuration} parameter} listener-configuration-list listeners
14391Listeners for the service. A listener is either a
14392@code{unix-listener-configuration}, a @code{fifo-listener-configuration}, or
14393an @code{inet-listener-configuration}. Defaults to @samp{()}.
14394
14395Available @code{unix-listener-configuration} fields are:
14396
14397@deftypevr {@code{unix-listener-configuration} parameter} string path
14398Path to the file, relative to @code{base-dir} field. This is also used as
14399the section name.
14400@end deftypevr
14401
14402@deftypevr {@code{unix-listener-configuration} parameter} string mode
14403The access mode for the socket. Defaults to @samp{"0600"}.
14404@end deftypevr
14405
14406@deftypevr {@code{unix-listener-configuration} parameter} string user
14407The user to own the socket. Defaults to @samp{""}.
14408@end deftypevr
14409
14410@deftypevr {@code{unix-listener-configuration} parameter} string group
14411The group to own the socket. Defaults to @samp{""}.
14412@end deftypevr
14413
14414
14415Available @code{fifo-listener-configuration} fields are:
14416
14417@deftypevr {@code{fifo-listener-configuration} parameter} string path
14418Path to the file, relative to @code{base-dir} field. This is also used as
14419the section name.
14420@end deftypevr
14421
14422@deftypevr {@code{fifo-listener-configuration} parameter} string mode
14423The access mode for the socket. Defaults to @samp{"0600"}.
14424@end deftypevr
14425
14426@deftypevr {@code{fifo-listener-configuration} parameter} string user
14427The user to own the socket. Defaults to @samp{""}.
14428@end deftypevr
14429
14430@deftypevr {@code{fifo-listener-configuration} parameter} string group
14431The group to own the socket. Defaults to @samp{""}.
14432@end deftypevr
14433
14434
14435Available @code{inet-listener-configuration} fields are:
14436
14437@deftypevr {@code{inet-listener-configuration} parameter} string protocol
14438The protocol to listen for.
14439@end deftypevr
14440
14441@deftypevr {@code{inet-listener-configuration} parameter} string address
14442The address on which to listen, or empty for all addresses. Defaults to
14443@samp{""}.
14444@end deftypevr
14445
14446@deftypevr {@code{inet-listener-configuration} parameter} non-negative-integer port
14447The port on which to listen.
14448@end deftypevr
14449
14450@deftypevr {@code{inet-listener-configuration} parameter} boolean ssl?
14451Whether to use SSL for this service; @samp{yes}, @samp{no}, or
14452@samp{required}. Defaults to @samp{#t}.
14453@end deftypevr
14454
14455@end deftypevr
14456
793dcd8c
LC
14457@deftypevr {@code{service-configuration} parameter} non-negative-integer client-limit
14458Maximum number of simultaneous client connections per process. Once this
14459number of connections is received, the next incoming connection will prompt
14460Dovecot to spawn another process. If set to 0, @code{default-client-limit}
14461is used instead.
14462
14463Defaults to @samp{0}.
14464
14465@end deftypevr
14466
1e40e70b
JL
14467@deftypevr {@code{service-configuration} parameter} non-negative-integer service-count
14468Number of connections to handle before starting a new process. Typically
14469the only useful values are 0 (unlimited) or 1. 1 is more secure, but 0 is
14470faster. <doc/wiki/LoginProcess.txt>. Defaults to @samp{1}.
793dcd8c
LC
14471
14472@end deftypevr
14473
14474@deftypevr {@code{service-configuration} parameter} non-negative-integer process-limit
14475Maximum number of processes that can exist for this service. If set to 0,
14476@code{default-process-limit} is used instead.
14477
14478Defaults to @samp{0}.
14479
1e40e70b
JL
14480@end deftypevr
14481
14482@deftypevr {@code{service-configuration} parameter} non-negative-integer process-min-avail
14483Number of processes to always keep waiting for more connections. Defaults
14484to @samp{0}.
14485@end deftypevr
14486
14487@deftypevr {@code{service-configuration} parameter} non-negative-integer vsz-limit
14488If you set @samp{service-count 0}, you probably need to grow this. Defaults
14489to @samp{256000000}.
14490@end deftypevr
14491
14492@end deftypevr
14493
14494@deftypevr {@code{dovecot-configuration} parameter} dict-configuration dict
14495Dict configuration, as created by the @code{dict-configuration} constructor.
14496
14497Available @code{dict-configuration} fields are:
14498
14499@deftypevr {@code{dict-configuration} parameter} free-form-fields entries
14500A list of key-value pairs that this dict should hold. Defaults to
14501@samp{()}.
14502@end deftypevr
14503
14504@end deftypevr
14505
14506@deftypevr {@code{dovecot-configuration} parameter} passdb-configuration-list passdbs
14507A list of passdb configurations, each one created by the
14508@code{passdb-configuration} constructor.
14509
14510Available @code{passdb-configuration} fields are:
14511
14512@deftypevr {@code{passdb-configuration} parameter} string driver
14513The driver that the passdb should use. Valid values include @samp{pam},
14514@samp{passwd}, @samp{shadow}, @samp{bsdauth}, and @samp{static}. Defaults
14515to @samp{"pam"}.
14516@end deftypevr
14517
14518@deftypevr {@code{passdb-configuration} parameter} space-separated-string-list args
14519Space separated list of arguments to the passdb driver. Defaults to
14520@samp{""}.
14521@end deftypevr
14522
14523@end deftypevr
14524
14525@deftypevr {@code{dovecot-configuration} parameter} userdb-configuration-list userdbs
14526List of userdb configurations, each one created by the
14527@code{userdb-configuration} constructor.
14528
14529Available @code{userdb-configuration} fields are:
14530
14531@deftypevr {@code{userdb-configuration} parameter} string driver
14532The driver that the userdb should use. Valid values include @samp{passwd}
14533and @samp{static}. Defaults to @samp{"passwd"}.
14534@end deftypevr
14535
14536@deftypevr {@code{userdb-configuration} parameter} space-separated-string-list args
14537Space separated list of arguments to the userdb driver. Defaults to
14538@samp{""}.
14539@end deftypevr
14540
14541@deftypevr {@code{userdb-configuration} parameter} free-form-args override-fields
14542Override fields from passwd. Defaults to @samp{()}.
14543@end deftypevr
14544
14545@end deftypevr
14546
14547@deftypevr {@code{dovecot-configuration} parameter} plugin-configuration plugin-configuration
14548Plug-in configuration, created by the @code{plugin-configuration}
14549constructor.
14550@end deftypevr
14551
14552@deftypevr {@code{dovecot-configuration} parameter} list-of-namespace-configuration namespaces
14553List of namespaces. Each item in the list is created by the
14554@code{namespace-configuration} constructor.
14555
14556Available @code{namespace-configuration} fields are:
14557
14558@deftypevr {@code{namespace-configuration} parameter} string name
14559Name for this namespace.
14560@end deftypevr
14561
14562@deftypevr {@code{namespace-configuration} parameter} string type
14563Namespace type: @samp{private}, @samp{shared} or @samp{public}. Defaults to
14564@samp{"private"}.
14565@end deftypevr
14566
14567@deftypevr {@code{namespace-configuration} parameter} string separator
14568Hierarchy separator to use. You should use the same separator for all
14569namespaces or some clients get confused. @samp{/} is usually a good one.
14570The default however depends on the underlying mail storage format. Defaults
14571to @samp{""}.
14572@end deftypevr
14573
14574@deftypevr {@code{namespace-configuration} parameter} string prefix
14575Prefix required to access this namespace. This needs to be different for
14576all namespaces. For example @samp{Public/}. Defaults to @samp{""}.
14577@end deftypevr
14578
14579@deftypevr {@code{namespace-configuration} parameter} string location
14580Physical location of the mailbox. This is in the same format as
14581mail_location, which is also the default for it. Defaults to @samp{""}.
14582@end deftypevr
14583
14584@deftypevr {@code{namespace-configuration} parameter} boolean inbox?
14585There can be only one INBOX, and this setting defines which namespace has
14586it. Defaults to @samp{#f}.
14587@end deftypevr
14588
14589@deftypevr {@code{namespace-configuration} parameter} boolean hidden?
14590If namespace is hidden, it's not advertised to clients via NAMESPACE
14591extension. You'll most likely also want to set @samp{list? #f}. This is
14592mostly useful when converting from another server with different namespaces
14593which you want to deprecate but still keep working. For example you can
14594create hidden namespaces with prefixes @samp{~/mail/}, @samp{~%u/mail/} and
14595@samp{mail/}. Defaults to @samp{#f}.
14596@end deftypevr
14597
14598@deftypevr {@code{namespace-configuration} parameter} boolean list?
14599Show the mailboxes under this namespace with the LIST command. This makes
14600the namespace visible for clients that do not support the NAMESPACE
14601extension. The special @code{children} value lists child mailboxes, but
14602hides the namespace prefix. Defaults to @samp{#t}.
14603@end deftypevr
14604
14605@deftypevr {@code{namespace-configuration} parameter} boolean subscriptions?
14606Namespace handles its own subscriptions. If set to @code{#f}, the parent
14607namespace handles them. The empty prefix should always have this as
14608@code{#t}). Defaults to @samp{#t}.
14609@end deftypevr
14610
14611@deftypevr {@code{namespace-configuration} parameter} mailbox-configuration-list mailboxes
14612List of predefined mailboxes in this namespace. Defaults to @samp{()}.
14613
14614Available @code{mailbox-configuration} fields are:
14615
14616@deftypevr {@code{mailbox-configuration} parameter} string name
14617Name for this mailbox.
14618@end deftypevr
14619
14620@deftypevr {@code{mailbox-configuration} parameter} string auto
14621@samp{create} will automatically create this mailbox. @samp{subscribe} will
14622both create and subscribe to the mailbox. Defaults to @samp{"no"}.
14623@end deftypevr
14624
14625@deftypevr {@code{mailbox-configuration} parameter} space-separated-string-list special-use
14626List of IMAP @code{SPECIAL-USE} attributes as specified by RFC 6154. Valid
14627values are @code{\All}, @code{\Archive}, @code{\Drafts}, @code{\Flagged},
14628@code{\Junk}, @code{\Sent}, and @code{\Trash}. Defaults to @samp{()}.
14629@end deftypevr
14630
14631@end deftypevr
14632
14633@end deftypevr
14634
14635@deftypevr {@code{dovecot-configuration} parameter} file-name base-dir
14636Base directory where to store runtime data. Defaults to
14637@samp{"/var/run/dovecot/"}.
14638@end deftypevr
14639
14640@deftypevr {@code{dovecot-configuration} parameter} string login-greeting
14641Greeting message for clients. Defaults to @samp{"Dovecot ready."}.
14642@end deftypevr
14643
14644@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list login-trusted-networks
14645List of trusted network ranges. Connections from these IPs are allowed to
14646override their IP addresses and ports (for logging and for authentication
14647checks). @samp{disable-plaintext-auth} is also ignored for these networks.
14648Typically you would specify your IMAP proxy servers here. Defaults to
14649@samp{()}.
14650@end deftypevr
14651
14652@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list login-access-sockets
793dcd8c 14653List of login access check sockets (e.g.@: tcpwrap). Defaults to @samp{()}.
1e40e70b
JL
14654@end deftypevr
14655
14656@deftypevr {@code{dovecot-configuration} parameter} boolean verbose-proctitle?
14657Show more verbose process titles (in ps). Currently shows user name and IP
793dcd8c
LC
14658address. Useful for seeing who is actually using the IMAP processes (e.g.@:
14659shared mailboxes or if the same uid is used for multiple accounts).
1e40e70b
JL
14660Defaults to @samp{#f}.
14661@end deftypevr
14662
14663@deftypevr {@code{dovecot-configuration} parameter} boolean shutdown-clients?
14664Should all processes be killed when Dovecot master process shuts down.
14665Setting this to @code{#f} means that Dovecot can be upgraded without forcing
14666existing client connections to close (although that could also be a problem
793dcd8c 14667if the upgrade is e.g.@: due to a security fix). Defaults to @samp{#t}.
1e40e70b
JL
14668@end deftypevr
14669
14670@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer doveadm-worker-count
14671If non-zero, run mail commands via this many connections to doveadm server,
14672instead of running them directly in the same process. Defaults to @samp{0}.
14673@end deftypevr
14674
14675@deftypevr {@code{dovecot-configuration} parameter} string doveadm-socket-path
14676UNIX socket or host:port used for connecting to doveadm server. Defaults to
14677@samp{"doveadm-server"}.
14678@end deftypevr
14679
14680@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list import-environment
14681List of environment variables that are preserved on Dovecot startup and
14682passed down to all of its child processes. You can also give key=value
14683pairs to always set specific settings.
14684@end deftypevr
14685
14686@deftypevr {@code{dovecot-configuration} parameter} boolean disable-plaintext-auth?
14687Disable LOGIN command and all other plaintext authentications unless SSL/TLS
14688is used (LOGINDISABLED capability). Note that if the remote IP matches the
793dcd8c
LC
14689local IP (i.e.@: you're connecting from the same computer), the connection
14690is considered secure and plaintext authentication is allowed. See also
1e40e70b
JL
14691ssl=required setting. Defaults to @samp{#t}.
14692@end deftypevr
14693
14694@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer auth-cache-size
793dcd8c 14695Authentication cache size (e.g.@: @samp{#e10e6}). 0 means it's disabled.
1e40e70b
JL
14696Note that bsdauth, PAM and vpopmail require @samp{cache-key} to be set for
14697caching to be used. Defaults to @samp{0}.
14698@end deftypevr
14699
14700@deftypevr {@code{dovecot-configuration} parameter} string auth-cache-ttl
14701Time to live for cached data. After TTL expires the cached record is no
14702longer used, *except* if the main database lookup returns internal failure.
14703We also try to handle password changes automatically: If user's previous
14704authentication was successful, but this one wasn't, the cache isn't used.
14705For now this works only with plaintext authentication. Defaults to @samp{"1
14706hour"}.
14707@end deftypevr
14708
14709@deftypevr {@code{dovecot-configuration} parameter} string auth-cache-negative-ttl
14710TTL for negative hits (user not found, password mismatch). 0 disables
14711caching them completely. Defaults to @samp{"1 hour"}.
14712@end deftypevr
14713
14714@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list auth-realms
14715List of realms for SASL authentication mechanisms that need them. You can
14716leave it empty if you don't want to support multiple realms. Many clients
14717simply use the first one listed here, so keep the default realm first.
14718Defaults to @samp{()}.
14719@end deftypevr
14720
14721@deftypevr {@code{dovecot-configuration} parameter} string auth-default-realm
14722Default realm/domain to use if none was specified. This is used for both
14723SASL realms and appending @@domain to username in plaintext logins.
14724Defaults to @samp{""}.
14725@end deftypevr
14726
14727@deftypevr {@code{dovecot-configuration} parameter} string auth-username-chars
14728List of allowed characters in username. If the user-given username contains
14729a character not listed in here, the login automatically fails. This is just
14730an extra check to make sure user can't exploit any potential quote escaping
14731vulnerabilities with SQL/LDAP databases. If you want to allow all
14732characters, set this value to empty. Defaults to
14733@samp{"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@@"}.
14734@end deftypevr
14735
14736@deftypevr {@code{dovecot-configuration} parameter} string auth-username-translation
14737Username character translations before it's looked up from databases. The
14738value contains series of from -> to characters. For example @samp{#@@/@@}
14739means that @samp{#} and @samp{/} characters are translated to @samp{@@}.
14740Defaults to @samp{""}.
14741@end deftypevr
14742
14743@deftypevr {@code{dovecot-configuration} parameter} string auth-username-format
14744Username formatting before it's looked up from databases. You can use the
793dcd8c 14745standard variables here, e.g.@: %Lu would lowercase the username, %n would
1e40e70b
JL
14746drop away the domain if it was given, or @samp{%n-AT-%d} would change the
14747@samp{@@} into @samp{-AT-}. This translation is done after
14748@samp{auth-username-translation} changes. Defaults to @samp{"%Lu"}.
14749@end deftypevr
14750
14751@deftypevr {@code{dovecot-configuration} parameter} string auth-master-user-separator
14752If you want to allow master users to log in by specifying the master
793dcd8c
LC
14753username within the normal username string (i.e.@: not using SASL
14754mechanism's support for it), you can specify the separator character here.
14755The format is then <username><separator><master username>. UW-IMAP uses
14756@samp{*} as the separator, so that could be a good choice. Defaults to
14757@samp{""}.
1e40e70b
JL
14758@end deftypevr
14759
14760@deftypevr {@code{dovecot-configuration} parameter} string auth-anonymous-username
14761Username to use for users logging in with ANONYMOUS SASL mechanism.
14762Defaults to @samp{"anonymous"}.
14763@end deftypevr
14764
14765@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer auth-worker-max-count
14766Maximum number of dovecot-auth worker processes. They're used to execute
793dcd8c 14767blocking passdb and userdb queries (e.g.@: MySQL and PAM). They're
1e40e70b
JL
14768automatically created and destroyed as needed. Defaults to @samp{30}.
14769@end deftypevr
14770
14771@deftypevr {@code{dovecot-configuration} parameter} string auth-gssapi-hostname
14772Host name to use in GSSAPI principal names. The default is to use the name
14773returned by gethostname(). Use @samp{$ALL} (with quotes) to allow all
14774keytab entries. Defaults to @samp{""}.
14775@end deftypevr
14776
14777@deftypevr {@code{dovecot-configuration} parameter} string auth-krb5-keytab
14778Kerberos keytab to use for the GSSAPI mechanism. Will use the system
14779default (usually @file{/etc/krb5.keytab}) if not specified. You may need to
14780change the auth service to run as root to be able to read this file.
14781Defaults to @samp{""}.
14782@end deftypevr
14783
14784@deftypevr {@code{dovecot-configuration} parameter} boolean auth-use-winbind?
14785Do NTLM and GSS-SPNEGO authentication using Samba's winbind daemon and
14786@samp{ntlm-auth} helper. <doc/wiki/Authentication/Mechanisms/Winbind.txt>.
14787Defaults to @samp{#f}.
14788@end deftypevr
14789
14790@deftypevr {@code{dovecot-configuration} parameter} file-name auth-winbind-helper-path
14791Path for Samba's @samp{ntlm-auth} helper binary. Defaults to
14792@samp{"/usr/bin/ntlm_auth"}.
14793@end deftypevr
14794
14795@deftypevr {@code{dovecot-configuration} parameter} string auth-failure-delay
14796Time to delay before replying to failed authentications. Defaults to
14797@samp{"2 secs"}.
14798@end deftypevr
14799
14800@deftypevr {@code{dovecot-configuration} parameter} boolean auth-ssl-require-client-cert?
14801Require a valid SSL client certificate or the authentication fails.
14802Defaults to @samp{#f}.
14803@end deftypevr
14804
14805@deftypevr {@code{dovecot-configuration} parameter} boolean auth-ssl-username-from-cert?
14806Take the username from client's SSL certificate, using
14807@code{X509_NAME_get_text_by_NID()} which returns the subject's DN's
14808CommonName. Defaults to @samp{#f}.
14809@end deftypevr
14810
14811@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list auth-mechanisms
14812List of wanted authentication mechanisms. Supported mechanisms are:
14813@samp{plain}, @samp{login}, @samp{digest-md5}, @samp{cram-md5}, @samp{ntlm},
14814@samp{rpa}, @samp{apop}, @samp{anonymous}, @samp{gssapi}, @samp{otp},
14815@samp{skey}, and @samp{gss-spnego}. NOTE: See also
14816@samp{disable-plaintext-auth} setting.
14817@end deftypevr
14818
14819@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list director-servers
14820List of IPs or hostnames to all director servers, including ourself. Ports
14821can be specified as ip:port. The default port is the same as what director
14822service's @samp{inet-listener} is using. Defaults to @samp{()}.
14823@end deftypevr
14824
14825@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list director-mail-servers
14826List of IPs or hostnames to all backend mail servers. Ranges are allowed
14827too, like 10.0.0.10-10.0.0.30. Defaults to @samp{()}.
14828@end deftypevr
14829
14830@deftypevr {@code{dovecot-configuration} parameter} string director-user-expire
14831How long to redirect users to a specific server after it no longer has any
14832connections. Defaults to @samp{"15 min"}.
14833@end deftypevr
14834
14835@deftypevr {@code{dovecot-configuration} parameter} string director-username-hash
14836How the username is translated before being hashed. Useful values include
14837%Ln if user can log in with or without @@domain, %Ld if mailboxes are shared
14838within domain. Defaults to @samp{"%Lu"}.
14839@end deftypevr
14840
14841@deftypevr {@code{dovecot-configuration} parameter} string log-path
14842Log file to use for error messages. @samp{syslog} logs to syslog,
14843@samp{/dev/stderr} logs to stderr. Defaults to @samp{"syslog"}.
14844@end deftypevr
14845
14846@deftypevr {@code{dovecot-configuration} parameter} string info-log-path
14847Log file to use for informational messages. Defaults to @samp{log-path}.
14848Defaults to @samp{""}.
14849@end deftypevr
14850
14851@deftypevr {@code{dovecot-configuration} parameter} string debug-log-path
14852Log file to use for debug messages. Defaults to @samp{info-log-path}.
14853Defaults to @samp{""}.
14854@end deftypevr
14855
14856@deftypevr {@code{dovecot-configuration} parameter} string syslog-facility
14857Syslog facility to use if you're logging to syslog. Usually if you don't
14858want to use @samp{mail}, you'll use local0..local7. Also other standard
14859facilities are supported. Defaults to @samp{"mail"}.
14860@end deftypevr
14861
14862@deftypevr {@code{dovecot-configuration} parameter} boolean auth-verbose?
14863Log unsuccessful authentication attempts and the reasons why they failed.
14864Defaults to @samp{#f}.
14865@end deftypevr
14866
14867@deftypevr {@code{dovecot-configuration} parameter} boolean auth-verbose-passwords?
14868In case of password mismatches, log the attempted password. Valid values
14869are no, plain and sha1. sha1 can be useful for detecting brute force
14870password attempts vs. user simply trying the same password over and over
793dcd8c
LC
14871again. You can also truncate the value to n chars by appending ":n" (e.g.@:
14872sha1:6). Defaults to @samp{#f}.
1e40e70b
JL
14873@end deftypevr
14874
14875@deftypevr {@code{dovecot-configuration} parameter} boolean auth-debug?
14876Even more verbose logging for debugging purposes. Shows for example SQL
14877queries. Defaults to @samp{#f}.
14878@end deftypevr
14879
14880@deftypevr {@code{dovecot-configuration} parameter} boolean auth-debug-passwords?
14881In case of password mismatches, log the passwords and used scheme so the
14882problem can be debugged. Enabling this also enables @samp{auth-debug}.
14883Defaults to @samp{#f}.
14884@end deftypevr
14885
14886@deftypevr {@code{dovecot-configuration} parameter} boolean mail-debug?
14887Enable mail process debugging. This can help you figure out why Dovecot
14888isn't finding your mails. Defaults to @samp{#f}.
14889@end deftypevr
14890
14891@deftypevr {@code{dovecot-configuration} parameter} boolean verbose-ssl?
14892Show protocol level SSL errors. Defaults to @samp{#f}.
14893@end deftypevr
14894
14895@deftypevr {@code{dovecot-configuration} parameter} string log-timestamp
14896Prefix for each line written to log file. % codes are in strftime(3)
14897format. Defaults to @samp{"\"%b %d %H:%M:%S \""}.
14898@end deftypevr
14899
14900@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list login-log-format-elements
14901List of elements we want to log. The elements which have a non-empty
14902variable value are joined together to form a comma-separated string.
14903@end deftypevr
14904
14905@deftypevr {@code{dovecot-configuration} parameter} string login-log-format
14906Login log format. %s contains @samp{login-log-format-elements} string, %$
14907contains the data we want to log. Defaults to @samp{"%$: %s"}.
14908@end deftypevr
14909
14910@deftypevr {@code{dovecot-configuration} parameter} string mail-log-prefix
14911Log prefix for mail processes. See doc/wiki/Variables.txt for list of
14912possible variables you can use. Defaults to
14913@samp{"\"%s(%u)<%@{pid@}><%@{session@}>: \""}.
14914@end deftypevr
14915
14916@deftypevr {@code{dovecot-configuration} parameter} string deliver-log-format
14917Format to use for logging mail deliveries. You can use variables:
14918@table @code
14919@item %$
793dcd8c 14920Delivery status message (e.g.@: @samp{saved to INBOX})
1e40e70b
JL
14921@item %m
14922Message-ID
14923@item %s
14924Subject
14925@item %f
14926From address
14927@item %p
14928Physical size
14929@item %w
14930Virtual size.
14931@end table
14932Defaults to @samp{"msgid=%m: %$"}.
14933@end deftypevr
14934
14935@deftypevr {@code{dovecot-configuration} parameter} string mail-location
14936Location for users' mailboxes. The default is empty, which means that
14937Dovecot tries to find the mailboxes automatically. This won't work if the
14938user doesn't yet have any mail, so you should explicitly tell Dovecot the
14939full location.
14940
793dcd8c 14941If you're using mbox, giving a path to the INBOX file (e.g.@: /var/mail/%u)
1e40e70b
JL
14942isn't enough. You'll also need to tell Dovecot where the other mailboxes
14943are kept. This is called the "root mail directory", and it must be the
14944first path given in the @samp{mail-location} setting.
14945
14946There are a few special variables you can use, eg.:
14947
14948@table @samp
14949@item %u
14950username
14951@item %n
14952user part in user@@domain, same as %u if there's no domain
14953@item %d
14954domain part in user@@domain, empty if there's no domain
14955@item %h
14956home director
14957@end table
14958
14959See doc/wiki/Variables.txt for full list. Some examples:
14960@table @samp
14961@item maildir:~/Maildir
14962@item mbox:~/mail:INBOX=/var/mail/%u
14963@item mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%
14964@end table
14965Defaults to @samp{""}.
14966@end deftypevr
14967
14968@deftypevr {@code{dovecot-configuration} parameter} string mail-uid
14969System user and group used to access mails. If you use multiple, userdb can
14970override these by returning uid or gid fields. You can use either numbers
14971or names. <doc/wiki/UserIds.txt>. Defaults to @samp{""}.
14972@end deftypevr
14973
14974@deftypevr {@code{dovecot-configuration} parameter} string mail-gid
14975
14976Defaults to @samp{""}.
14977@end deftypevr
14978
14979@deftypevr {@code{dovecot-configuration} parameter} string mail-privileged-group
14980Group to enable temporarily for privileged operations. Currently this is
14981used only with INBOX when either its initial creation or dotlocking fails.
14982Typically this is set to "mail" to give access to /var/mail. Defaults to
14983@samp{""}.
14984@end deftypevr
14985
14986@deftypevr {@code{dovecot-configuration} parameter} string mail-access-groups
14987Grant access to these supplementary groups for mail processes. Typically
14988these are used to set up access to shared mailboxes. Note that it may be
793dcd8c
LC
14989dangerous to set these if users can create symlinks (e.g.@: if "mail" group
14990is set here, ln -s /var/mail ~/mail/var could allow a user to delete others'
1e40e70b
JL
14991mailboxes, or ln -s /secret/shared/box ~/mail/mybox would allow reading
14992it). Defaults to @samp{""}.
14993@end deftypevr
14994
14995@deftypevr {@code{dovecot-configuration} parameter} boolean mail-full-filesystem-access?
14996Allow full file system access to clients. There's no access checks other
14997than what the operating system does for the active UID/GID. It works with
793dcd8c
LC
14998both maildir and mboxes, allowing you to prefix mailboxes names with e.g.@:
14999/path/ or ~user/. Defaults to @samp{#f}.
1e40e70b
JL
15000@end deftypevr
15001
15002@deftypevr {@code{dovecot-configuration} parameter} boolean mmap-disable?
15003Don't use mmap() at all. This is required if you store indexes to shared
15004file systems (NFS or clustered file system). Defaults to @samp{#f}.
15005@end deftypevr
15006
15007@deftypevr {@code{dovecot-configuration} parameter} boolean dotlock-use-excl?
15008Rely on @samp{O_EXCL} to work when creating dotlock files. NFS supports
15009@samp{O_EXCL} since version 3, so this should be safe to use nowadays by
15010default. Defaults to @samp{#t}.
15011@end deftypevr
15012
15013@deftypevr {@code{dovecot-configuration} parameter} string mail-fsync
15014When to use fsync() or fdatasync() calls:
15015@table @code
15016@item optimized
15017Whenever necessary to avoid losing important data
15018@item always
793dcd8c 15019Useful with e.g.@: NFS when write()s are delayed
1e40e70b
JL
15020@item never
15021Never use it (best performance, but crashes can lose data).
15022@end table
15023Defaults to @samp{"optimized"}.
15024@end deftypevr
15025
15026@deftypevr {@code{dovecot-configuration} parameter} boolean mail-nfs-storage?
15027Mail storage exists in NFS. Set this to yes to make Dovecot flush NFS
15028caches whenever needed. If you're using only a single mail server this
15029isn't needed. Defaults to @samp{#f}.
15030@end deftypevr
15031
15032@deftypevr {@code{dovecot-configuration} parameter} boolean mail-nfs-index?
15033Mail index files also exist in NFS. Setting this to yes requires
15034@samp{mmap-disable? #t} and @samp{fsync-disable? #f}. Defaults to
15035@samp{#f}.
15036@end deftypevr
15037
15038@deftypevr {@code{dovecot-configuration} parameter} string lock-method
15039Locking method for index files. Alternatives are fcntl, flock and dotlock.
15040Dotlocking uses some tricks which may create more disk I/O than other
15041locking methods. NFS users: flock doesn't work, remember to change
15042@samp{mmap-disable}. Defaults to @samp{"fcntl"}.
15043@end deftypevr
15044
15045@deftypevr {@code{dovecot-configuration} parameter} file-name mail-temp-dir
15046Directory in which LDA/LMTP temporarily stores incoming mails >128 kB.
15047Defaults to @samp{"/tmp"}.
15048@end deftypevr
15049
15050@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer first-valid-uid
15051Valid UID range for users. This is mostly to make sure that users can't log
15052in as daemons or other system users. Note that denying root logins is
15053hardcoded to dovecot binary and can't be done even if @samp{first-valid-uid}
15054is set to 0. Defaults to @samp{500}.
15055@end deftypevr
15056
15057@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer last-valid-uid
15058
15059Defaults to @samp{0}.
15060@end deftypevr
15061
15062@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer first-valid-gid
15063Valid GID range for users. Users having non-valid GID as primary group ID
15064aren't allowed to log in. If user belongs to supplementary groups with
15065non-valid GIDs, those groups are not set. Defaults to @samp{1}.
15066@end deftypevr
15067
15068@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer last-valid-gid
15069
15070Defaults to @samp{0}.
15071@end deftypevr
15072
15073@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mail-max-keyword-length
15074Maximum allowed length for mail keyword name. It's only forced when trying
15075to create new keywords. Defaults to @samp{50}.
15076@end deftypevr
15077
15078@deftypevr {@code{dovecot-configuration} parameter} colon-separated-file-name-list valid-chroot-dirs
15079List of directories under which chrooting is allowed for mail processes
793dcd8c 15080(i.e.@: /var/mail will allow chrooting to /var/mail/foo/bar too). This
1e40e70b
JL
15081setting doesn't affect @samp{login-chroot} @samp{mail-chroot} or auth chroot
15082settings. If this setting is empty, "/./" in home dirs are ignored.
15083WARNING: Never add directories here which local users can modify, that may
15084lead to root exploit. Usually this should be done only if you don't allow
15085shell access for users. <doc/wiki/Chrooting.txt>. Defaults to @samp{()}.
15086@end deftypevr
15087
15088@deftypevr {@code{dovecot-configuration} parameter} string mail-chroot
15089Default chroot directory for mail processes. This can be overridden for
15090specific users in user database by giving /./ in user's home directory
793dcd8c
LC
15091(e.g.@: /home/./user chroots into /home). Note that usually there is no
15092real need to do chrooting, Dovecot doesn't allow users to access files
15093outside their mail directory anyway. If your home directories are prefixed
15094with the chroot directory, append "/."@: to @samp{mail-chroot}.
1e40e70b
JL
15095<doc/wiki/Chrooting.txt>. Defaults to @samp{""}.
15096@end deftypevr
15097
15098@deftypevr {@code{dovecot-configuration} parameter} file-name auth-socket-path
15099UNIX socket path to master authentication server to find users. This is
15100used by imap (for shared users) and lda. Defaults to
15101@samp{"/var/run/dovecot/auth-userdb"}.
15102@end deftypevr
15103
15104@deftypevr {@code{dovecot-configuration} parameter} file-name mail-plugin-dir
15105Directory where to look up mail plugins. Defaults to
15106@samp{"/usr/lib/dovecot"}.
15107@end deftypevr
15108
15109@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mail-plugins
15110List of plugins to load for all services. Plugins specific to IMAP, LDA,
793dcd8c 15111etc.@: are added to this list in their own .conf files. Defaults to
1e40e70b
JL
15112@samp{()}.
15113@end deftypevr
15114
15115@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mail-cache-min-mail-count
15116The minimum number of mails in a mailbox before updates are done to cache
15117file. This allows optimizing Dovecot's behavior to do less disk writes at
15118the cost of more disk reads. Defaults to @samp{0}.
15119@end deftypevr
15120
15121@deftypevr {@code{dovecot-configuration} parameter} string mailbox-idle-check-interval
15122When IDLE command is running, mailbox is checked once in a while to see if
15123there are any new mails or other changes. This setting defines the minimum
15124time to wait between those checks. Dovecot can also use dnotify, inotify
15125and kqueue to find out immediately when changes occur. Defaults to
15126@samp{"30 secs"}.
15127@end deftypevr
15128
15129@deftypevr {@code{dovecot-configuration} parameter} boolean mail-save-crlf?
15130Save mails with CR+LF instead of plain LF. This makes sending those mails
15131take less CPU, especially with sendfile() syscall with Linux and FreeBSD.
15132But it also creates a bit more disk I/O which may just make it slower. Also
15133note that if other software reads the mboxes/maildirs, they may handle the
15134extra CRs wrong and cause problems. Defaults to @samp{#f}.
15135@end deftypevr
15136
15137@deftypevr {@code{dovecot-configuration} parameter} boolean maildir-stat-dirs?
15138By default LIST command returns all entries in maildir beginning with a
15139dot. Enabling this option makes Dovecot return only entries which are
15140directories. This is done by stat()ing each entry, so it causes more disk
15141I/O. (For systems setting struct @samp{dirent->d_type} this check is free
15142and it's done always regardless of this setting). Defaults to @samp{#f}.
15143@end deftypevr
15144
15145@deftypevr {@code{dovecot-configuration} parameter} boolean maildir-copy-with-hardlinks?
15146When copying a message, do it with hard links whenever possible. This makes
15147the performance much better, and it's unlikely to have any side effects.
15148Defaults to @samp{#t}.
15149@end deftypevr
15150
15151@deftypevr {@code{dovecot-configuration} parameter} boolean maildir-very-dirty-syncs?
15152Assume Dovecot is the only MUA accessing Maildir: Scan cur/ directory only
15153when its mtime changes unexpectedly or when we can't find the mail
15154otherwise. Defaults to @samp{#f}.
15155@end deftypevr
15156
15157@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mbox-read-locks
15158Which locking methods to use for locking mbox. There are four available:
15159
15160@table @code
15161@item dotlock
15162Create <mailbox>.lock file. This is the oldest and most NFS-safe solution.
15163If you want to use /var/mail/ like directory, the users will need write
15164access to that directory.
15165@item dotlock-try
15166Same as dotlock, but if it fails because of permissions or because there
15167isn't enough disk space, just skip it.
15168@item fcntl
15169Use this if possible. Works with NFS too if lockd is used.
15170@item flock
15171May not exist in all systems. Doesn't work with NFS.
15172@item lockf
15173May not exist in all systems. Doesn't work with NFS.
15174@end table
15175
15176You can use multiple locking methods; if you do the order they're declared
15177in is important to avoid deadlocks if other MTAs/MUAs are using multiple
15178locking methods as well. Some operating systems don't allow using some of
15179them simultaneously.
15180@end deftypevr
15181
15182@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list mbox-write-locks
15183
15184@end deftypevr
15185
15186@deftypevr {@code{dovecot-configuration} parameter} string mbox-lock-timeout
15187Maximum time to wait for lock (all of them) before aborting. Defaults to
15188@samp{"5 mins"}.
15189@end deftypevr
15190
15191@deftypevr {@code{dovecot-configuration} parameter} string mbox-dotlock-change-timeout
15192If dotlock exists but the mailbox isn't modified in any way, override the
15193lock file after this much time. Defaults to @samp{"2 mins"}.
15194@end deftypevr
15195
15196@deftypevr {@code{dovecot-configuration} parameter} boolean mbox-dirty-syncs?
15197When mbox changes unexpectedly we have to fully read it to find out what
15198changed. If the mbox is large this can take a long time. Since the change
15199is usually just a newly appended mail, it'd be faster to simply read the new
15200mails. If this setting is enabled, Dovecot does this but still safely
15201fallbacks to re-reading the whole mbox file whenever something in mbox isn't
15202how it's expected to be. The only real downside to this setting is that if
15203some other MUA changes message flags, Dovecot doesn't notice it
15204immediately. Note that a full sync is done with SELECT, EXAMINE, EXPUNGE
15205and CHECK commands. Defaults to @samp{#t}.
15206@end deftypevr
15207
15208@deftypevr {@code{dovecot-configuration} parameter} boolean mbox-very-dirty-syncs?
15209Like @samp{mbox-dirty-syncs}, but don't do full syncs even with SELECT,
15210EXAMINE, EXPUNGE or CHECK commands. If this is set, @samp{mbox-dirty-syncs}
15211is ignored. Defaults to @samp{#f}.
15212@end deftypevr
15213
15214@deftypevr {@code{dovecot-configuration} parameter} boolean mbox-lazy-writes?
15215Delay writing mbox headers until doing a full write sync (EXPUNGE and CHECK
15216commands and when closing the mailbox). This is especially useful for POP3
15217where clients often delete all mails. The downside is that our changes
15218aren't immediately visible to other MUAs. Defaults to @samp{#t}.
15219@end deftypevr
15220
15221@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mbox-min-index-size
793dcd8c
LC
15222If mbox size is smaller than this (e.g.@: 100k), don't write index files.
15223If an index file already exists it's still read, just not updated. Defaults
15224to @samp{0}.
1e40e70b
JL
15225@end deftypevr
15226
15227@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mdbox-rotate-size
15228Maximum dbox file size until it's rotated. Defaults to @samp{10000000}.
15229@end deftypevr
15230
15231@deftypevr {@code{dovecot-configuration} parameter} string mdbox-rotate-interval
15232Maximum dbox file age until it's rotated. Typically in days. Day begins
15233from midnight, so 1d = today, 2d = yesterday, etc. 0 = check disabled.
15234Defaults to @samp{"1d"}.
15235@end deftypevr
15236
15237@deftypevr {@code{dovecot-configuration} parameter} boolean mdbox-preallocate-space?
15238When creating new mdbox files, immediately preallocate their size to
15239@samp{mdbox-rotate-size}. This setting currently works only in Linux with
15240some file systems (ext4, xfs). Defaults to @samp{#f}.
15241@end deftypevr
15242
15243@deftypevr {@code{dovecot-configuration} parameter} string mail-attachment-dir
15244sdbox and mdbox support saving mail attachments to external files, which
15245also allows single instance storage for them. Other backends don't support
15246this for now.
15247
15248WARNING: This feature hasn't been tested much yet. Use at your own risk.
15249
15250Directory root where to store mail attachments. Disabled, if empty.
15251Defaults to @samp{""}.
15252@end deftypevr
15253
15254@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer mail-attachment-min-size
15255Attachments smaller than this aren't saved externally. It's also possible
15256to write a plugin to disable saving specific attachments externally.
15257Defaults to @samp{128000}.
15258@end deftypevr
15259
15260@deftypevr {@code{dovecot-configuration} parameter} string mail-attachment-fs
15261File system backend to use for saving attachments:
15262@table @code
15263@item posix
15264No SiS done by Dovecot (but this might help FS's own deduplication)
15265@item sis posix
15266SiS with immediate byte-by-byte comparison during saving
15267@item sis-queue posix
15268SiS with delayed comparison and deduplication.
15269@end table
15270Defaults to @samp{"sis posix"}.
15271@end deftypevr
15272
15273@deftypevr {@code{dovecot-configuration} parameter} string mail-attachment-hash
15274Hash format to use in attachment filenames. You can add any text and
15275variables: @code{%@{md4@}}, @code{%@{md5@}}, @code{%@{sha1@}},
15276@code{%@{sha256@}}, @code{%@{sha512@}}, @code{%@{size@}}. Variables can be
793dcd8c
LC
15277truncated, e.g.@: @code{%@{sha256:80@}} returns only first 80 bits.
15278Defaults to @samp{"%@{sha1@}"}.
1e40e70b
JL
15279@end deftypevr
15280
15281@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer default-process-limit
15282
15283Defaults to @samp{100}.
15284@end deftypevr
15285
15286@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer default-client-limit
15287
15288Defaults to @samp{1000}.
15289@end deftypevr
15290
15291@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer default-vsz-limit
15292Default VSZ (virtual memory size) limit for service processes. This is
15293mainly intended to catch and kill processes that leak memory before they eat
15294up everything. Defaults to @samp{256000000}.
15295@end deftypevr
15296
15297@deftypevr {@code{dovecot-configuration} parameter} string default-login-user
15298Login user is internally used by login processes. This is the most
15299untrusted user in Dovecot system. It shouldn't have access to anything at
15300all. Defaults to @samp{"dovenull"}.
15301@end deftypevr
15302
15303@deftypevr {@code{dovecot-configuration} parameter} string default-internal-user
15304Internal user is used by unprivileged processes. It should be separate from
15305login user, so that login processes can't disturb other processes. Defaults
15306to @samp{"dovecot"}.
15307@end deftypevr
15308
15309@deftypevr {@code{dovecot-configuration} parameter} string ssl?
15310SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>. Defaults to
15311@samp{"required"}.
15312@end deftypevr
15313
15314@deftypevr {@code{dovecot-configuration} parameter} string ssl-cert
15315PEM encoded X.509 SSL/TLS certificate (public key). Defaults to
15316@samp{"</etc/dovecot/default.pem"}.
15317@end deftypevr
15318
15319@deftypevr {@code{dovecot-configuration} parameter} string ssl-key
15320PEM encoded SSL/TLS private key. The key is opened before dropping root
15321privileges, so keep the key file unreadable by anyone but root. Defaults to
15322@samp{"</etc/dovecot/private/default.pem"}.
15323@end deftypevr
15324
15325@deftypevr {@code{dovecot-configuration} parameter} string ssl-key-password
15326If key file is password protected, give the password here. Alternatively
15327give it when starting dovecot with -p parameter. Since this file is often
15328world-readable, you may want to place this setting instead to a different.
15329Defaults to @samp{""}.
15330@end deftypevr
15331
15332@deftypevr {@code{dovecot-configuration} parameter} string ssl-ca
15333PEM encoded trusted certificate authority. Set this only if you intend to
15334use @samp{ssl-verify-client-cert? #t}. The file should contain the CA
793dcd8c 15335certificate(s) followed by the matching CRL(s). (e.g.@: @samp{ssl-ca
1e40e70b
JL
15336</etc/ssl/certs/ca.pem}). Defaults to @samp{""}.
15337@end deftypevr
15338
15339@deftypevr {@code{dovecot-configuration} parameter} boolean ssl-require-crl?
15340Require that CRL check succeeds for client certificates. Defaults to
15341@samp{#t}.
15342@end deftypevr
15343
15344@deftypevr {@code{dovecot-configuration} parameter} boolean ssl-verify-client-cert?
15345Request client to send a certificate. If you also want to require it, set
15346@samp{auth-ssl-require-client-cert? #t} in auth section. Defaults to
15347@samp{#f}.
15348@end deftypevr
15349
15350@deftypevr {@code{dovecot-configuration} parameter} string ssl-cert-username-field
15351Which field from certificate to use for username. commonName and
15352x500UniqueIdentifier are the usual choices. You'll also need to set
15353@samp{auth-ssl-username-from-cert? #t}. Defaults to @samp{"commonName"}.
15354@end deftypevr
15355
15356@deftypevr {@code{dovecot-configuration} parameter} string ssl-min-protocol
15357Minimum SSL protocol version to accept. Defaults to @samp{"TLSv1"}.
15358@end deftypevr
15359
15360@deftypevr {@code{dovecot-configuration} parameter} string ssl-cipher-list
15361SSL ciphers to use. Defaults to
15362@samp{"ALL:!kRSA:!SRP:!kDHd:!DSS:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK:!RC4:!ADH:!LOW@@STRENGTH"}.
15363@end deftypevr
15364
15365@deftypevr {@code{dovecot-configuration} parameter} string ssl-crypto-device
15366SSL crypto device to use, for valid values run "openssl engine". Defaults
15367to @samp{""}.
15368@end deftypevr
15369
15370@deftypevr {@code{dovecot-configuration} parameter} string postmaster-address
15371Address to use when sending rejection mails. %d expands to recipient
15372domain. Defaults to @samp{"postmaster@@%d"}.
15373@end deftypevr
15374
15375@deftypevr {@code{dovecot-configuration} parameter} string hostname
793dcd8c
LC
15376Hostname to use in various parts of sent mails (e.g.@: in Message-Id) and
15377in LMTP replies. Default is the system's real hostname@@domain. Defaults
15378to @samp{""}.
1e40e70b
JL
15379@end deftypevr
15380
15381@deftypevr {@code{dovecot-configuration} parameter} boolean quota-full-tempfail?
15382If user is over quota, return with temporary failure instead of bouncing the
15383mail. Defaults to @samp{#f}.
15384@end deftypevr
15385
15386@deftypevr {@code{dovecot-configuration} parameter} file-name sendmail-path
15387Binary to use for sending mails. Defaults to @samp{"/usr/sbin/sendmail"}.
15388@end deftypevr
15389
15390@deftypevr {@code{dovecot-configuration} parameter} string submission-host
15391If non-empty, send mails via this SMTP host[:port] instead of sendmail.
15392Defaults to @samp{""}.
15393@end deftypevr
15394
15395@deftypevr {@code{dovecot-configuration} parameter} string rejection-subject
15396Subject: header to use for rejection mails. You can use the same variables
15397as for @samp{rejection-reason} below. Defaults to @samp{"Rejected: %s"}.
15398@end deftypevr
15399
15400@deftypevr {@code{dovecot-configuration} parameter} string rejection-reason
15401Human readable error message for rejection mails. You can use variables:
15402
15403@table @code
15404@item %n
15405CRLF
15406@item %r
15407reason
15408@item %s
15409original subject
15410@item %t
15411recipient
15412@end table
15413Defaults to @samp{"Your message to <%t> was automatically rejected:%n%r"}.
15414@end deftypevr
15415
15416@deftypevr {@code{dovecot-configuration} parameter} string recipient-delimiter
15417Delimiter character between local-part and detail in email address.
15418Defaults to @samp{"+"}.
15419@end deftypevr
15420
15421@deftypevr {@code{dovecot-configuration} parameter} string lda-original-recipient-header
15422Header where the original recipient address (SMTP's RCPT TO: address) is
15423taken from if not available elsewhere. With dovecot-lda -a parameter
15424overrides this. A commonly used header for this is X-Original-To. Defaults
15425to @samp{""}.
15426@end deftypevr
15427
15428@deftypevr {@code{dovecot-configuration} parameter} boolean lda-mailbox-autocreate?
15429Should saving a mail to a nonexistent mailbox automatically create it?.
15430Defaults to @samp{#f}.
15431@end deftypevr
15432
15433@deftypevr {@code{dovecot-configuration} parameter} boolean lda-mailbox-autosubscribe?
15434Should automatically created mailboxes be also automatically subscribed?.
15435Defaults to @samp{#f}.
15436@end deftypevr
15437
15438@deftypevr {@code{dovecot-configuration} parameter} non-negative-integer imap-max-line-length
15439Maximum IMAP command line length. Some clients generate very long command
15440lines with huge mailboxes, so you may need to raise this if you get "Too
15441long argument" or "IMAP command line too large" errors often. Defaults to
15442@samp{64000}.
15443@end deftypevr
15444
15445@deftypevr {@code{dovecot-configuration} parameter} string imap-logout-format
15446IMAP logout format string:
15447@table @code
15448@item %i
15449total number of bytes read from client
15450@item %o
15451total number of bytes sent to client.
15452@end table
15453See @file{doc/wiki/Variables.txt} for a list of all the variables you can
15454use. Defaults to @samp{"in=%i out=%o deleted=%@{deleted@}
15455expunged=%@{expunged@} trashed=%@{trashed@} hdr_count=%@{fetch_hdr_count@}
15456hdr_bytes=%@{fetch_hdr_bytes@} body_count=%@{fetch_body_count@}
15457body_bytes=%@{fetch_body_bytes@}"}.
15458@end deftypevr
15459
15460@deftypevr {@code{dovecot-configuration} parameter} string imap-capability
15461Override the IMAP CAPABILITY response. If the value begins with '+', add
793dcd8c 15462the given capabilities on top of the defaults (e.g.@: +XFOO XBAR). Defaults
1e40e70b
JL
15463to @samp{""}.
15464@end deftypevr
15465
15466@deftypevr {@code{dovecot-configuration} parameter} string imap-idle-notify-interval
15467How long to wait between "OK Still here" notifications when client is
15468IDLEing. Defaults to @samp{"2 mins"}.
15469@end deftypevr
15470
15471@deftypevr {@code{dovecot-configuration} parameter} string imap-id-send
15472ID field names and values to send to clients. Using * as the value makes
15473Dovecot use the default value. The following fields have default values
15474currently: name, version, os, os-version, support-url, support-email.
15475Defaults to @samp{""}.
15476@end deftypevr
15477
15478@deftypevr {@code{dovecot-configuration} parameter} string imap-id-log
15479ID fields sent by client to log. * means everything. Defaults to
15480@samp{""}.
15481@end deftypevr
15482
15483@deftypevr {@code{dovecot-configuration} parameter} space-separated-string-list imap-client-workarounds
15484Workarounds for various client bugs:
15485
15486@table @code
15487@item delay-newmail
15488Send EXISTS/RECENT new mail notifications only when replying to NOOP and
15489CHECK commands. Some clients ignore them otherwise, for example OSX Mail
15490(<v2.1). Outlook Express breaks more badly though, without this it may show
15491user "Message no longer in server" errors. Note that OE6 still breaks even
15492with this workaround if synchronization is set to "Headers Only".
15493
15494@item tb-extra-mailbox-sep
15495Thunderbird gets somehow confused with LAYOUT=fs (mbox and dbox) and adds
15496extra @samp{/} suffixes to mailbox names. This option causes Dovecot to
15497ignore the extra @samp{/} instead of treating it as invalid mailbox name.
15498
15499@item tb-lsub-flags
793dcd8c 15500Show \Noselect flags for LSUB replies with LAYOUT=fs (e.g.@: mbox). This
1e40e70b
JL
15501makes Thunderbird realize they aren't selectable and show them greyed out,
15502instead of only later giving "not selectable" popup error.
15503@end table
15504Defaults to @samp{()}.
15505@end deftypevr
15506
15507@deftypevr {@code{dovecot-configuration} parameter} string imap-urlauth-host
15508Host allowed in URLAUTH URLs sent by client. "*" allows all. Defaults to
15509@samp{""}.
15510@end deftypevr
15511
15512
15513Whew! Lots of configuration options. The nice thing about it though is that
15514GuixSD has a complete interface to Dovecot's configuration language. This
15515allows not only a nice way to declare configurations, but also offers
15516reflective capabilities as well: users can write code to inspect and
15517transform configurations from within Scheme.
15518
15519However, it could be that you just want to get a @code{dovecot.conf} up and
15520running. In that case, you can pass an @code{opaque-dovecot-configuration}
15521as the @code{#:config} parameter to @code{dovecot-service}. As its name
15522indicates, an opaque configuration does not have easy reflective
15523capabilities.
15524
15525Available @code{opaque-dovecot-configuration} fields are:
15526
15527@deftypevr {@code{opaque-dovecot-configuration} parameter} package dovecot
15528The dovecot package.
15529@end deftypevr
15530
15531@deftypevr {@code{opaque-dovecot-configuration} parameter} string string
15532The contents of the @code{dovecot.conf}, as a string.
15533@end deftypevr
15534
15535For example, if your @code{dovecot.conf} is just the empty string, you could
15536instantiate a dovecot service like this:
15537
15538@example
15539(dovecot-service #:config
15540 (opaque-dovecot-configuration
15541 (string "")))
15542@end example
15543
15544@subsubheading OpenSMTPD Service
15545
15546@deffn {Scheme Variable} opensmtpd-service-type
15547This is the type of the @uref{https://www.opensmtpd.org, OpenSMTPD} service,
15548whose value should be an @code{opensmtpd-configuration} object as in this
15549example:
15550
15551@example
15552(service opensmtpd-service-type
15553 (opensmtpd-configuration
15554 (config-file (local-file "./my-smtpd.conf"))))
15555@end example
15556@end deffn
15557
15558@deftp {Data Type} opensmtpd-configuration
15559Data type representing the configuration of opensmtpd.
15560
15561@table @asis
15562@item @code{package} (default: @var{opensmtpd})
15563Package object of the OpenSMTPD SMTP server.
15564
15565@item @code{config-file} (default: @var{%default-opensmtpd-file})
15566File-like object of the OpenSMTPD configuration file to use. By default it
15567listens on the loopback network interface, and allows for mail from users
15568and daemons on the local machine, as well as permitting email to remote
15569servers. Run @command{man smtpd.conf} for more information.
15570
15571@end table
15572@end deftp
15573
15574@subsubheading Exim Service
15575
15576@cindex mail transfer agent (MTA)
15577@cindex MTA (mail transfer agent)
15578@cindex SMTP
15579
15580@deffn {Scheme Variable} exim-service-type
15581This is the type of the @uref{https://exim.org, Exim} mail transfer agent
15582(MTA), whose value should be an @code{exim-configuration} object as in this
15583example:
15584
15585@example
15586(service exim-service-type
15587 (exim-configuration
15588 (config-file (local-file "./my-exim.conf"))))
15589@end example
15590@end deffn
15591
15592In order to use an @code{exim-service-type} service you must also have a
15593@code{mail-aliases-service-type} service present in your
15594@code{operating-system} (even if it has no aliases).
15595
15596@deftp {Data Type} exim-configuration
15597Data type representing the configuration of exim.
15598
15599@table @asis
15600@item @code{package} (default: @var{exim})
15601Package object of the Exim server.
15602
15603@item @code{config-file} (default: @code{#f})
15604File-like object of the Exim configuration file to use. If its value is
15605@code{#f} then use the default configuration file from the package provided
15606in @code{package}. The resulting configuration file is loaded after setting
15607the @code{exim_user} and @code{exim_group} configuration variables.
15608
15609@end table
15610@end deftp
15611
15612@subsubheading Mail Aliases Service
15613
15614@cindex email aliases
15615@cindex aliases, for email addresses
15616
15617@deffn {Scheme Variable} mail-aliases-service-type
15618This is the type of the service which provides @code{/etc/aliases},
15619specifying how to deliver mail to users on this system.
15620
15621@example
15622(service mail-aliases-service-type
15623 '(("postmaster" "bob")
15624 ("bob" "bob@@example.com" "bob@@example2.com")))
15625@end example
15626@end deffn
15627
15628The configuration for a @code{mail-aliases-service-type} service is an
15629association list denoting how to deliver mail that comes to this
15630system. Each entry is of the form @code{(alias addresses ...)}, with
15631@code{alias} specifying the local alias and @code{addresses} specifying
15632where to deliver this user's mail.
15633
15634The aliases aren't required to exist as users on the local system. In the
15635above example, there doesn't need to be a @code{postmaster} entry in the
15636@code{operating-system}'s @code{user-accounts} in order to deliver the
15637@code{postmaster} mail to @code{bob} (which subsequently would deliver mail
15638to @code{bob@@example.com} and @code{bob@@example2.com}).
15639
15640@node Kurznachrichtendienste
15641@subsubsection Kurznachrichtendienste
15642
15643@cindex messaging
15644@cindex jabber
15645@cindex XMPP
15646The @code{(gnu services messaging)} module provides Guix service definitions
15647for messaging services: currently only Prosody is supported.
15648
15649@subsubheading Prosody Service
15650
15651@deffn {Scheme Variable} prosody-service-type
15652This is the type for the @uref{https://prosody.im, Prosody XMPP
15653communication server}. Its value must be a @code{prosody-configuration}
15654record as in this example:
15655
15656@example
15657(service prosody-service-type
15658 (prosody-configuration
15659 (modules-enabled (cons "groups" "mam" %default-modules-enabled))
15660 (int-components
15661 (list
15662 (int-component-configuration
15663 (hostname "conference.example.net")
15664 (plugin "muc")
15665 (mod-muc (mod-muc-configuration)))))
15666 (virtualhosts
15667 (list
15668 (virtualhost-configuration
15669 (domain "example.net"))))))
15670@end example
15671
15672See below for details about @code{prosody-configuration}.
15673
15674@end deffn
15675
15676By default, Prosody does not need much configuration. Only one
15677@code{virtualhosts} field is needed: it specifies the domain you wish
15678Prosody to serve.
15679
15680You can perform various sanity checks on the generated configuration with
15681the @code{prosodyctl check} command.
15682
15683Prosodyctl will also help you to import certificates from the
15684@code{letsencrypt} directory so that the @code{prosody} user can access
15685them. See @url{https://prosody.im/doc/letsencrypt}.
15686
15687@example
15688prosodyctl --root cert import /etc/letsencrypt/live
15689@end example
15690
15691The available configuration parameters follow. Each parameter definition is
15692preceded by its type; for example, @samp{string-list foo} indicates that the
15693@code{foo} parameter should be specified as a list of strings. Types
15694starting with @code{maybe-} denote parameters that won't show up in
15695@code{prosody.cfg.lua} when their value is @code{'disabled}.
15696
15697There is also a way to specify the configuration as a string, if you have an
15698old @code{prosody.cfg.lua} file that you want to port over from some other
15699system; see the end for more details.
15700
15701The @code{file-object} type designates either a file-like object
15702(@pxref{G-Ausdrücke, file-like objects}) or a file name.
15703
15704@c The following documentation was initially generated by
15705@c (generate-documentation) in (gnu services messaging). Manually maintained
15706@c documentation is better, so we shouldn't hesitate to edit below as
15707@c needed. However if the change you want to make to this documentation
15708@c can be done in an automated way, it's probably easier to change
15709@c (generate-documentation) than to make it below and have to deal with
15710@c the churn as Prosody updates.
15711
15712Available @code{prosody-configuration} fields are:
15713
15714@deftypevr {@code{prosody-configuration} parameter} package prosody
15715The Prosody package.
15716@end deftypevr
15717
15718@deftypevr {@code{prosody-configuration} parameter} file-name data-path
15719Location of the Prosody data storage directory. See
15720@url{https://prosody.im/doc/configure}. Defaults to
15721@samp{"/var/lib/prosody"}.
15722@end deftypevr
15723
15724@deftypevr {@code{prosody-configuration} parameter} file-object-list plugin-paths
15725Additional plugin directories. They are searched in all the specified paths
15726in order. See @url{https://prosody.im/doc/plugins_directory}. Defaults to
15727@samp{()}.
15728@end deftypevr
15729
15730@deftypevr {@code{prosody-configuration} parameter} file-name certificates
15731Every virtual host and component needs a certificate so that clients and
15732servers can securely verify its identity. Prosody will automatically load
15733certificates/keys from the directory specified here. Defaults to
15734@samp{"/etc/prosody/certs"}.
15735@end deftypevr
15736
15737@deftypevr {@code{prosody-configuration} parameter} string-list admins
15738This is a list of accounts that are admins for the server. Note that you
15739must create the accounts separately. See
15740@url{https://prosody.im/doc/admins} and
15741@url{https://prosody.im/doc/creating_accounts}. Example: @code{(admins
15742'("user1@@example.com" "user2@@example.net"))} Defaults to @samp{()}.
15743@end deftypevr
15744
15745@deftypevr {@code{prosody-configuration} parameter} boolean use-libevent?
15746Enable use of libevent for better performance under high load. See
15747@url{https://prosody.im/doc/libevent}. Defaults to @samp{#f}.
15748@end deftypevr
15749
15750@deftypevr {@code{prosody-configuration} parameter} module-list modules-enabled
15751This is the list of modules Prosody will load on startup. It looks for
15752@code{mod_modulename.lua} in the plugins folder, so make sure that exists
15753too. Documentation on modules can be found at:
15754@url{https://prosody.im/doc/modules}. Defaults to @samp{("roster"
15755"saslauth" "tls" "dialback" "disco" "carbons" "private" "blocklist" "vcard"
15756"version" "uptime" "time" "ping" "pep" "register" "admin_adhoc")}.
15757@end deftypevr
15758
15759@deftypevr {@code{prosody-configuration} parameter} string-list modules-disabled
15760@samp{"offline"}, @samp{"c2s"} and @samp{"s2s"} are auto-loaded, but should
15761you want to disable them then add them to this list. Defaults to @samp{()}.
15762@end deftypevr
15763
15764@deftypevr {@code{prosody-configuration} parameter} file-object groups-file
15765Path to a text file where the shared groups are defined. If this path is
15766empty then @samp{mod_groups} does nothing. See
15767@url{https://prosody.im/doc/modules/mod_groups}. Defaults to
15768@samp{"/var/lib/prosody/sharedgroups.txt"}.
15769@end deftypevr
15770
15771@deftypevr {@code{prosody-configuration} parameter} boolean allow-registration?
15772Disable account creation by default, for security. See
15773@url{https://prosody.im/doc/creating_accounts}. Defaults to @samp{#f}.
15774@end deftypevr
15775
15776@deftypevr {@code{prosody-configuration} parameter} maybe-ssl-configuration ssl
15777These are the SSL/TLS-related settings. Most of them are disabled so to use
15778Prosody's defaults. If you do not completely understand these options, do
15779not add them to your config, it is easy to lower the security of your server
15780using them. See @url{https://prosody.im/doc/advanced_ssl_config}.
15781
15782Available @code{ssl-configuration} fields are:
15783
15784@deftypevr {@code{ssl-configuration} parameter} maybe-string protocol
15785This determines what handshake to use.
15786@end deftypevr
15787
15788@deftypevr {@code{ssl-configuration} parameter} maybe-file-name key
15789Path to your private key file.
15790@end deftypevr
15791
15792@deftypevr {@code{ssl-configuration} parameter} maybe-file-name certificate
15793Path to your certificate file.
15794@end deftypevr
15795
15796@deftypevr {@code{ssl-configuration} parameter} file-object capath
15797Path to directory containing root certificates that you wish Prosody to
15798trust when verifying the certificates of remote servers. Defaults to
15799@samp{"/etc/ssl/certs"}.
15800@end deftypevr
15801
15802@deftypevr {@code{ssl-configuration} parameter} maybe-file-object cafile
15803Path to a file containing root certificates that you wish Prosody to trust.
15804Similar to @code{capath} but with all certificates concatenated together.
15805@end deftypevr
15806
15807@deftypevr {@code{ssl-configuration} parameter} maybe-string-list verify
15808A list of verification options (these mostly map to OpenSSL's
15809@code{set_verify()} flags).
15810@end deftypevr
15811
15812@deftypevr {@code{ssl-configuration} parameter} maybe-string-list options
15813A list of general options relating to SSL/TLS. These map to OpenSSL's
15814@code{set_options()}. For a full list of options available in LuaSec, see
15815the LuaSec source.
15816@end deftypevr
15817
15818@deftypevr {@code{ssl-configuration} parameter} maybe-non-negative-integer depth
15819How long a chain of certificate authorities to check when looking for a
15820trusted root certificate.
15821@end deftypevr
15822
15823@deftypevr {@code{ssl-configuration} parameter} maybe-string ciphers
15824An OpenSSL cipher string. This selects what ciphers Prosody will offer to
15825clients, and in what order.
15826@end deftypevr
15827
15828@deftypevr {@code{ssl-configuration} parameter} maybe-file-name dhparam
15829A path to a file containing parameters for Diffie-Hellman key exchange. You
15830can create such a file with: @code{openssl dhparam -out
15831/etc/prosody/certs/dh-2048.pem 2048}
15832@end deftypevr
15833
15834@deftypevr {@code{ssl-configuration} parameter} maybe-string curve
15835Curve for Elliptic curve Diffie-Hellman. Prosody's default is
15836@samp{"secp384r1"}.
15837@end deftypevr
15838
15839@deftypevr {@code{ssl-configuration} parameter} maybe-string-list verifyext
15840A list of "extra" verification options.
15841@end deftypevr
15842
15843@deftypevr {@code{ssl-configuration} parameter} maybe-string password
15844Password for encrypted private keys.
15845@end deftypevr
15846
15847@end deftypevr
15848
15849@deftypevr {@code{prosody-configuration} parameter} boolean c2s-require-encryption?
15850Whether to force all client-to-server connections to be encrypted or not.
15851See @url{https://prosody.im/doc/modules/mod_tls}. Defaults to @samp{#f}.
15852@end deftypevr
15853
15854@deftypevr {@code{prosody-configuration} parameter} string-list disable-sasl-mechanisms
15855Set of mechanisms that will never be offered. See
15856@url{https://prosody.im/doc/modules/mod_saslauth}. Defaults to
15857@samp{("DIGEST-MD5")}.
15858@end deftypevr
15859
15860@deftypevr {@code{prosody-configuration} parameter} boolean s2s-require-encryption?
15861Whether to force all server-to-server connections to be encrypted or not.
15862See @url{https://prosody.im/doc/modules/mod_tls}. Defaults to @samp{#f}.
15863@end deftypevr
15864
15865@deftypevr {@code{prosody-configuration} parameter} boolean s2s-secure-auth?
15866Whether to require encryption and certificate authentication. This provides
15867ideal security, but requires servers you communicate with to support
15868encryption AND present valid, trusted certificates. See
15869@url{https://prosody.im/doc/s2s#security}. Defaults to @samp{#f}.
15870@end deftypevr
15871
15872@deftypevr {@code{prosody-configuration} parameter} string-list s2s-insecure-domains
15873Many servers don't support encryption or have invalid or self-signed
15874certificates. You can list domains here that will not be required to
15875authenticate using certificates. They will be authenticated using DNS. See
15876@url{https://prosody.im/doc/s2s#security}. Defaults to @samp{()}.
15877@end deftypevr
15878
15879@deftypevr {@code{prosody-configuration} parameter} string-list s2s-secure-domains
15880Even if you leave @code{s2s-secure-auth?} disabled, you can still require
15881valid certificates for some domains by specifying a list here. See
15882@url{https://prosody.im/doc/s2s#security}. Defaults to @samp{()}.
15883@end deftypevr
15884
15885@deftypevr {@code{prosody-configuration} parameter} string authentication
15886Select the authentication backend to use. The default provider stores
15887passwords in plaintext and uses Prosody's configured data storage to store
15888the authentication data. If you do not trust your server please see
15889@url{https://prosody.im/doc/modules/mod_auth_internal_hashed} for
15890information about using the hashed backend. See also
15891@url{https://prosody.im/doc/authentication} Defaults to
15892@samp{"internal_plain"}.
15893@end deftypevr
15894
15895@deftypevr {@code{prosody-configuration} parameter} maybe-string log
15896Set logging options. Advanced logging configuration is not yet supported by
15897the GuixSD Prosody Service. See @url{https://prosody.im/doc/logging}.
15898Defaults to @samp{"*syslog"}.
15899@end deftypevr
15900
15901@deftypevr {@code{prosody-configuration} parameter} file-name pidfile
15902File to write pid in. See @url{https://prosody.im/doc/modules/mod_posix}.
15903Defaults to @samp{"/var/run/prosody/prosody.pid"}.
15904@end deftypevr
15905
15906@deftypevr {@code{prosody-configuration} parameter} maybe-non-negative-integer http-max-content-size
15907Maximum allowed size of the HTTP body (in bytes).
15908@end deftypevr
15909
15910@deftypevr {@code{prosody-configuration} parameter} maybe-string http-external-url
15911Some modules expose their own URL in various ways. This URL is built from
15912the protocol, host and port used. If Prosody sits behind a proxy, the
15913public URL will be @code{http-external-url} instead. See
15914@url{https://prosody.im/doc/http#external_url}.
15915@end deftypevr
15916
15917@deftypevr {@code{prosody-configuration} parameter} virtualhost-configuration-list virtualhosts
15918A host in Prosody is a domain on which user accounts can be created. For
15919example if you want your users to have addresses like
15920@samp{"john.smith@@example.com"} then you need to add a host
15921@samp{"example.com"}. All options in this list will apply only to this
15922host.
15923
15924Note: the name "virtual" host is used in configuration to avoid confusion
15925with the actual physical host that Prosody is installed on. A single
15926Prosody instance can serve many domains, each one defined as a VirtualHost
15927entry in Prosody's configuration. Conversely a server that hosts a single
15928domain would have just one VirtualHost entry.
15929
15930See @url{https://prosody.im/doc/configure#virtual_host_settings}.
15931
15932Available @code{virtualhost-configuration} fields are:
15933
15934all these @code{prosody-configuration} fields: @code{admins},
15935@code{use-libevent?}, @code{modules-enabled}, @code{modules-disabled},
15936@code{groups-file}, @code{allow-registration?}, @code{ssl},
15937@code{c2s-require-encryption?}, @code{disable-sasl-mechanisms},
15938@code{s2s-require-encryption?}, @code{s2s-secure-auth?},
15939@code{s2s-insecure-domains}, @code{s2s-secure-domains},
15940@code{authentication}, @code{log}, @code{http-max-content-size},
15941@code{http-external-url}, @code{raw-content}, plus:
15942@deftypevr {@code{virtualhost-configuration} parameter} string domain
15943Domain you wish Prosody to serve.
15944@end deftypevr
15945
15946@end deftypevr
15947
15948@deftypevr {@code{prosody-configuration} parameter} int-component-configuration-list int-components
15949Components are extra services on a server which are available to clients,
15950usually on a subdomain of the main server (such as
15951@samp{"mycomponent.example.com"}). Example components might be chatroom
15952servers, user directories, or gateways to other protocols.
15953
15954Internal components are implemented with Prosody-specific plugins. To add
15955an internal component, you simply fill the hostname field, and the plugin
15956you wish to use for the component.
15957
15958See @url{https://prosody.im/doc/components}. Defaults to @samp{()}.
15959
15960Available @code{int-component-configuration} fields are:
15961
15962all these @code{prosody-configuration} fields: @code{admins},
15963@code{use-libevent?}, @code{modules-enabled}, @code{modules-disabled},
15964@code{groups-file}, @code{allow-registration?}, @code{ssl},
15965@code{c2s-require-encryption?}, @code{disable-sasl-mechanisms},
15966@code{s2s-require-encryption?}, @code{s2s-secure-auth?},
15967@code{s2s-insecure-domains}, @code{s2s-secure-domains},
15968@code{authentication}, @code{log}, @code{http-max-content-size},
15969@code{http-external-url}, @code{raw-content}, plus:
15970@deftypevr {@code{int-component-configuration} parameter} string hostname
15971Hostname of the component.
15972@end deftypevr
15973
15974@deftypevr {@code{int-component-configuration} parameter} string plugin
15975Plugin you wish to use for the component.
15976@end deftypevr
15977
15978@deftypevr {@code{int-component-configuration} parameter} maybe-mod-muc-configuration mod-muc
15979Multi-user chat (MUC) is Prosody's module for allowing you to create hosted
15980chatrooms/conferences for XMPP users.
15981
15982General information on setting up and using multi-user chatrooms can be
15983found in the "Chatrooms" documentation
15984(@url{https://prosody.im/doc/chatrooms}), which you should read if you are
15985new to XMPP chatrooms.
15986
15987See also @url{https://prosody.im/doc/modules/mod_muc}.
15988
15989Available @code{mod-muc-configuration} fields are:
15990
15991@deftypevr {@code{mod-muc-configuration} parameter} string name
15992The name to return in service discovery responses. Defaults to
15993@samp{"Prosody Chatrooms"}.
15994@end deftypevr
15995
15996@deftypevr {@code{mod-muc-configuration} parameter} string-or-boolean restrict-room-creation
15997If @samp{#t}, this will only allow admins to create new chatrooms.
15998Otherwise anyone can create a room. The value @samp{"local"} restricts room
793dcd8c
LC
15999creation to users on the service's parent domain. E.g.@:
16000@samp{user@@example.com} can create rooms on @samp{rooms.example.com}. The
16001value @samp{"admin"} restricts to service administrators only. Defaults to
16002@samp{#f}.
1e40e70b
JL
16003@end deftypevr
16004
16005@deftypevr {@code{mod-muc-configuration} parameter} non-negative-integer max-history-messages
16006Maximum number of history messages that will be sent to the member that has
16007just joined the room. Defaults to @samp{20}.
16008@end deftypevr
16009
16010@end deftypevr
16011
16012@end deftypevr
16013
16014@deftypevr {@code{prosody-configuration} parameter} ext-component-configuration-list ext-components
16015External components use XEP-0114, which most standalone components support.
16016To add an external component, you simply fill the hostname field. See
16017@url{https://prosody.im/doc/components}. Defaults to @samp{()}.
16018
16019Available @code{ext-component-configuration} fields are:
16020
16021all these @code{prosody-configuration} fields: @code{admins},
16022@code{use-libevent?}, @code{modules-enabled}, @code{modules-disabled},
16023@code{groups-file}, @code{allow-registration?}, @code{ssl},
16024@code{c2s-require-encryption?}, @code{disable-sasl-mechanisms},
16025@code{s2s-require-encryption?}, @code{s2s-secure-auth?},
16026@code{s2s-insecure-domains}, @code{s2s-secure-domains},
16027@code{authentication}, @code{log}, @code{http-max-content-size},
16028@code{http-external-url}, @code{raw-content}, plus:
16029@deftypevr {@code{ext-component-configuration} parameter} string component-secret
16030Password which the component will use to log in.
16031@end deftypevr
16032
16033@deftypevr {@code{ext-component-configuration} parameter} string hostname
16034Hostname of the component.
16035@end deftypevr
16036
16037@end deftypevr
16038
16039@deftypevr {@code{prosody-configuration} parameter} non-negative-integer-list component-ports
16040Port(s) Prosody listens on for component connections. Defaults to
16041@samp{(5347)}.
16042@end deftypevr
16043
16044@deftypevr {@code{prosody-configuration} parameter} string component-interface
16045Interface Prosody listens on for component connections. Defaults to
16046@samp{"127.0.0.1"}.
16047@end deftypevr
16048
16049@deftypevr {@code{prosody-configuration} parameter} maybe-raw-content raw-content
16050Raw content that will be added to the configuration file.
16051@end deftypevr
16052
16053It could be that you just want to get a @code{prosody.cfg.lua} up and
16054running. In that case, you can pass an @code{opaque-prosody-configuration}
16055record as the value of @code{prosody-service-type}. As its name indicates,
16056an opaque configuration does not have easy reflective capabilities.
16057Available @code{opaque-prosody-configuration} fields are:
16058
16059@deftypevr {@code{opaque-prosody-configuration} parameter} package prosody
16060The prosody package.
16061@end deftypevr
16062
16063@deftypevr {@code{opaque-prosody-configuration} parameter} string prosody.cfg.lua
16064The contents of the @code{prosody.cfg.lua} to use.
16065@end deftypevr
16066
16067For example, if your @code{prosody.cfg.lua} is just the empty string, you
16068could instantiate a prosody service like this:
16069
16070@example
16071(service prosody-service-type
16072 (opaque-prosody-configuration
16073 (prosody.cfg.lua "")))
16074@end example
16075
16076@c end of Prosody auto-generated documentation
16077
16078@subsubheading BitlBee Service
16079
16080@cindex IRC (Internet Relay Chat)
16081@cindex IRC gateway
16082@url{http://bitlbee.org,BitlBee} is a gateway that provides an IRC interface
16083to a variety of messaging protocols such as XMPP.
16084
16085@defvr {Scheme Variable} bitlbee-service-type
16086This is the service type for the @url{http://bitlbee.org,BitlBee} IRC
16087gateway daemon. Its value is a @code{bitlbee-configuration} (see below).
16088
16089To have BitlBee listen on port 6667 on localhost, add this line to your
16090services:
16091
16092@example
16093(service bitlbee-service-type)
16094@end example
16095@end defvr
16096
16097@deftp {Data Type} bitlbee-configuration
16098This is the configuration for BitlBee, with the following fields:
16099
16100@table @asis
16101@item @code{interface} (default: @code{"127.0.0.1"})
16102@itemx @code{port} (default: @code{6667})
16103Listen on the network interface corresponding to the IP address specified in
16104@var{interface}, on @var{port}.
16105
16106When @var{interface} is @code{127.0.0.1}, only local clients can connect;
16107when it is @code{0.0.0.0}, connections can come from any networking
16108interface.
16109
16110@item @code{package} (default: @code{bitlbee})
16111The BitlBee package to use.
16112
16113@item @code{plugins} (default: @code{'()})
16114List of plugin packages to use---e.g., @code{bitlbee-discord}.
16115
16116@item @code{extra-settings} (default: @code{""})
16117Configuration snippet added as-is to the BitlBee configuration file.
16118@end table
16119@end deftp
16120
16121
16122@node Telefondienste
16123@subsubsection Telefondienste
16124
16125@cindex Murmur (VoIP server)
16126@cindex VoIP server
16127This section describes how to set up and run a Murmur server. Murmur is the
16128server of the @uref{https://mumble.info, Mumble} voice-over-IP (VoIP) suite.
16129
16130@deftp {Data Type} murmur-configuration
16131The service type for the Murmur server. An example configuration can look
16132like this:
16133
16134@example
16135(service murmur-service-type
16136 (murmur-configuration
16137 (welcome-text
16138 "Welcome to this Mumble server running on GuixSD!")
16139 (cert-required? #t) ;disallow text password logins
16140 (ssl-cert "/etc/letsencrypt/live/mumble.example.com/fullchain.pem")
16141 (ssl-key "/etc/letsencrypt/live/mumble.example.com/privkey.pem")))
16142@end example
16143
16144After reconfiguring your system, you can manually set the murmur
16145@code{SuperUser} password with the command that is printed during the
16146activation phase.
16147
16148It is recommended to register a normal Mumble user account and grant it
16149admin or moderator rights. You can use the @code{mumble} client to login as
16150new normal user, register yourself, and log out. For the next step login
16151with the name @code{SuperUser} use the @code{SuperUser} password that you
16152set previously, and grant your newly registered mumble user administrator or
16153moderator rights and create some channels.
16154
16155Available @code{murmur-configuration} fields are:
16156
16157@table @asis
16158@item @code{package} (default: @code{mumble})
16159Package that contains @code{bin/murmurd}.
16160
16161@item @code{user} (default: @code{"murmur"})
16162User who will run the Murmur server.
16163
16164@item @code{group} (default: @code{"murmur"})
16165Group of the user who will run the murmur server.
16166
16167@item @code{port} (default: @code{64738})
16168Port on which the server will listen.
16169
16170@item @code{welcome-text} (default: @code{""})
16171Welcome text sent to clients when they connect.
16172
16173@item @code{server-password} (default: @code{""})
16174Password the clients have to enter in order to connect.
16175
16176@item @code{max-users} (default: @code{100})
16177Maximum of users that can be connected to the server at once.
16178
16179@item @code{max-user-bandwidth} (default: @code{#f})
16180Maximum voice traffic a user can send per second.
16181
16182@item @code{database-file} (default: @code{"/var/lib/murmur/db.sqlite"})
16183File name of the sqlite database. The service's user will become the owner
16184of the directory.
16185
16186@item @code{log-file} (default: @code{"/var/log/murmur/murmur.log"})
16187File name of the log file. The service's user will become the owner of the
16188directory.
16189
16190@item @code{autoban-attempts} (default: @code{10})
16191Maximum number of logins a user can make in @code{autoban-timeframe} without
16192getting auto banned for @code{autoban-time}.
16193
16194@item @code{autoban-timeframe} (default: @code{120})
16195Timeframe for autoban in seconds.
16196
16197@item @code{autoban-time} (default: @code{300})
16198Amount of time in seconds for which a client gets banned when violating the
16199autoban limits.
16200
16201@item @code{opus-threshold} (default: @code{100})
16202Percentage of clients that need to support opus before switching over to
16203opus audio codec.
16204
16205@item @code{channel-nesting-limit} (default: @code{10})
16206How deep channels can be nested at maximum.
16207
16208@item @code{channelname-regex} (default: @code{#f})
793dcd8c 16209A string in form of a Qt regular expression that channel names must conform
1e40e70b
JL
16210to.
16211
16212@item @code{username-regex} (default: @code{#f})
793dcd8c 16213A string in form of a Qt regular expression that user names must conform to.
1e40e70b
JL
16214
16215@item @code{text-message-length} (default: @code{5000})
16216Maximum size in bytes that a user can send in one text chat message.
16217
16218@item @code{image-message-length} (default: @code{(* 128 1024)})
16219Maximum size in bytes that a user can send in one image message.
16220
16221@item @code{cert-required?} (default: @code{#f})
16222If it is set to @code{#t} clients that use weak password authentification
16223will not be accepted. Users must have completed the certificate wizard to
16224join.
16225
793dcd8c 16226@item @code{remember-channel?} (default: @code{#f})
1e40e70b
JL
16227Should murmur remember the last channel each user was in when they
16228disconnected and put them into the remembered channel when they rejoin.
16229
16230@item @code{allow-html?} (default: @code{#f})
16231Should html be allowed in text messages, user comments, and channel
16232descriptions.
16233
16234@item @code{allow-ping?} (default: @code{#f})
16235Setting to true exposes the current user count, the maximum user count, and
16236the server's maximum bandwidth per client to unauthenticated users. In the
16237Mumble client, this information is shown in the Connect dialog.
16238
16239Disabling this setting will prevent public listing of the server.
16240
16241@item @code{bonjour?} (default: @code{#f})
16242Should the server advertise itself in the local network through the bonjour
16243protocol.
16244
16245@item @code{send-version?} (default: @code{#f})
16246Should the murmur server version be exposed in ping requests.
16247
16248@item @code{log-days} (default: @code{31})
16249Murmur also stores logs in the database, which are accessible via RPC. The
16250default is 31 days of months, but you can set this setting to 0 to keep logs
16251forever, or -1 to disable logging to the database.
16252
793dcd8c 16253@item @code{obfuscate-ips?} (default: @code{#t})
1e40e70b
JL
16254Should logged ips be obfuscated to protect the privacy of users.
16255
16256@item @code{ssl-cert} (default: @code{#f})
16257File name of the SSL/TLS certificate used for encrypted connections.
16258
16259@example
16260(ssl-cert "/etc/letsencrypt/live/example.com/fullchain.pem")
16261@end example
16262@item @code{ssl-key} (default: @code{#f})
16263Filepath to the ssl private key used for encrypted connections.
16264@example
16265(ssl-key "/etc/letsencrypt/live/example.com/privkey.pem")
16266@end example
16267
16268@item @code{ssl-dh-params} (default: @code{#f})
16269File name of a PEM-encoded file with Diffie-Hellman parameters for the
16270SSL/TLS encryption. Alternatively you set it to @code{"@@ffdhe2048"},
16271@code{"@@ffdhe3072"}, @code{"@@ffdhe4096"}, @code{"@@ffdhe6144"} or
16272@code{"@@ffdhe8192"} to use bundled parameters from RFC 7919.
16273
16274@item @code{ssl-ciphers} (default: @code{#f})
16275The @code{ssl-ciphers} option chooses the cipher suites to make available
16276for use in SSL/TLS.
16277
16278This option is specified using
16279@uref{https://www.openssl.org/docs/apps/ciphers.html#CIPHER-LIST-FORMAT,
16280OpenSSL cipher list notation}.
16281
16282It is recommended that you try your cipher string using 'openssl ciphers
16283<string>' before setting it here, to get a feel for which cipher suites you
16284will get. After setting this option, it is recommend that you inspect your
16285Murmur log to ensure that Murmur is using the cipher suites that you
16286expected it to.
16287
16288Note: Changing this option may impact the backwards compatibility of your
16289Murmur server, and can remove the ability for older Mumble clients to be
16290able to connect to it.
16291
16292@item @code{public-registration} (default: @code{#f})
16293Must be a @code{<murmur-public-registration-configuration>} record or
16294@code{#f}.
16295
16296You can optionally register your server in the public server list that the
16297@code{mumble} client shows on startup. You cannot register your server if
16298you have set a @code{server-password}, or set @code{allow-ping} to
16299@code{#f}.
16300
16301It might take a few hours until it shows up in the public list.
16302
16303@item @code{file} (default: @code{#f})
16304Optional alternative override for this configuration.
16305@end table
16306@end deftp
16307
16308@deftp {Data Type} murmur-public-registration-configuration
16309Configuration for public registration of a murmur service.
16310
16311@table @asis
16312@item @code{name}
16313This is a display name for your server. Not to be confused with the
16314hostname.
16315
16316@item @code{password}
16317A password to identify your registration. Subsequent updates will need the
16318same password. Don't lose your password.
16319
16320@item @code{url}
16321This should be a @code{http://} or @code{https://} link to your web site.
16322
16323@item @code{hostname} (default: @code{#f})
16324By default your server will be listed by its IP address. If it is set your
16325server will be linked by this host name instead.
16326@end table
16327@end deftp
16328
16329
16330
16331@node Überwachungsdienste
16332@subsubsection Überwachungsdienste
16333
16334@subsubheading Tailon Service
16335
16336@uref{https://tailon.readthedocs.io/, Tailon} is a web application for
16337viewing and searching log files.
16338
16339The following example will configure the service with default values. By
16340default, Tailon can be accessed on port 8080 (@code{http://localhost:8080}).
16341
16342@example
16343(service tailon-service-type)
16344@end example
16345
16346The following example customises more of the Tailon configuration, adding
16347@command{sed} to the list of allowed commands.
16348
16349@example
16350(service tailon-service-type
16351 (tailon-configuration
16352 (config-file
16353 (tailon-configuration-file
16354 (allowed-commands '("tail" "grep" "awk" "sed"))))))
16355@end example
16356
16357
16358@deftp {Data Type} tailon-configuration
16359Data type representing the configuration of Tailon. This type has the
16360following parameters:
16361
16362@table @asis
16363@item @code{config-file} (default: @code{(tailon-configuration-file)})
16364The configuration file to use for Tailon. This can be set to a
16365@dfn{tailon-configuration-file} record value, or any gexp
16366(@pxref{G-Ausdrücke}).
16367
16368For example, to instead use a local file, the @code{local-file} function can
16369be used:
16370
16371@example
16372(service tailon-service-type
16373 (tailon-configuration
16374 (config-file (local-file "./my-tailon.conf"))))
16375@end example
16376
16377@item @code{package} (default: @code{tailon})
16378The tailon package to use.
16379
16380@end table
16381@end deftp
16382
16383@deftp {Data Type} tailon-configuration-file
16384Data type representing the configuration options for Tailon. This type has
16385the following parameters:
16386
16387@table @asis
16388@item @code{files} (default: @code{(list "/var/log")})
16389List of files to display. The list can include strings for a single file or
16390directory, or a list, where the first item is the name of a subsection, and
16391the remaining items are the files or directories in that subsection.
16392
16393@item @code{bind} (default: @code{"localhost:8080"})
16394Address and port to which Tailon should bind on.
16395
16396@item @code{relative-root} (default: @code{#f})
16397URL path to use for Tailon, set to @code{#f} to not use a path.
16398
16399@item @code{allow-transfers?} (default: @code{#t})
16400Allow downloading the log files in the web interface.
16401
16402@item @code{follow-names?} (default: @code{#t})
16403Allow tailing of not-yet existent files.
16404
16405@item @code{tail-lines} (default: @code{200})
16406Number of lines to read initially from each file.
16407
16408@item @code{allowed-commands} (default: @code{(list "tail" "grep" "awk")})
16409Commands to allow running. By default, @code{sed} is disabled.
16410
16411@item @code{debug?} (default: @code{#f})
16412Set @code{debug?} to @code{#t} to show debug messages.
16413
16414@item @code{wrap-lines} (default: @code{#t})
16415Initial line wrapping state in the web interface. Set to @code{#t} to
16416initially wrap lines (the default), or to @code{#f} to initially not wrap
16417lines.
16418
16419@item @code{http-auth} (default: @code{#f})
16420HTTP authentication type to use. Set to @code{#f} to disable authentication
16421(the default). Supported values are @code{"digest"} or @code{"basic"}.
16422
16423@item @code{users} (default: @code{#f})
16424If HTTP authentication is enabled (see @code{http-auth}), access will be
16425restricted to the credentials provided here. To configure users, use a list
16426of pairs, where the first element of the pair is the username, and the 2nd
16427element of the pair is the password.
16428
16429@example
16430(tailon-configuration-file
16431 (http-auth "basic")
16432 (users '(("user1" . "password1")
16433 ("user2" . "password2"))))
16434@end example
16435
16436@end table
16437@end deftp
16438
16439
16440@subsubheading Darkstat Service
16441@cindex darkstat
16442Darkstat is a packet sniffer that captures network traffic, calculates
16443statistics about usage, and serves reports over HTTP.
16444
16445@defvar {Scheme Variable} darkstat-service-type
16446This is the service type for the @uref{https://unix4lyfe.org/darkstat/,
16447darkstat} service, its value must be a @code{darkstat-configuration} record
16448as in this example:
16449
16450@example
16451(service darkstat-service-type
16452 (darkstat-configuration
16453 (interface "eno1")))
16454@end example
16455@end defvar
16456
16457@deftp {Data Type} darkstat-configuration
16458Data type representing the configuration of @command{darkstat}.
16459
16460@table @asis
16461@item @code{package} (default: @code{darkstat})
16462The darkstat package to use.
16463
16464@item @code{interface}
16465Capture traffic on the specified network interface.
16466
16467@item @code{port} (default: @code{"667"})
16468Bind the web interface to the specified port.
16469
16470@item @code{bind-address} (default: @code{"127.0.0.1"})
16471Bind the web interface to the specified address.
16472
16473@item @code{base} (default: @code{"/"})
16474Specify the path of the base URL. This can be useful if @command{darkstat}
16475is accessed via a reverse proxy.
16476
16477@end table
16478@end deftp
16479
16480@subsubheading Prometheus Node Exporter Service
16481
16482@cindex prometheus-node-exporter
16483The Prometheus ``node exporter'' makes hardware and operating system
16484statistics provided by the Linux kernel available for the Prometheus
16485monitoring system. This service should be deployed on all physical nodes
16486and virtual machines, where monitoring these statistics is desirable.
16487
16488@defvar {Scheme variable} prometheus-node-exporter-service-type
16489This is the service type for the
16490@uref{https://github.com/prometheus/node_exporter/,
16491prometheus-node-exporter} service, its value must be a
16492@code{prometheus-node-exporter-configuration} record as in this example:
16493
16494@example
16495(service prometheus-node-exporter-service-type
16496 (prometheus-node-exporter-configuration
16497 (web-listen-address ":9100")))
16498@end example
16499@end defvar
16500
16501@deftp {Data Type} prometheus-node-exporter-configuration
16502Data type representing the configuration of @command{node_exporter}.
16503
16504@table @asis
16505@item @code{package} (default: @code{go-github-com-prometheus-node-exporter})
16506The prometheus-node-exporter package to use.
16507
16508@item @code{web-listen-address} (default: @code{":9100"})
16509Bind the web interface to the specified address.
16510
16511@end table
16512@end deftp
16513
16514@node Kerberos-Dienste
16515@subsubsection Kerberos-Dienste
16516@cindex Kerberos
16517
16518The @code{(gnu services kerberos)} module provides services relating to the
16519authentication protocol @dfn{Kerberos}.
16520
16521@subsubheading Krb5 Service
16522
16523Programs using a Kerberos client library normally expect a configuration
16524file in @file{/etc/krb5.conf}. This service generates such a file from a
16525definition provided in the operating system declaration. It does not cause
16526any daemon to be started.
16527
16528No ``keytab'' files are provided by this service---you must explicitly
16529create them. This service is known to work with the MIT client library,
16530@code{mit-krb5}. Other implementations have not been tested.
16531
16532@defvr {Scheme Variable} krb5-service-type
16533A service type for Kerberos 5 clients.
16534@end defvr
16535
16536@noindent
16537Here is an example of its use:
16538@lisp
16539(service krb5-service-type
16540 (krb5-configuration
16541 (default-realm "EXAMPLE.COM")
16542 (allow-weak-crypto? #t)
16543 (realms (list
16544 (krb5-realm
16545 (name "EXAMPLE.COM")
16546 (admin-server "groucho.example.com")
16547 (kdc "karl.example.com"))
16548 (krb5-realm
16549 (name "ARGRX.EDU")
16550 (admin-server "kerb-admin.argrx.edu")
16551 (kdc "keys.argrx.edu"))))))
16552@end lisp
16553
16554@noindent
16555This example provides a Kerberos@tie{}5 client configuration which:
16556@itemize
16557@item Recognizes two realms, @i{viz:} ``EXAMPLE.COM'' and ``ARGRX.EDU'', both
16558of which have distinct administration servers and key distribution centers;
16559@item Will default to the realm ``EXAMPLE.COM'' if the realm is not explicitly
16560specified by clients;
16561@item Accepts services which only support encryption types known to be weak.
16562@end itemize
16563
16564The @code{krb5-realm} and @code{krb5-configuration} types have many fields.
16565Only the most commonly used ones are described here. For a full list, and
16566more detailed explanation of each, see the MIT
16567@uref{http://web.mit.edu/kerberos/krb5-devel/doc/admin/conf_files/krb5_conf.html,,krb5.conf}
16568documentation.
16569
16570
16571@deftp {Data Type} krb5-realm
16572@cindex realm, kerberos
16573@table @asis
16574@item @code{name}
16575This field is a string identifying the name of the realm. A common
16576convention is to use the fully qualified DNS name of your organization,
16577converted to upper case.
16578
16579@item @code{admin-server}
16580This field is a string identifying the host where the administration server
16581is running.
16582
16583@item @code{kdc}
16584This field is a string identifying the key distribution center for the
16585realm.
16586@end table
16587@end deftp
16588
16589@deftp {Data Type} krb5-configuration
16590
16591@table @asis
16592@item @code{allow-weak-crypto?} (default: @code{#f})
16593If this flag is @code{#t} then services which only offer encryption
16594algorithms known to be weak will be accepted.
16595
16596@item @code{default-realm} (default: @code{#f})
16597This field should be a string identifying the default Kerberos realm for the
16598client. You should set this field to the name of your Kerberos realm. If
16599this value is @code{#f} then a realm must be specified with every Kerberos
16600principal when invoking programs such as @command{kinit}.
16601
16602@item @code{realms}
16603This should be a non-empty list of @code{krb5-realm} objects, which clients
16604may access. Normally, one of them will have a @code{name} field matching
16605the @code{default-realm} field.
16606@end table
16607@end deftp
16608
16609
16610@subsubheading PAM krb5 Service
16611@cindex pam-krb5
16612
16613The @code{pam-krb5} service allows for login authentication and password
16614management via Kerberos. You will need this service if you want PAM enabled
16615applications to authenticate users using Kerberos.
16616
16617@defvr {Scheme Variable} pam-krb5-service-type
16618A service type for the Kerberos 5 PAM module.
16619@end defvr
16620
16621@deftp {Data Type} pam-krb5-configuration
16622Data type representing the configuration of the Kerberos 5 PAM module This
16623type has the following parameters:
16624@table @asis
16625@item @code{pam-krb5} (default: @code{pam-krb5})
16626The pam-krb5 package to use.
16627
16628@item @code{minimum-uid} (default: @code{1000})
16629The smallest user ID for which Kerberos authentications should be
16630attempted. Local accounts with lower values will silently fail to
16631authenticate.
16632@end table
16633@end deftp
16634
16635
16636@node Web-Dienste
16637@subsubsection Web-Dienste
16638
16639@cindex web
16640@cindex www
16641@cindex HTTP
16642The @code{(gnu services web)} module provides the Apache HTTP Server, the
16643nginx web server, and also a fastcgi wrapper daemon.
16644
16645@subsubheading Apache HTTP Server
16646
16647@deffn {Scheme Variable} httpd-service-type
16648Service type for the @uref{https://httpd.apache.org/,Apache HTTP} server
16649(@dfn{httpd}). The value for this service type is a
793dcd8c 16650@code{httpd-configuration} record.
1e40e70b
JL
16651
16652A simple example configuration is given below.
16653
16654@example
16655(service httpd-service-type
16656 (httpd-configuration
16657 (config
16658 (httpd-config-file
16659 (server-name "www.example.com")
16660 (document-root "/srv/http/www.example.com")))))
16661@end example
16662
16663Other services can also extend the @code{httpd-service-type} to add to the
16664configuration.
16665
16666@example
16667(simple-service 'my-extra-server httpd-service-type
16668 (list
16669 (httpd-virtualhost
16670 "*:80"
16671 (list (string-append
16672 "ServerName "www.example.com
16673 DocumentRoot \"/srv/http/www.example.com\"")))))
16674@end example
16675@end deffn
16676
16677The details for the @code{httpd-configuration}, @code{httpd-module},
16678@code{httpd-config-file} and @code{httpd-virtualhost} record types are given
16679below.
16680
16681@deffn {Data Type} httpd-configuration
16682This data type represents the configuration for the httpd service.
16683
16684@table @asis
16685@item @code{package} (default: @code{httpd})
16686The httpd package to use.
16687
16688@item @code{pid-file} (default: @code{"/var/run/httpd"})
16689The pid file used by the shepherd-service.
16690
16691@item @code{config} (default: @code{(httpd-config-file)})
16692The configuration file to use with the httpd service. The default value is a
16693@code{httpd-config-file} record, but this can also be a different
16694G-expression that generates a file, for example a @code{plain-file}. A file
16695outside of the store can also be specified through a string.
16696
16697@end table
16698@end deffn
16699
16700@deffn {Data Type} httpd-module
16701This data type represents a module for the httpd service.
16702
16703@table @asis
16704@item @code{name}
16705The name of the module.
16706
16707@item @code{file}
16708The file for the module. This can be relative to the httpd package being
16709used, the absolute location of a file, or a G-expression for a file within
16710the store, for example @code{(file-append mod-wsgi "/modules/mod_wsgi.so")}.
16711
16712@end table
16713@end deffn
16714
16715@defvr {Scheme Variable} %default-httpd-modules
16716A default list of @code{httpd-module} objects.
16717@end defvr
16718
16719@deffn {Data Type} httpd-config-file
16720This data type represents a configuration file for the httpd service.
16721
16722@table @asis
16723@item @code{modules} (default: @code{%default-httpd-modules})
16724The modules to load. Additional modules can be added here, or loaded by
16725additional configuration.
16726
16727For example, in order to handle requests for PHP files, you can use Apache’s
16728@code{mod_proxy_fcgi} module along with @code{php-fpm-service-type}:
16729
16730@example
16731(service httpd-service-type
16732 (httpd-configuration
16733 (config
16734 (httpd-config-file
16735 (modules (cons*
16736 (httpd-module
16737 (name "proxy_module")
16738 (file "modules/mod_proxy.so"))
16739 (httpd-module
16740 (name "proxy_fcgi_module")
16741 (file "modules/mod_proxy_fcgi.so"))
16742 %default-httpd-modules))
16743 (extra-config (list "\
16744<FilesMatch \\.php$>
16745 SetHandler \"proxy:unix:/var/run/php-fpm.sock|fcgi://localhost/\"
16746</FilesMatch>"))))))
16747(service php-fpm-service-type
16748 (php-fpm-configuration
16749 (socket "/var/run/php-fpm.sock")
16750 (socket-group "httpd")))
16751@end example
16752
16753@item @code{server-root} (default: @code{httpd})
16754The @code{ServerRoot} in the configuration file, defaults to the httpd
16755package. Directives including @code{Include} and @code{LoadModule} are taken
16756as relative to the server root.
16757
16758@item @code{server-name} (default: @code{#f})
16759The @code{ServerName} in the configuration file, used to specify the request
16760scheme, hostname and port that the server uses to identify itself.
16761
16762This doesn't need to be set in the server config, and can be specifyed in
16763virtual hosts. The default is @code{#f} to not specify a @code{ServerName}.
16764
16765@item @code{document-root} (default: @code{"/srv/http"})
16766The @code{DocumentRoot} from which files will be served.
16767
16768@item @code{listen} (default: @code{'("80")})
16769The list of values for the @code{Listen} directives in the config file. The
16770value should be a list of strings, when each string can specify the port
16771number to listen on, and optionally the IP address and protocol to use.
16772
16773@item @code{pid-file} (default: @code{"/var/run/httpd"})
16774The @code{PidFile} to use. This should match the @code{pid-file} set in the
16775@code{httpd-configuration} so that the Shepherd service is configured
16776correctly.
16777
16778@item @code{error-log} (default: @code{"/var/log/httpd/error_log"})
16779The @code{ErrorLog} to which the server will log errors.
16780
16781@item @code{user} (default: @code{"httpd"})
16782The @code{User} which the server will answer requests as.
16783
16784@item @code{group} (default: @code{"httpd"})
16785The @code{Group} which the server will answer requests as.
16786
16787@item @code{extra-config} (default: @code{(list "TypesConfig etc/httpd/mime.types")})
16788A flat list of strings and G-expressions which will be added to the end of
16789the configuration file.
16790
16791Any values which the service is extended with will be appended to this list.
16792
16793@end table
16794@end deffn
16795
16796@deffn {Data Type} httpd-virtualhost
16797This data type represents a virtualhost configuration block for the httpd
16798service.
16799
16800These should be added to the extra-config for the httpd-service.
16801
16802@example
16803(simple-service 'my-extra-server httpd-service-type
16804 (list
16805 (httpd-virtualhost
16806 "*:80"
16807 (list (string-append
16808 "ServerName "www.example.com
16809 DocumentRoot \"/srv/http/www.example.com\"")))))
16810@end example
16811
16812@table @asis
16813@item @code{addresses-and-ports}
16814The addresses and ports for the @code{VirtualHost} directive.
16815
16816@item @code{contents}
16817The contents of the @code{VirtualHost} directive, this should be a list of
16818strings and G-expressions.
16819
16820@end table
16821@end deffn
16822
16823@subsubheading NGINX
16824
16825@deffn {Scheme Variable} nginx-service-type
16826Service type for the @uref{https://nginx.org/,NGinx} web server. The value
16827for this service type is a @code{<nginx-configuration>} record.
16828
16829A simple example configuration is given below.
16830
16831@example
16832(service nginx-service-type
16833 (nginx-configuration
16834 (server-blocks
16835 (list (nginx-server-configuration
16836 (server-name '("www.example.com"))
16837 (root "/srv/http/www.example.com"))))))
16838@end example
16839
16840In addition to adding server blocks to the service configuration directly,
16841this service can be extended by other services to add server blocks, as in
16842this example:
16843
16844@example
16845(simple-service 'my-extra-server nginx-service-type
16846 (list (nginx-server-configuration
16847 (root "/srv/http/extra-website")
16848 (try-files (list "$uri" "$uri/index.html")))))
16849@end example
16850@end deffn
16851
16852At startup, @command{nginx} has not yet read its configuration file, so it
16853uses a default file to log error messages. If it fails to load its
16854configuration file, that is where error messages are logged. After the
16855configuration file is loaded, the default error log file changes as per
16856configuration. In our case, startup error messages can be found in
16857@file{/var/run/nginx/logs/error.log}, and after configuration in
16858@file{/var/log/nginx/error.log}. The second location can be changed with
16859the @var{log-directory} configuration option.
16860
16861@deffn {Data Type} nginx-configuration
16862This data type represents the configuration for NGinx. Some configuration
16863can be done through this and the other provided record types, or
16864alternatively, a config file can be provided.
16865
16866@table @asis
16867@item @code{nginx} (default: @code{nginx})
16868The nginx package to use.
16869
16870@item @code{log-directory} (default: @code{"/var/log/nginx"})
16871The directory to which NGinx will write log files.
16872
16873@item @code{run-directory} (default: @code{"/var/run/nginx"})
16874The directory in which NGinx will create a pid file, and write temporary
16875files.
16876
16877@item @code{server-blocks} (default: @code{'()})
16878A list of @dfn{server blocks} to create in the generated configuration file,
16879the elements should be of type @code{<nginx-server-configuration>}.
16880
16881The following example would setup NGinx to serve @code{www.example.com} from
16882the @code{/srv/http/www.example.com} directory, without using HTTPS.
16883@example
16884(service nginx-service-type
16885 (nginx-configuration
16886 (server-blocks
16887 (list (nginx-server-configuration
16888 (server-name '("www.example.com"))
16889 (root "/srv/http/www.example.com"))))))
16890@end example
16891
16892@item @code{upstream-blocks} (default: @code{'()})
16893A list of @dfn{upstream blocks} to create in the generated configuration
16894file, the elements should be of type @code{<nginx-upstream-configuration>}.
16895
16896Configuring upstreams through the @code{upstream-blocks} can be useful when
16897combined with @code{locations} in the @code{<nginx-server-configuration>}
16898records. The following example creates a server configuration with one
16899location configuration, that will proxy requests to a upstream
16900configuration, which will handle requests with two servers.
16901
16902@example
16903(service
16904 nginx-service-type
16905 (nginx-configuration
16906 (server-blocks
16907 (list (nginx-server-configuration
16908 (server-name '("www.example.com"))
16909 (root "/srv/http/www.example.com")
16910 (locations
16911 (list
16912 (nginx-location-configuration
16913 (uri "/path1")
16914 (body '("proxy_pass http://server-proxy;"))))))))
16915 (upstream-blocks
16916 (list (nginx-upstream-configuration
16917 (name "server-proxy")
16918 (servers (list "server1.example.com"
16919 "server2.example.com")))))))
16920@end example
16921
16922@item @code{file} (default: @code{#f})
16923If a configuration @var{file} is provided, this will be used, rather than
16924generating a configuration file from the provided @code{log-directory},
16925@code{run-directory}, @code{server-blocks} and @code{upstream-blocks}. For
16926proper operation, these arguments should match what is in @var{file} to
16927ensure that the directories are created when the service is activated.
16928
16929This can be useful if you have an existing configuration file, or it's not
16930possible to do what is required through the other parts of the
16931nginx-configuration record.
16932
16933@item @code{server-names-hash-bucket-size} (default: @code{#f})
16934Bucket size for the server names hash tables, defaults to @code{#f} to use
16935the size of the processors cache line.
16936
16937@item @code{server-names-hash-bucket-max-size} (default: @code{#f})
16938Maximum bucket size for the server names hash tables.
16939
16940@item @code{extra-content} (default: @code{""})
16941Extra content for the @code{http} block. Should be string or a string
16942valued G-expression.
16943
16944@end table
16945@end deffn
16946
16947@deftp {Data Type} nginx-server-configuration
16948Data type representing the configuration of an nginx server block. This
16949type has the following parameters:
16950
16951@table @asis
16952@item @code{listen} (default: @code{'("80" "443 ssl")})
16953Each @code{listen} directive sets the address and port for IP, or the path
16954for a UNIX-domain socket on which the server will accept requests. Both
16955address and port, or only address or only port can be specified. An address
16956may also be a hostname, for example:
16957
16958@example
16959'("127.0.0.1:8000" "127.0.0.1" "8000" "*:8000" "localhost:8000")
16960@end example
16961
16962@item @code{server-name} (default: @code{(list 'default)})
16963A list of server names this server represents. @code{'default} represents
16964the default server for connections matching no other server.
16965
16966@item @code{root} (default: @code{"/srv/http"})
16967Root of the website nginx will serve.
16968
16969@item @code{locations} (default: @code{'()})
16970A list of @dfn{nginx-location-configuration} or
16971@dfn{nginx-named-location-configuration} records to use within this server
16972block.
16973
16974@item @code{index} (default: @code{(list "index.html")})
16975Index files to look for when clients ask for a directory. If it cannot be
16976found, Nginx will send the list of files in the directory.
16977
16978@item @code{try-files} (default: @code{'()})
16979A list of files whose existence is checked in the specified order.
16980@code{nginx} will use the first file it finds to process the request.
16981
16982@item @code{ssl-certificate} (default: @code{#f})
16983Where to find the certificate for secure connections. Set it to @code{#f}
16984if you don't have a certificate or you don't want to use HTTPS.
16985
16986@item @code{ssl-certificate-key} (default: @code{#f})
16987Where to find the private key for secure connections. Set it to @code{#f}
16988if you don't have a key or you don't want to use HTTPS.
16989
16990@item @code{server-tokens?} (default: @code{#f})
16991Whether the server should add its configuration to response.
16992
16993@item @code{raw-content} (default: @code{'()})
16994A list of raw lines added to the server block.
16995
16996@end table
16997@end deftp
16998
16999@deftp {Data Type} nginx-upstream-configuration
17000Data type representing the configuration of an nginx @code{upstream} block.
17001This type has the following parameters:
17002
17003@table @asis
17004@item @code{name}
17005Name for this group of servers.
17006
17007@item @code{servers}
17008Specify the addresses of the servers in the group. The address can be
793dcd8c
LC
17009specified as a IP address (e.g.@: @samp{127.0.0.1}), domain name (e.g.@:
17010@samp{backend1.example.com}) or a path to a UNIX socket using the prefix
17011@samp{unix:}. For addresses using an IP address or domain name, the default
17012port is 80, and a different port can be specified explicitly.
1e40e70b
JL
17013
17014@end table
17015@end deftp
17016
17017@deftp {Data Type} nginx-location-configuration
17018Data type representing the configuration of an nginx @code{location} block.
17019This type has the following parameters:
17020
17021@table @asis
17022@item @code{uri}
17023URI which this location block matches.
17024
17025@anchor{nginx-location-configuration body}
17026@item @code{body}
17027Body of the location block, specified as a list of strings. This can contain
17028many configuration directives. For example, to pass requests to a upstream
17029server group defined using an @code{nginx-upstream-configuration} block, the
17030following directive would be specified in the body @samp{(list "proxy_pass
17031http://upstream-name;")}.
17032
17033@end table
17034@end deftp
17035
17036@deftp {Data Type} nginx-named-location-configuration
17037Data type representing the configuration of an nginx named location block.
17038Named location blocks are used for request redirection, and not used for
17039regular request processing. This type has the following parameters:
17040
17041@table @asis
17042@item @code{name}
17043Name to identify this location block.
17044
17045@item @code{body}
17046@xref{nginx-location-configuration body}, as the body for named location
17047blocks can be used in a similar way to the
17048@code{nginx-location-configuration body}. One restriction is that the body
17049of a named location block cannot contain location blocks.
17050
17051@end table
17052@end deftp
17053
17054@subsubheading Varnish Cache
17055@cindex Varnish
17056Varnish is a fast cache server that sits in between web applications and end
17057users. It proxies requests from clients and caches the accessed URLs such
17058that multiple requests for the same resource only creates one request to the
17059back-end.
17060
17061@defvr {Scheme Variable} varnish-service-type
17062Service type for the Varnish daemon.
17063@end defvr
17064
17065@deftp {Data Type} varnish-configuration
17066Data type representing the @code{varnish} service configuration. This type
17067has the following parameters:
17068
17069@table @asis
17070@item @code{package} (default: @code{varnish})
17071The Varnish package to use.
17072
17073@item @code{name} (default: @code{"default"})
17074A name for this Varnish instance. Varnish will create a directory in
17075@file{/var/varnish/} with this name and keep temporary files there. If the
17076name starts with a forward slash, it is interpreted as an absolute directory
17077name.
17078
17079Pass the @code{-n} argument to other Varnish programs to connect to the
793dcd8c 17080named instance, e.g.@: @command{varnishncsa -n default}.
1e40e70b
JL
17081
17082@item @code{backend} (default: @code{"localhost:8080"})
17083The backend to use. This option has no effect if @code{vcl} is set.
17084
17085@item @code{vcl} (default: #f)
17086The @dfn{VCL} (Varnish Configuration Language) program to run. If this is
17087@code{#f}, Varnish will proxy @code{backend} using the default
17088configuration. Otherwise this must be a file-like object with valid VCL
17089syntax.
17090
17091@c Varnish does not support HTTPS, so keep this URL to avoid confusion.
17092For example, to mirror @url{http://www.gnu.org,www.gnu.org} with VCL you can
17093do something along these lines:
17094
17095@example
17096(define %gnu-mirror
17097 (plain-file
17098 "gnu.vcl"
17099 "vcl 4.1;
17100backend gnu @{ .host = "www.gnu.org"; @}"))
17101
17102(operating-system
17103 ...
17104 (services (cons (service varnish-service-type
17105 (varnish-configuration
17106 (listen '(":80"))
17107 (vcl %gnu-mirror)))
17108 %base-services)))
17109@end example
17110
17111The configuration of an already running Varnish instance can be inspected
17112and changed using the @command{varnishadm} program.
17113
17114Consult the @url{https://varnish-cache.org/docs/,Varnish User Guide} and
17115@url{https://book.varnish-software.com/4.0/,Varnish Book} for comprehensive
17116documentation on Varnish and its configuration language.
17117
17118@item @code{listen} (default: @code{'("localhost:80")})
17119List of addresses Varnish will listen on.
17120
17121@item @code{storage} (default: @code{'("malloc,128m")})
17122List of storage backends that will be available in VCL.
17123
17124@item @code{parameters} (default: @code{'()})
17125List of run-time parameters in the form @code{'(("parameter" . "value"))}.
17126
17127@item @code{extra-options} (default: @code{'()})
17128Additional arguments to pass to the @command{varnishd} process.
17129
17130@end table
17131@end deftp
17132
17133@subsubheading FastCGI
17134@cindex fastcgi
17135@cindex fcgiwrap
17136FastCGI is an interface between the front-end and the back-end of a web
17137service. It is a somewhat legacy facility; new web services should
17138generally just talk HTTP between the front-end and the back-end. However
17139there are a number of back-end services such as PHP or the optimized HTTP
17140Git repository access that use FastCGI, so we have support for it in Guix.
17141
17142To use FastCGI, you configure the front-end web server (e.g., nginx) to
17143dispatch some subset of its requests to the fastcgi backend, which listens
17144on a local TCP or UNIX socket. There is an intermediary @code{fcgiwrap}
17145program that sits between the actual backend process and the web server.
17146The front-end indicates which backend program to run, passing that
17147information to the @code{fcgiwrap} process.
17148
17149@defvr {Scheme Variable} fcgiwrap-service-type
17150A service type for the @code{fcgiwrap} FastCGI proxy.
17151@end defvr
17152
17153@deftp {Data Type} fcgiwrap-configuration
17154Data type representing the configuration of the @code{fcgiwrap} serice.
17155This type has the following parameters:
17156@table @asis
17157@item @code{package} (default: @code{fcgiwrap})
17158The fcgiwrap package to use.
17159
17160@item @code{socket} (default: @code{tcp:127.0.0.1:9000})
17161The socket on which the @code{fcgiwrap} process should listen, as a string.
17162Valid @var{socket} values include @code{unix:@var{/path/to/unix/socket}},
17163@code{tcp:@var{dot.ted.qu.ad}:@var{port}} and
17164@code{tcp6:[@var{ipv6_addr}]:port}.
17165
17166@item @code{user} (default: @code{fcgiwrap})
17167@itemx @code{group} (default: @code{fcgiwrap})
17168The user and group names, as strings, under which to run the @code{fcgiwrap}
17169process. The @code{fastcgi} service will ensure that if the user asks for
17170the specific user or group names @code{fcgiwrap} that the corresponding user
17171and/or group is present on the system.
17172
17173It is possible to configure a FastCGI-backed web service to pass HTTP
17174authentication information from the front-end to the back-end, and to allow
17175@code{fcgiwrap} to run the back-end process as a corresponding local user.
17176To enable this capability on the back-end., run @code{fcgiwrap} as the
17177@code{root} user and group. Note that this capability also has to be
17178configured on the front-end as well.
17179@end table
17180@end deftp
17181
17182@cindex php-fpm
17183PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI
17184implementation with some additional features useful for sites of any size.
17185
17186These features include:
17187@itemize @bullet
17188@item Adaptive process spawning
17189@item Basic statistics (similar to Apache's mod_status)
17190@item Advanced process management with graceful stop/start
17191@item Ability to start workers with different uid/gid/chroot/environment
17192and different php.ini (replaces safe_mode)
17193@item Stdout & stderr logging
17194@item Emergency restart in case of accidental opcode cache destruction
17195@item Accelerated upload support
17196@item Support for a "slowlog"
17197@item Enhancements to FastCGI, such as fastcgi_finish_request() -
17198a special function to finish request & flush all data while continuing to do
17199something time-consuming (video converting, stats processing, etc.)
17200@end itemize
793dcd8c 17201...@: and much more.
1e40e70b
JL
17202
17203@defvr {Scheme Variable} php-fpm-service-type
17204A Service type for @code{php-fpm}.
17205@end defvr
17206
17207@deftp {Data Type} php-fpm-configuration
17208Data Type for php-fpm service configuration.
17209@table @asis
17210@item @code{php} (default: @code{php})
17211The php package to use.
17212@item @code{socket} (default: @code{(string-append "/var/run/php" (version-major (package-version php)) "-fpm.sock")})
17213The address on which to accept FastCGI requests. Valid syntaxes are:
17214@table @asis
17215@item @code{"ip.add.re.ss:port"}
17216Listen on a TCP socket to a specific address on a specific port.
17217@item @code{"port"}
17218Listen on a TCP socket to all addresses on a specific port.
17219@item @code{"/path/to/unix/socket"}
17220Listen on a unix socket.
17221@end table
17222
17223@item @code{user} (default: @code{php-fpm})
17224User who will own the php worker processes.
17225@item @code{group} (default: @code{php-fpm})
17226Group of the worker processes.
17227@item @code{socket-user} (default: @code{php-fpm})
17228User who can speak to the php-fpm socket.
17229@item @code{socket-group} (default: @code{php-fpm})
17230Group that can speak to the php-fpm socket.
17231@item @code{pid-file} (default: @code{(string-append "/var/run/php" (version-major (package-version php)) "-fpm.pid")})
17232The process id of the php-fpm process is written to this file once the
17233service has started.
17234@item @code{log-file} (default: @code{(string-append "/var/log/php" (version-major (package-version php)) "-fpm.log")})
17235Log for the php-fpm master process.
17236@item @code{process-manager} (default: @code{(php-fpm-dynamic-process-manager-configuration)})
17237Detailed settings for the php-fpm process manager. Must be either:
17238@table @asis
17239@item @code{<php-fpm-dynamic-process-manager-configuration>}
17240@item @code{<php-fpm-static-process-manager-configuration>}
17241@item @code{<php-fpm-on-demand-process-manager-configuration>}
17242@end table
17243@item @code{display-errors} (default @code{#f})
17244Determines whether php errors and warning should be sent to clients and
17245displayed in their browsers. This is useful for local php development, but
17246a security risk for public sites, as error messages can reveal passwords and
17247personal data.
17248@item @code{workers-logfile} (default @code{(string-append "/var/log/php" (version-major (package-version php)) "-fpm.www.log")})
17249This file will log the @code{stderr} outputs of php worker processes. Can
17250be set to @code{#f} to disable logging.
17251@item @code{file} (default @code{#f})
17252An optional override of the whole configuration. You can use the
17253@code{mixed-text-file} function or an absolute filepath for it.
17254@end table
17255@end deftp
17256
17257@deftp {Data type} php-fpm-dynamic-process-manager-configuration
17258Data Type for the @code{dynamic} php-fpm process manager. With the
17259@code{dynamic} process manager, spare worker processes are kept around based
17260on it's configured limits.
17261@table @asis
17262@item @code{max-children} (default: @code{5})
17263Maximum of worker processes.
17264@item @code{start-servers} (default: @code{2})
17265How many worker processes should be started on start-up.
17266@item @code{min-spare-servers} (default: @code{1})
17267How many spare worker processes should be kept around at minimum.
17268@item @code{max-spare-servers} (default: @code{3})
17269How many spare worker processes should be kept around at maximum.
17270@end table
17271@end deftp
17272
17273@deftp {Data type} php-fpm-static-process-manager-configuration
17274Data Type for the @code{static} php-fpm process manager. With the
17275@code{static} process manager, an unchanging number of worker processes are
17276created.
17277@table @asis
17278@item @code{max-children} (default: @code{5})
17279Maximum of worker processes.
17280@end table
17281@end deftp
17282
17283@deftp {Data type} php-fpm-on-demand-process-manager-configuration
17284Data Type for the @code{on-demand} php-fpm process manager. With the
17285@code{on-demand} process manager, worker processes are only created as
17286requests arrive.
17287@table @asis
17288@item @code{max-children} (default: @code{5})
17289Maximum of worker processes.
17290@item @code{process-idle-timeout} (default: @code{10})
17291The time in seconds after which a process with no requests is killed.
17292@end table
17293@end deftp
17294
17295
17296@deffn {Scheme Procedure} nginx-php-fpm-location @
17297 [#:nginx-package nginx] @ [socket (string-append "/var/run/php" @
17298(version-major (package-version php)) @ "-fpm.sock")] A helper function to
17299quickly add php to an @code{nginx-server-configuration}.
17300@end deffn
17301
17302A simple services setup for nginx with php can look like this:
17303@example
17304(services (cons* (service dhcp-client-service-type)
17305 (service php-fpm-service-type)
17306 (service nginx-service-type
17307 (nginx-server-configuration
17308 (server-name '("example.com"))
17309 (root "/srv/http/")
17310 (locations
17311 (list (nginx-php-location)))
17312 (https-port #f)
17313 (ssl-certificate #f)
17314 (ssl-certificate-key #f)))
17315 %base-services))
17316@end example
17317
17318@cindex cat-avatar-generator
17319The cat avatar generator is a simple service to demonstrate the use of
17320php-fpm in @code{Nginx}. It is used to generate cat avatar from a seed, for
17321instance the hash of a user's email address.
17322
17323@deffn {Scheme Procedure} cat-avatar-generator-serice @
17324 [#:cache-dir "/var/cache/cat-avatar-generator"] @ [#:package
17325cat-avatar-generator] @ [#:configuration (nginx-server-configuration)]
17326Returns an nginx-server-configuration that inherits @code{configuration}.
17327It extends the nginx configuration to add a server block that serves
17328@code{package}, a version of cat-avatar-generator. During execution,
17329cat-avatar-generator will be able to use @code{cache-dir} as its cache
17330directory.
17331@end deffn
17332
17333A simple setup for cat-avatar-generator can look like this:
17334@example
17335(services (cons* (cat-avatar-generator-service
17336 #:configuration
17337 (nginx-server-configuration
17338 (server-name '("example.com"))))
17339 ...
17340 %base-services))
17341@end example
17342
17343@subsubheading Hpcguix-web
17344
17345@cindex hpcguix-web
17346The @uref{hpcguix-web, https://github.com/UMCUGenetics/hpcguix-web/} program
17347is a customizable web interface to browse Guix packages, initially designed
17348for users of high-performance computing (HPC) clusters.
17349
17350@defvr {Scheme Variable} hpcguix-web-service-type
17351The service type for @code{hpcguix-web}.
17352@end defvr
17353
17354@deftp {Data Type} hpcguix-web-configuration
17355Data type for the hpcguix-web service configuration.
17356
17357@table @asis
17358@item @code{specs}
17359A gexp (@pxref{G-Ausdrücke}) specifying the hpcguix-web service
17360configuration. The main items available in this spec are:
17361
17362@table @asis
17363@item @code{title-prefix} (default: @code{"hpcguix | "})
17364The page title prefix.
17365
17366@item @code{guix-command} (default: @code{"guix"})
17367The @command{guix} command.
17368
17369@item @code{package-filter-proc} (default: @code{(const #t)})
17370A procedure specifying how to filter packages that are displayed.
17371
17372@item @code{package-page-extension-proc} (default: @code{(const '())})
17373Extension package for @code{hpcguix-web}.
17374
17375@item @code{menu} (default: @code{'()})
17376Additional entry in page @code{menu}.
17377
17378@item @code{channels} (default: @code{%default-channels})
17379List of channels from which the package list is built (@pxref{Channels}).
17380
17381@item @code{package-list-expiration} (default: @code{(* 12 3600)})
17382The expiration time, in seconds, after which the package list is rebuilt
17383from the latest instances of the given channels.
17384@end table
17385
17386See the hpcguix-web repository for a
17387@uref{https://github.com/UMCUGenetics/hpcguix-web/blob/master/hpcweb-configuration.scm,
17388complete example}.
17389
17390@item @code{package} (default: @code{hpcguix-web})
17391The hpcguix-web package to use.
17392@end table
17393@end deftp
17394
17395A typical hpcguix-web service declaration looks like this:
17396
17397@example
17398(service hpcguix-web-service-type
17399 (hpcguix-web-configuration
17400 (specs
17401 #~(define site-config
17402 (hpcweb-configuration
17403 (title-prefix "Guix-HPC - ")
17404 (menu '(("/about" "ABOUT"))))))))
17405@end example
17406
17407@quotation Anmerkung
17408The hpcguix-web service periodically updates the package list it publishes
17409by pulling channels from Git. To that end, it needs to access X.509
17410certificates so that it can authenticate Git servers when communicating over
17411HTTPS, and it assumes that @file{/etc/ssl/certs} contains those
17412certificates.
17413
17414Thus, make sure to add @code{nss-certs} or another certificate package to
17415the @code{packages} field of your configuration. @ref{X.509-Zertifikate},
17416for more information on X.509 certificates.
17417@end quotation
17418
17419@node Zertifikatsdienste
17420@subsubsection Zertifikatsdienste
17421
17422@cindex Web
17423@cindex HTTP, HTTPS
17424@cindex Let's Encrypt
17425@cindex TLS certificates
17426The @code{(gnu services certbot)} module provides a service to automatically
17427obtain a valid TLS certificate from the Let's Encrypt certificate
17428authority. These certificates can then be used to serve content securely
17429over HTTPS or other TLS-based protocols, with the knowledge that the client
17430will be able to verify the server's authenticity.
17431
17432@url{https://letsencrypt.org/, Let's Encrypt} provides the @code{certbot}
17433tool to automate the certification process. This tool first securely
17434generates a key on the server. It then makes a request to the Let's Encrypt
17435certificate authority (CA) to sign the key. The CA checks that the request
17436originates from the host in question by using a challenge-response protocol,
17437requiring the server to provide its response over HTTP. If that protocol
17438completes successfully, the CA signs the key, resulting in a certificate.
17439That certificate is valid for a limited period of time, and therefore to
17440continue to provide TLS services, the server needs to periodically ask the
17441CA to renew its signature.
17442
17443The certbot service automates this process: the initial key generation, the
17444initial certification request to the Let's Encrypt service, the web server
17445challenge/response integration, writing the certificate to disk, the
17446automated periodic renewals, and the deployment tasks associated with the
793dcd8c
LC
17447renewal (e.g.@: reloading services, copying keys with different
17448permissions).
1e40e70b
JL
17449
17450Certbot is run twice a day, at a random minute within the hour. It won't do
17451anything until your certificates are due for renewal or revoked, but running
17452it regularly would give your service a chance of staying online in case a
17453Let's Encrypt-initiated revocation happened for some reason.
17454
17455By using this service, you agree to the ACME Subscriber Agreement, which can
17456be found there: @url{https://acme-v01.api.letsencrypt.org/directory}.
17457
17458@defvr {Scheme Variable} certbot-service-type
17459A service type for the @code{certbot} Let's Encrypt client. Its value must
17460be a @code{certbot-configuration} record as in this example:
17461
17462@example
17463(define %nginx-deploy-hook
17464 (program-file
17465 "nginx-deploy-hook"
17466 #~(let ((pid (call-with-input-file "/var/run/nginx/pid" read)))
17467 (kill pid SIGHUP))))
17468
17469(service certbot-service-type
17470 (certbot-configuration
17471 (email "foo@@example.net")
17472 (certificates
17473 (list
17474 (certificate-configuration
17475 (domains '("example.net" "www.example.net"))
17476 (deploy-hook %nginx-deploy-hook))
17477 (certificate-configuration
17478 (domains '("bar.example.net")))))))
17479@end example
17480
17481See below for details about @code{certbot-configuration}.
17482@end defvr
17483
17484@deftp {Data Type} certbot-configuration
17485Data type representing the configuration of the @code{certbot} service.
17486This type has the following parameters:
17487
17488@table @asis
17489@item @code{package} (default: @code{certbot})
17490The certbot package to use.
17491
17492@item @code{webroot} (default: @code{/var/www})
17493The directory from which to serve the Let's Encrypt challenge/response
17494files.
17495
17496@item @code{certificates} (default: @code{()})
17497A list of @code{certificates-configuration}s for which to generate
17498certificates and request signatures. Each certificate has a @code{name} and
17499several @code{domains}.
17500
17501@item @code{email}
17502Mandatory email used for registration, recovery contact, and important
17503account notifications.
17504
17505@item @code{rsa-key-size} (default: @code{2048})
17506Size of the RSA key.
17507
17508@item @code{default-location} (default: @i{see below})
17509The default @code{nginx-location-configuration}. Because @code{certbot}
17510needs to be able to serve challenges and responses, it needs to be able to
17511run a web server. It does so by extending the @code{nginx} web service with
17512an @code{nginx-server-configuration} listening on the @var{domains} on port
1751380, and which has a @code{nginx-location-configuration} for the
17514@code{/.well-known/} URI path subspace used by Let's Encrypt. @xref{Web-Dienste}, for more on these nginx configuration data types.
17515
17516Requests to other URL paths will be matched by the @code{default-location},
17517which if present is added to all @code{nginx-server-configuration}s.
17518
17519By default, the @code{default-location} will issue a redirect from
17520@code{http://@var{domain}/...} to @code{https://@var{domain}/...}, leaving
17521you to define what to serve on your site via @code{https}.
17522
17523Pass @code{#f} to not issue a default location.
17524@end table
17525@end deftp
17526
17527@deftp {Data Type} certificate-configuration
17528Data type representing the configuration of a certificate. This type has
17529the following parameters:
17530
17531@table @asis
17532@item @code{name} (default: @i{see below})
17533This name is used by Certbot for housekeeping and in file paths; it doesn't
17534affect the content of the certificate itself. To see certificate names, run
17535@code{certbot certificates}.
17536
17537Its default is the first provided domain.
17538
17539@item @code{domains} (default: @code{()})
17540The first domain provided will be the subject CN of the certificate, and all
17541domains will be Subject Alternative Names on the certificate.
17542
17543@item @code{deploy-hook} (default: @code{#f})
17544Command to be run in a shell once for each successfully issued certificate.
17545For this command, the shell variable @code{$RENEWED_LINEAGE} will point to
17546the config live subdirectory (for example,
17547@samp{"/etc/letsencrypt/live/example.com"}) containing the new certificates
17548and keys; the shell variable @code{$RENEWED_DOMAINS} will contain a
17549space-delimited list of renewed certificate domains (for example,
17550@samp{"example.com www.example.com"}.
17551
17552@end table
17553@end deftp
17554
17555For each @code{certificate-configuration}, the certificate is saved to
17556@code{/etc/letsencrypt/live/@var{name}/fullchain.pem} and the key is saved
17557to @code{/etc/letsencrypt/live/@var{name}/privkey.pem}.
17558@node DNS-Dienste
17559@subsubsection DNS-Dienste
17560@cindex DNS (domain name system)
17561@cindex domain name system (DNS)
17562
17563The @code{(gnu services dns)} module provides services related to the
17564@dfn{domain name system} (DNS). It provides a server service for hosting an
17565@emph{authoritative} DNS server for multiple zones, slave or master. This
17566service uses @uref{https://www.knot-dns.cz/, Knot DNS}. And also a caching
17567and forwarding DNS server for the LAN, which uses
17568@uref{http://www.thekelleys.org.uk/dnsmasq/doc.html, dnsmasq}.
17569
17570@subsubheading Knot Service
17571
17572An example configuration of an authoritative server for two zones, one
17573master and one slave, is:
17574
17575@lisp
17576(define-zone-entries example.org.zone
17577;; Name TTL Class Type Data
17578 ("@@" "" "IN" "A" "127.0.0.1")
17579 ("@@" "" "IN" "NS" "ns")
17580 ("ns" "" "IN" "A" "127.0.0.1"))
17581
17582(define master-zone
17583 (knot-zone-configuration
17584 (domain "example.org")
17585 (zone (zone-file
17586 (origin "example.org")
17587 (entries example.org.zone)))))
17588
17589(define slave-zone
17590 (knot-zone-configuration
17591 (domain "plop.org")
17592 (dnssec-policy "default")
17593 (master (list "plop-master"))))
17594
17595(define plop-master
17596 (knot-remote-configuration
17597 (id "plop-master")
17598 (address (list "208.76.58.171"))))
17599
17600(operating-system
17601 ;; ...
17602 (services (cons* (service knot-service-type
17603 (knot-configuration
17604 (remotes (list plop-master))
17605 (zones (list master-zone slave-zone))))
17606 ;; ...
17607 %base-services)))
17608@end lisp
17609
17610@deffn {Scheme Variable} knot-service-type
17611This is the type for the Knot DNS server.
17612
17613Knot DNS is an authoritative DNS server, meaning that it can serve multiple
17614zones, that is to say domain names you would buy from a registrar. This
17615server is not a resolver, meaning that it can only resolve names for which
17616it is authoritative. This server can be configured to serve zones as a
17617master server or a slave server as a per-zone basis. Slave zones will get
17618their data from masters, and will serve it as an authoritative server. From
17619the point of view of a resolver, there is no difference between master and
17620slave.
17621
17622The following data types are used to configure the Knot DNS server:
17623@end deffn
17624
17625@deftp {Data Type} knot-key-configuration
17626Data type representing a key. This type has the following parameters:
17627
17628@table @asis
17629@item @code{id} (default: @code{""})
17630An identifier for other configuration fields to refer to this key. IDs must
17631be unique and must not be empty.
17632
17633@item @code{algorithm} (default: @code{#f})
17634The algorithm to use. Choose between @code{#f}, @code{'hmac-md5},
17635@code{'hmac-sha1}, @code{'hmac-sha224}, @code{'hmac-sha256},
17636@code{'hmac-sha384} and @code{'hmac-sha512}.
17637
17638@item @code{secret} (default: @code{""})
17639The secret key itself.
17640
17641@end table
17642@end deftp
17643
17644@deftp {Data Type} knot-acl-configuration
17645Data type representing an Access Control List (ACL) configuration. This
17646type has the following parameters:
17647
17648@table @asis
17649@item @code{id} (default: @code{""})
17650An identifier for ether configuration fields to refer to this key. IDs must
17651be unique and must not be empty.
17652
17653@item @code{address} (default: @code{'()})
17654An ordered list of IP addresses, network subnets, or network ranges
17655represented with strings. The query must match one of them. Empty value
17656means that address match is not required.
17657
17658@item @code{key} (default: @code{'()})
17659An ordered list of references to keys represented with strings. The string
17660must match a key ID defined in a @code{knot-key-configuration}. No key
17661means that a key is not require to match that ACL.
17662
17663@item @code{action} (default: @code{'()})
17664An ordered list of actions that are permitted or forbidden by this ACL.
17665Possible values are lists of zero or more elements from @code{'transfer},
17666@code{'notify} and @code{'update}.
17667
17668@item @code{deny?} (default: @code{#f})
17669When true, the ACL defines restrictions. Listed actions are forbidden.
17670When false, listed actions are allowed.
17671
17672@end table
17673@end deftp
17674
17675@deftp {Data Type} zone-entry
17676Data type represnting a record entry in a zone file. This type has the
17677following parameters:
17678
17679@table @asis
17680@item @code{name} (default: @code{"@@"})
17681The name of the record. @code{"@@"} refers to the origin of the zone.
17682Names are relative to the origin of the zone. For example, in the
17683@code{example.org} zone, @code{"ns.example.org"} actually refers to
17684@code{ns.example.org.example.org}. Names ending with a dot are absolute,
17685which means that @code{"ns.example.org."} refers to @code{ns.example.org}.
17686
17687@item @code{ttl} (default: @code{""})
17688The Time-To-Live (TTL) of this record. If not set, the default TTL is used.
17689
17690@item @code{class} (default: @code{"IN"})
17691The class of the record. Knot currently supports only @code{"IN"} and
17692partially @code{"CH"}.
17693
17694@item @code{type} (default: @code{"A"})
17695The type of the record. Common types include A (IPv4 address), AAAA (IPv6
17696address), NS (Name Server) and MX (Mail eXchange). Many other types are
17697defined.
17698
17699@item @code{data} (default: @code{""})
17700The data contained in the record. For instance an IP address associated
17701with an A record, or a domain name associated with an NS record. Remember
17702that domain names are relative to the origin unless they end with a dot.
17703
17704@end table
17705@end deftp
17706
17707@deftp {Data Type} zone-file
17708Data type representing the content of a zone file. This type has the
17709following parameters:
17710
17711@table @asis
17712@item @code{entries} (default: @code{'()})
17713The list of entries. The SOA record is taken care of, so you don't need to
17714put it in the list of entries. This list should probably contain an entry
17715for your primary authoritative DNS server. Other than using a list of
17716entries directly, you can use @code{define-zone-entries} to define a object
17717containing the list of entries more easily, that you can later pass to the
17718@code{entries} field of the @code{zone-file}.
17719
17720@item @code{origin} (default: @code{""})
17721The name of your zone. This parameter cannot be empty.
17722
17723@item @code{ns} (default: @code{"ns"})
17724The domain of your primary authoritative DNS server. The name is relative
17725to the origin, unless it ends with a dot. It is mandatory that this primary
17726DNS server corresponds to an NS record in the zone and that it is associated
17727to an IP address in the list of entries.
17728
17729@item @code{mail} (default: @code{"hostmaster"})
17730An email address people can contact you at, as the owner of the zone. This
17731is translated as @code{<mail>@@<origin>}.
17732
17733@item @code{serial} (default: @code{1})
17734The serial number of the zone. As this is used to keep track of changes by
17735both slaves and resolvers, it is mandatory that it @emph{never} decreases.
17736Always increment it when you make a change in your zone.
17737
17738@item @code{refresh} (default: @code{(* 2 24 3600)})
17739The frequency at which slaves will do a zone transfer. This value is a
17740number of seconds. It can be computed by multiplications or with
17741@code{(string->duration)}.
17742
17743@item @code{retry} (default: @code{(* 15 60)})
17744The period after which a slave will retry to contact its master when it
17745fails to do so a first time.
17746
17747@item @code{expiry} (default: @code{(* 14 24 3600)})
17748Default TTL of records. Existing records are considered correct for at most
17749this amount of time. After this period, resolvers will invalidate their
17750cache and check again that it still exists.
17751
17752@item @code{nx} (default: @code{3600})
17753Default TTL of inexistant records. This delay is usually short because you
17754want your new domains to reach everyone quickly.
17755
17756@end table
17757@end deftp
17758
17759@deftp {Data Type} knot-remote-configuration
17760Data type representing a remote configuration. This type has the following
17761parameters:
17762
17763@table @asis
17764@item @code{id} (default: @code{""})
17765An identifier for other configuration fields to refer to this remote. IDs
17766must be unique and must not be empty.
17767
17768@item @code{address} (default: @code{'()})
17769An ordered list of destination IP addresses. Addresses are tried in
17770sequence. An optional port can be given with the @@ separator. For
17771instance: @code{(list "1.2.3.4" "2.3.4.5@@53")}. Default port is 53.
17772
17773@item @code{via} (default: @code{'()})
17774An ordered list of source IP addresses. An empty list will have Knot choose
17775an appropriate source IP. An optional port can be given with the @@
17776separator. The default is to choose at random.
17777
17778@item @code{key} (default: @code{#f})
17779A reference to a key, that is a string containing the identifier of a key
17780defined in a @code{knot-key-configuration} field.
17781
17782@end table
17783@end deftp
17784
17785@deftp {Data Type} knot-keystore-configuration
17786Data type representing a keystore to hold dnssec keys. This type has the
17787following parameters:
17788
17789@table @asis
17790@item @code{id} (default: @code{""})
17791The id of the keystore. It must not be empty.
17792
17793@item @code{backend} (default: @code{'pem})
17794The backend to store the keys in. Can be @code{'pem} or @code{'pkcs11}.
17795
17796@item @code{config} (default: @code{"/var/lib/knot/keys/keys"})
17797The configuration string of the backend. An example for the PKCS#11 is:
17798@code{"pkcs11:token=knot;pin-value=1234
17799/gnu/store/.../lib/pkcs11/libsofthsm2.so"}. For the pem backend, the string
17800reprensents a path in the file system.
17801
17802@end table
17803@end deftp
17804
17805@deftp {Data Type} knot-policy-configuration
17806Data type representing a dnssec policy. Knot DNS is able to automatically
17807sign your zones. It can either generate and manage your keys automatically
17808or use keys that you generate.
17809
17810Dnssec is usually implemented using two keys: a Key Signing Key (KSK) that
17811is used to sign the second, and a Zone Signing Key (ZSK) that is used to
17812sign the zone. In order to be trusted, the KSK needs to be present in the
17813parent zone (usually a top-level domain). If your registrar supports
17814dnssec, you will have to send them your KSK's hash so they can add a DS
17815record in their zone. This is not automated and need to be done each time
17816you change your KSK.
17817
17818The policy also defines the lifetime of keys. Usually, ZSK can be changed
17819easily and use weaker cryptographic functions (they use lower parameters) in
17820order to sign records quickly, so they are changed often. The KSK however
17821requires manual interaction with the registrar, so they are changed less
17822often and use stronger parameters because they sign only one record.
17823
17824This type has the following parameters:
17825
17826@table @asis
17827@item @code{id} (default: @code{""})
17828The id of the policy. It must not be empty.
17829
17830@item @code{keystore} (default: @code{"default"})
17831A reference to a keystore, that is a string containing the identifier of a
17832keystore defined in a @code{knot-keystore-configuration} field. The
17833@code{"default"} identifier means the default keystore (a kasp database that
17834was setup by this service).
17835
17836@item @code{manual?} (default: @code{#f})
17837Whether the key management is manual or automatic.
17838
17839@item @code{single-type-signing?} (default: @code{#f})
17840When @code{#t}, use the Single-Type Signing Scheme.
17841
17842@item @code{algorithm} (default: @code{"ecdsap256sha256"})
17843An algorithm of signing keys and issued signatures.
17844
17845@item @code{ksk-size} (default: @code{256})
17846The length of the KSK. Note that this value is correct for the default
17847algorithm, but would be unsecure for other algorithms.
17848
17849@item @code{zsk-size} (default: @code{256})
17850The length of the ZSK. Note that this value is correct for the default
17851algorithm, but would be unsecure for other algorithms.
17852
17853@item @code{dnskey-ttl} (default: @code{'default})
17854The TTL value for DNSKEY records added into zone apex. The special
17855@code{'default} value means same as the zone SOA TTL.
17856
17857@item @code{zsk-lifetime} (default: @code{(* 30 24 3600)})
17858The period between ZSK publication and the next rollover initiation.
17859
17860@item @code{propagation-delay} (default: @code{(* 24 3600)})
17861An extra delay added for each key rollover step. This value should be high
17862enough to cover propagation of data from the master server to all slaves.
17863
17864@item @code{rrsig-lifetime} (default: @code{(* 14 24 3600)})
17865A validity period of newly issued signatures.
17866
17867@item @code{rrsig-refresh} (default: @code{(* 7 24 3600)})
17868A period how long before a signature expiration the signature will be
17869refreshed.
17870
17871@item @code{nsec3?} (default: @code{#f})
17872When @code{#t}, NSEC3 will be used instead of NSEC.
17873
17874@item @code{nsec3-iterations} (default: @code{5})
17875The number of additional times the hashing is performed.
17876
17877@item @code{nsec3-salt-length} (default: @code{8})
17878The length of a salt field in octets, which is appended to the original
17879owner name before hashing.
17880
17881@item @code{nsec3-salt-lifetime} (default: @code{(* 30 24 3600)})
17882The validity period of newly issued salt field.
17883
17884@end table
17885@end deftp
17886
17887@deftp {Data Type} knot-zone-configuration
17888Data type representing a zone served by Knot. This type has the following
17889parameters:
17890
17891@table @asis
17892@item @code{domain} (default: @code{""})
17893The domain served by this configuration. It must not be empty.
17894
17895@item @code{file} (default: @code{""})
17896The file where this zone is saved. This parameter is ignored by master
17897zones. Empty means default location that depends on the domain name.
17898
17899@item @code{zone} (default: @code{(zone-file)})
17900The content of the zone file. This parameter is ignored by slave zones. It
17901must contain a zone-file record.
17902
17903@item @code{master} (default: @code{'()})
17904A list of master remotes. When empty, this zone is a master. When set,
17905this zone is a slave. This is a list of remotes identifiers.
17906
17907@item @code{ddns-master} (default: @code{#f})
17908The main master. When empty, it defaults to the first master in the list of
17909masters.
17910
17911@item @code{notify} (default: @code{'()})
17912A list of slave remote identifiers.
17913
17914@item @code{acl} (default: @code{'()})
17915A list of acl identifiers.
17916
17917@item @code{semantic-checks?} (default: @code{#f})
17918When set, this adds more semantic checks to the zone.
17919
17920@item @code{disable-any?} (default: @code{#f})
17921When set, this forbids queries of the ANY type.
17922
17923@item @code{zonefile-sync} (default: @code{0})
17924The delay between a modification in memory and on disk. 0 means immediate
17925synchronization.
17926
17927@item @code{serial-policy} (default: @code{'increment})
17928A policy between @code{'increment} and @code{'unixtime}.
17929
17930@end table
17931@end deftp
17932
17933@deftp {Data Type} knot-configuration
17934Data type representing the Knot configuration. This type has the following
17935parameters:
17936
17937@table @asis
17938@item @code{knot} (default: @code{knot})
17939The Knot package.
17940
17941@item @code{run-directory} (default: @code{"/var/run/knot"})
17942The run directory. This directory will be used for pid file and sockets.
17943
17944@item @code{listen-v4} (default: @code{"0.0.0.0"})
17945An ip address on which to listen.
17946
17947@item @code{listen-v6} (default: @code{"::"})
17948An ip address on which to listen.
17949
17950@item @code{listen-port} (default: @code{53})
17951A port on which to listen.
17952
17953@item @code{keys} (default: @code{'()})
17954The list of knot-key-configuration used by this configuration.
17955
17956@item @code{acls} (default: @code{'()})
17957The list of knot-acl-configuration used by this configuration.
17958
17959@item @code{remotes} (default: @code{'()})
17960The list of knot-remote-configuration used by this configuration.
17961
17962@item @code{zones} (default: @code{'()})
17963The list of knot-zone-configuration used by this configuration.
17964
17965@end table
17966@end deftp
17967
17968@subsubheading Dnsmasq Service
17969
17970@deffn {Scheme Variable} dnsmasq-service-type
17971This is the type of the dnsmasq service, whose value should be an
17972@code{dnsmasq-configuration} object as in this example:
17973
17974@example
17975(service dnsmasq-service-type
17976 (dnsmasq-configuration
17977 (no-resolv? #t)
17978 (servers '("192.168.1.1"))))
17979@end example
17980@end deffn
17981
17982@deftp {Data Type} dnsmasq-configuration
17983Data type representing the configuration of dnsmasq.
17984
17985@table @asis
17986@item @code{package} (default: @var{dnsmasq})
17987Package object of the dnsmasq server.
17988
17989@item @code{no-hosts?} (default: @code{#f})
17990When true, don't read the hostnames in /etc/hosts.
17991
17992@item @code{port} (default: @code{53})
17993The port to listen on. Setting this to zero completely disables DNS
17994responses, leaving only DHCP and/or TFTP functions.
17995
17996@item @code{local-service?} (default: @code{#t})
17997Accept DNS queries only from hosts whose address is on a local subnet, ie a
17998subnet for which an interface exists on the server.
17999
18000@item @code{listen-addresses} (default: @code{'()})
18001Listen on the given IP addresses.
18002
18003@item @code{resolv-file} (default: @code{"/etc/resolv.conf"})
18004The file to read the IP address of the upstream nameservers from.
18005
18006@item @code{no-resolv?} (default: @code{#f})
18007When true, don't read @var{resolv-file}.
18008
18009@item @code{servers} (default: @code{'()})
18010Specify IP address of upstream servers directly.
18011
18012@item @code{cache-size} (default: @code{150})
18013Set the size of dnsmasq's cache. Setting the cache size to zero disables
18014caching.
18015
18016@item @code{negative-cache?} (default: @code{#t})
18017When false, disable negative caching.
18018
18019@end table
18020@end deftp
18021
18022@subsubheading ddclient Service
18023
18024@cindex ddclient
18025The ddclient service described below runs the ddclient daemon, which takes
18026care of automatically updating DNS entries for service providers such as
18027@uref{https://dyn.com/dns/, Dyn}.
18028
18029The following example show instantiates the service with its default
18030configuration:
18031
18032@example
18033(service ddclient-service-type)
18034@end example
18035
18036Note that ddclient needs to access credentials that are stored in a
18037@dfn{secret file}, by default @file{/etc/ddclient/secrets} (see
18038@code{secret-file} below.) You are expected to create this file manually,
18039in an ``out-of-band'' fashion (you @emph{could} make this file part of the
18040service configuration, for instance by using @code{plain-file}, but it will
18041be world-readable @i{via} @file{/gnu/store}.) See the examples in the
18042@file{share/ddclient} directory of the @code{ddclient} package.
18043
18044@c %start of fragment
18045
18046Available @code{ddclient-configuration} fields are:
18047
18048@deftypevr {@code{ddclient-configuration} parameter} package ddclient
18049The ddclient package.
18050
18051@end deftypevr
18052
18053@deftypevr {@code{ddclient-configuration} parameter} integer daemon
18054The period after which ddclient will retry to check IP and domain name.
18055
18056Defaults to @samp{300}.
18057
18058@end deftypevr
18059
18060@deftypevr {@code{ddclient-configuration} parameter} boolean syslog
18061Use syslog for the output.
18062
18063Defaults to @samp{#t}.
18064
18065@end deftypevr
18066
18067@deftypevr {@code{ddclient-configuration} parameter} string mail
18068Mail to user.
18069
18070Defaults to @samp{"root"}.
18071
18072@end deftypevr
18073
18074@deftypevr {@code{ddclient-configuration} parameter} string mail-failure
18075Mail failed update to user.
18076
18077Defaults to @samp{"root"}.
18078
18079@end deftypevr
18080
18081@deftypevr {@code{ddclient-configuration} parameter} string pid
18082The ddclient PID file.
18083
18084Defaults to @samp{"/var/run/ddclient/ddclient.pid"}.
18085
18086@end deftypevr
18087
18088@deftypevr {@code{ddclient-configuration} parameter} boolean ssl
18089Enable SSL support.
18090
18091Defaults to @samp{#t}.
18092
18093@end deftypevr
18094
18095@deftypevr {@code{ddclient-configuration} parameter} string user
18096Specifies the user name or ID that is used when running ddclient program.
18097
18098Defaults to @samp{"ddclient"}.
18099
18100@end deftypevr
18101
18102@deftypevr {@code{ddclient-configuration} parameter} string group
18103Group of the user who will run the ddclient program.
18104
18105Defaults to @samp{"ddclient"}.
18106
18107@end deftypevr
18108
18109@deftypevr {@code{ddclient-configuration} parameter} string secret-file
18110Secret file which will be appended to @file{ddclient.conf} file. This file
18111contains credentials for use by ddclient. You are expected to create it
18112manually.
18113
18114Defaults to @samp{"/etc/ddclient/secrets.conf"}.
18115
18116@end deftypevr
18117
18118@deftypevr {@code{ddclient-configuration} parameter} list extra-options
18119Extra options will be appended to @file{ddclient.conf} file.
18120
18121Defaults to @samp{()}.
18122
18123@end deftypevr
18124
18125
18126@c %end of fragment
18127
18128
18129@node VPN-Dienste
18130@subsubsection VPN-Dienste
18131@cindex VPN (virtual private network)
18132@cindex virtual private network (VPN)
18133
18134The @code{(gnu services vpn)} module provides services related to
18135@dfn{virtual private networks} (VPNs). It provides a @emph{client} service
18136for your machine to connect to a VPN, and a @emph{servire} service for your
18137machine to host a VPN. Both services use @uref{https://openvpn.net/,
18138OpenVPN}.
18139
18140@deffn {Scheme Procedure} openvpn-client-service @
18141 [#:config (openvpn-client-configuration)]
18142
18143Return a service that runs @command{openvpn}, a VPN daemon, as a client.
18144@end deffn
18145
18146@deffn {Scheme Procedure} openvpn-server-service @
18147 [#:config (openvpn-server-configuration)]
18148
18149Return a service that runs @command{openvpn}, a VPN daemon, as a server.
18150
18151Both can be run simultaneously.
18152@end deffn
18153
18154@c %automatically generated documentation
18155
18156Available @code{openvpn-client-configuration} fields are:
18157
18158@deftypevr {@code{openvpn-client-configuration} parameter} package openvpn
18159The OpenVPN package.
18160
18161@end deftypevr
18162
18163@deftypevr {@code{openvpn-client-configuration} parameter} string pid-file
18164The OpenVPN pid file.
18165
18166Defaults to @samp{"/var/run/openvpn/openvpn.pid"}.
18167
18168@end deftypevr
18169
18170@deftypevr {@code{openvpn-client-configuration} parameter} proto proto
18171The protocol (UDP or TCP) used to open a channel between clients and
18172servers.
18173
18174Defaults to @samp{udp}.
18175
18176@end deftypevr
18177
18178@deftypevr {@code{openvpn-client-configuration} parameter} dev dev
18179The device type used to represent the VPN connection.
18180
18181Defaults to @samp{tun}.
18182
18183@end deftypevr
18184
18185@deftypevr {@code{openvpn-client-configuration} parameter} string ca
18186The certificate authority to check connections against.
18187
18188Defaults to @samp{"/etc/openvpn/ca.crt"}.
18189
18190@end deftypevr
18191
18192@deftypevr {@code{openvpn-client-configuration} parameter} string cert
18193The certificate of the machine the daemon is running on. It should be
18194signed by the authority given in @code{ca}.
18195
18196Defaults to @samp{"/etc/openvpn/client.crt"}.
18197
18198@end deftypevr
18199
18200@deftypevr {@code{openvpn-client-configuration} parameter} string key
18201The key of the machine the daemon is running on. It must be the key whose
18202certificate is @code{cert}.
18203
18204Defaults to @samp{"/etc/openvpn/client.key"}.
18205
18206@end deftypevr
18207
18208@deftypevr {@code{openvpn-client-configuration} parameter} boolean comp-lzo?
18209Whether to use the lzo compression algorithm.
18210
18211Defaults to @samp{#t}.
18212
18213@end deftypevr
18214
18215@deftypevr {@code{openvpn-client-configuration} parameter} boolean persist-key?
18216Don't re-read key files across SIGUSR1 or --ping-restart.
18217
18218Defaults to @samp{#t}.
18219
18220@end deftypevr
18221
18222@deftypevr {@code{openvpn-client-configuration} parameter} boolean persist-tun?
18223Don't close and reopen TUN/TAP device or run up/down scripts across SIGUSR1
18224or --ping-restart restarts.
18225
18226Defaults to @samp{#t}.
18227
18228@end deftypevr
18229
18230@deftypevr {@code{openvpn-client-configuration} parameter} number verbosity
18231Verbosity level.
18232
18233Defaults to @samp{3}.
18234
18235@end deftypevr
18236
18237@deftypevr {@code{openvpn-client-configuration} parameter} tls-auth-client tls-auth
18238Add an additional layer of HMAC authentication on top of the TLS control
18239channel to protect against DoS attacks.
18240
18241Defaults to @samp{#f}.
18242
18243@end deftypevr
18244
18245@deftypevr {@code{openvpn-client-configuration} parameter} key-usage verify-key-usage?
18246Whether to check the server certificate has server usage extension.
18247
18248Defaults to @samp{#t}.
18249
18250@end deftypevr
18251
18252@deftypevr {@code{openvpn-client-configuration} parameter} bind bind?
18253Bind to a specific local port number.
18254
18255Defaults to @samp{#f}.
18256
18257@end deftypevr
18258
18259@deftypevr {@code{openvpn-client-configuration} parameter} resolv-retry resolv-retry?
18260Retry resolving server address.
18261
18262Defaults to @samp{#t}.
18263
18264@end deftypevr
18265
18266@deftypevr {@code{openvpn-client-configuration} parameter} openvpn-remote-list remote
18267A list of remote servers to connect to.
18268
18269Defaults to @samp{()}.
18270
18271Available @code{openvpn-remote-configuration} fields are:
18272
18273@deftypevr {@code{openvpn-remote-configuration} parameter} string name
18274Server name.
18275
18276Defaults to @samp{"my-server"}.
18277
18278@end deftypevr
18279
18280@deftypevr {@code{openvpn-remote-configuration} parameter} number port
18281Port number the server listens to.
18282
18283Defaults to @samp{1194}.
18284
18285@end deftypevr
18286
18287@end deftypevr
18288@c %end of automatic openvpn-client documentation
18289
18290@c %automatically generated documentation
18291
18292Available @code{openvpn-server-configuration} fields are:
18293
18294@deftypevr {@code{openvpn-server-configuration} parameter} package openvpn
18295The OpenVPN package.
18296
18297@end deftypevr
18298
18299@deftypevr {@code{openvpn-server-configuration} parameter} string pid-file
18300The OpenVPN pid file.
18301
18302Defaults to @samp{"/var/run/openvpn/openvpn.pid"}.
18303
18304@end deftypevr
18305
18306@deftypevr {@code{openvpn-server-configuration} parameter} proto proto
18307The protocol (UDP or TCP) used to open a channel between clients and
18308servers.
18309
18310Defaults to @samp{udp}.
18311
18312@end deftypevr
18313
18314@deftypevr {@code{openvpn-server-configuration} parameter} dev dev
18315The device type used to represent the VPN connection.
18316
18317Defaults to @samp{tun}.
18318
18319@end deftypevr
18320
18321@deftypevr {@code{openvpn-server-configuration} parameter} string ca
18322The certificate authority to check connections against.
18323
18324Defaults to @samp{"/etc/openvpn/ca.crt"}.
18325
18326@end deftypevr
18327
18328@deftypevr {@code{openvpn-server-configuration} parameter} string cert
18329The certificate of the machine the daemon is running on. It should be
18330signed by the authority given in @code{ca}.
18331
18332Defaults to @samp{"/etc/openvpn/client.crt"}.
18333
18334@end deftypevr
18335
18336@deftypevr {@code{openvpn-server-configuration} parameter} string key
18337The key of the machine the daemon is running on. It must be the key whose
18338certificate is @code{cert}.
18339
18340Defaults to @samp{"/etc/openvpn/client.key"}.
18341
18342@end deftypevr
18343
18344@deftypevr {@code{openvpn-server-configuration} parameter} boolean comp-lzo?
18345Whether to use the lzo compression algorithm.
18346
18347Defaults to @samp{#t}.
18348
18349@end deftypevr
18350
18351@deftypevr {@code{openvpn-server-configuration} parameter} boolean persist-key?
18352Don't re-read key files across SIGUSR1 or --ping-restart.
18353
18354Defaults to @samp{#t}.
18355
18356@end deftypevr
18357
18358@deftypevr {@code{openvpn-server-configuration} parameter} boolean persist-tun?
18359Don't close and reopen TUN/TAP device or run up/down scripts across SIGUSR1
18360or --ping-restart restarts.
18361
18362Defaults to @samp{#t}.
18363
18364@end deftypevr
18365
18366@deftypevr {@code{openvpn-server-configuration} parameter} number verbosity
18367Verbosity level.
18368
18369Defaults to @samp{3}.
18370
18371@end deftypevr
18372
18373@deftypevr {@code{openvpn-server-configuration} parameter} tls-auth-server tls-auth
18374Add an additional layer of HMAC authentication on top of the TLS control
18375channel to protect against DoS attacks.
18376
18377Defaults to @samp{#f}.
18378
18379@end deftypevr
18380
18381@deftypevr {@code{openvpn-server-configuration} parameter} number port
18382Specifies the port number on which the server listens.
18383
18384Defaults to @samp{1194}.
18385
18386@end deftypevr
18387
18388@deftypevr {@code{openvpn-server-configuration} parameter} ip-mask server
18389An ip and mask specifying the subnet inside the virtual network.
18390
18391Defaults to @samp{"10.8.0.0 255.255.255.0"}.
18392
18393@end deftypevr
18394
18395@deftypevr {@code{openvpn-server-configuration} parameter} cidr6 server-ipv6
18396A CIDR notation specifying the IPv6 subnet inside the virtual network.
18397
18398Defaults to @samp{#f}.
18399
18400@end deftypevr
18401
18402@deftypevr {@code{openvpn-server-configuration} parameter} string dh
18403The Diffie-Hellman parameters file.
18404
18405Defaults to @samp{"/etc/openvpn/dh2048.pem"}.
18406
18407@end deftypevr
18408
18409@deftypevr {@code{openvpn-server-configuration} parameter} string ifconfig-pool-persist
18410The file that records client IPs.
18411
18412Defaults to @samp{"/etc/openvpn/ipp.txt"}.
18413
18414@end deftypevr
18415
18416@deftypevr {@code{openvpn-server-configuration} parameter} gateway redirect-gateway?
18417When true, the server will act as a gateway for its clients.
18418
18419Defaults to @samp{#f}.
18420
18421@end deftypevr
18422
18423@deftypevr {@code{openvpn-server-configuration} parameter} boolean client-to-client?
18424When true, clients are allowed to talk to each other inside the VPN.
18425
18426Defaults to @samp{#f}.
18427
18428@end deftypevr
18429
18430@deftypevr {@code{openvpn-server-configuration} parameter} keepalive keepalive
18431Causes ping-like messages to be sent back and forth over the link so that
18432each side knows when the other side has gone down. @code{keepalive}
18433requires a pair. The first element is the period of the ping sending, and
18434the second element is the timeout before considering the other side down.
18435
18436@end deftypevr
18437
18438@deftypevr {@code{openvpn-server-configuration} parameter} number max-clients
18439The maximum number of clients.
18440
18441Defaults to @samp{100}.
18442
18443@end deftypevr
18444
18445@deftypevr {@code{openvpn-server-configuration} parameter} string status
18446The status file. This file shows a small report on current connection. It
18447is truncated and rewritten every minute.
18448
18449Defaults to @samp{"/var/run/openvpn/status"}.
18450
18451@end deftypevr
18452
18453@deftypevr {@code{openvpn-server-configuration} parameter} openvpn-ccd-list client-config-dir
18454The list of configuration for some clients.
18455
18456Defaults to @samp{()}.
18457
18458Available @code{openvpn-ccd-configuration} fields are:
18459
18460@deftypevr {@code{openvpn-ccd-configuration} parameter} string name
18461Client name.
18462
18463Defaults to @samp{"client"}.
18464
18465@end deftypevr
18466
18467@deftypevr {@code{openvpn-ccd-configuration} parameter} ip-mask iroute
18468Client own network
18469
18470Defaults to @samp{#f}.
18471
18472@end deftypevr
18473
18474@deftypevr {@code{openvpn-ccd-configuration} parameter} ip-mask ifconfig-push
18475Client VPN IP.
18476
18477Defaults to @samp{#f}.
18478
18479@end deftypevr
18480
18481@end deftypevr
18482
18483
18484@c %end of automatic openvpn-server documentation
18485
18486
18487@node Network File System
18488@subsubsection Network File System
18489@cindex NFS
18490
18491The @code{(gnu services nfs)} module provides the following services, which
18492are most commonly used in relation to mounting or exporting directory trees
18493as @dfn{network file systems} (NFS).
18494
18495@subsubheading RPC Bind Service
18496@cindex rpcbind
18497
18498The RPC Bind service provides a facility to map program numbers into
18499universal addresses. Many NFS related services use this facility. Hence it
18500is automatically started when a dependent service starts.
18501
18502@defvr {Scheme Variable} rpcbind-service-type
18503A service type for the RPC portmapper daemon.
18504@end defvr
18505
18506
18507@deftp {Data Type} rpcbind-configuration
18508Data type representing the configuration of the RPC Bind Service. This type
18509has the following parameters:
18510@table @asis
18511@item @code{rpcbind} (default: @code{rpcbind})
18512The rpcbind package to use.
18513
18514@item @code{warm-start?} (default: @code{#t})
18515If this parameter is @code{#t}, then the daemon will read a state file on
18516startup thus reloading state information saved by a previous instance.
18517@end table
18518@end deftp
18519
18520
18521@subsubheading Pipefs Pseudo File System
18522@cindex pipefs
18523@cindex rpc_pipefs
18524
18525The pipefs file system is used to transfer NFS related data between the
18526kernel and user space programs.
18527
18528@defvr {Scheme Variable} pipefs-service-type
18529A service type for the pipefs pseudo file system.
18530@end defvr
18531
18532@deftp {Data Type} pipefs-configuration
18533Data type representing the configuration of the pipefs pseudo file system
18534service. This type has the following parameters:
18535@table @asis
18536@item @code{mount-point} (default: @code{"/var/lib/nfs/rpc_pipefs"})
18537The directory to which the file system is to be attached.
18538@end table
18539@end deftp
18540
18541
18542@subsubheading GSS Daemon Service
18543@cindex GSSD
18544@cindex GSS
18545@cindex global security system
18546
18547The @dfn{global security system} (GSS) daemon provides strong security for
18548RPC based protocols. Before exchanging RPC requests an RPC client must
18549establish a security context. Typically this is done using the Kerberos
18550command @command{kinit} or automatically at login time using PAM services
18551(@pxref{Kerberos-Dienste}).
18552
18553@defvr {Scheme Variable} gss-service-type
18554A service type for the Global Security System (GSS) daemon.
18555@end defvr
18556
18557@deftp {Data Type} gss-configuration
18558Data type representing the configuration of the GSS daemon service. This
18559type has the following parameters:
18560@table @asis
18561@item @code{nfs-utils} (default: @code{nfs-utils})
18562The package in which the @command{rpc.gssd} command is to be found.
18563
18564@item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"})
18565The directory where the pipefs file system is mounted.
18566
18567@end table
18568@end deftp
18569
18570
18571@subsubheading IDMAP Daemon Service
18572@cindex idmapd
18573@cindex name mapper
18574
18575The idmap daemon service provides mapping between user IDs and user names.
18576Typically it is required in order to access file systems mounted via NFSv4.
18577
18578@defvr {Scheme Variable} idmap-service-type
18579A service type for the Identity Mapper (IDMAP) daemon.
18580@end defvr
18581
18582@deftp {Data Type} idmap-configuration
18583Data type representing the configuration of the IDMAP daemon service. This
18584type has the following parameters:
18585@table @asis
18586@item @code{nfs-utils} (default: @code{nfs-utils})
18587The package in which the @command{rpc.idmapd} command is to be found.
18588
18589@item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"})
18590The directory where the pipefs file system is mounted.
18591
18592@item @code{domain} (default: @code{#f})
18593The local NFSv4 domain name. This must be a string or @code{#f}. If it is
18594@code{#f} then the daemon will use the host's fully qualified domain name.
18595
18596@end table
18597@end deftp
18598
18599@node Kontinuierliche Integration
18600@subsubsection Kontinuierliche Integration
18601
18602@cindex continuous integration
18603@uref{https://git.savannah.gnu.org/cgit/guix/guix-cuirass.git, Cuirass} is a
18604continuous integration tool for Guix. It can be used both for development
18605and for providing substitutes to others (@pxref{Substitute}).
18606
18607The @code{(gnu services cuirass)} module provides the following service.
18608
18609@defvr {Scheme Procedure} cuirass-service-type
18610The type of the Cuirass service. Its value must be a
18611@code{cuirass-configuration} object, as described below.
18612@end defvr
18613
18614To add build jobs, you have to set the @code{specifications} field of the
18615configuration. Here is an example of a service that polls the Guix
18616repository and builds the packages from a manifest. Some of the packages
18617are defined in the @code{"custom-packages"} input, which is the equivalent
18618of @code{GUIX_PACKAGE_PATH}.
18619
18620@example
18621(define %cuirass-specs
18622 #~(list
18623 '((#:name . "my-manifest")
18624 (#:load-path-inputs . ("guix"))
18625 (#:package-path-inputs . ("custom-packages"))
18626 (#:proc-input . "guix")
18627 (#:proc-file . "build-aux/cuirass/gnu-system.scm")
18628 (#:proc . cuirass-jobs)
18629 (#:proc-args . ((subset . "manifests")
18630 (systems . ("x86_64-linux"))
18631 (manifests . (("config" . "guix/manifest.scm")))))
18632 (#:inputs . (((#:name . "guix")
18633 (#:url . "git://git.savannah.gnu.org/guix.git")
18634 (#:load-path . ".")
18635 (#:branch . "master")
18636 (#:no-compile? . #t))
18637 ((#:name . "config")
18638 (#:url . "git://git.example.org/config.git")
18639 (#:load-path . ".")
18640 (#:branch . "master")
18641 (#:no-compile? . #t))
18642 ((#:name . "custom-packages")
18643 (#:url . "git://git.example.org/custom-packages.git")
18644 (#:load-path . ".")
18645 (#:branch . "master")
18646 (#:no-compile? . #t)))))))
18647
18648(service cuirass-service-type
18649 (cuirass-configuration
18650 (specifications %cuirass-specs)))
18651@end example
18652
18653While information related to build jobs is located directly in the
18654specifications, global settings for the @command{cuirass} process are
18655accessible in other @code{cuirass-configuration} fields.
18656
18657@deftp {Data Type} cuirass-configuration
18658Data type representing the configuration of Cuirass.
18659
18660@table @asis
18661@item @code{log-file} (default: @code{"/var/log/cuirass.log"})
18662Location of the log file.
18663
18664@item @code{cache-directory} (default: @code{"/var/cache/cuirass"})
18665Location of the repository cache.
18666
18667@item @code{user} (default: @code{"cuirass"})
18668Owner of the @code{cuirass} process.
18669
18670@item @code{group} (default: @code{"cuirass"})
18671Owner's group of the @code{cuirass} process.
18672
18673@item @code{interval} (default: @code{60})
18674Number of seconds between the poll of the repositories followed by the
18675Cuirass jobs.
18676
18677@item @code{database} (default: @code{"/var/lib/cuirass/cuirass.db"})
18678Location of sqlite database which contains the build results and previously
18679added specifications.
18680
793dcd8c
LC
18681@item @code{ttl} (default: @code{(* 30 24 3600)})
18682Specifies the time-to-live (TTL) in seconds of garbage collector roots that
18683are registered for build results. This means that build results are
18684protected from garbage collection for at least @var{ttl} seconds.
18685
1e40e70b
JL
18686@item @code{port} (default: @code{8081})
18687Port number used by the HTTP server.
18688
18689@item --listen=@var{host}
18690Listen on the network interface for @var{host}. The default is to accept
18691connections from localhost.
18692
18693@item @code{specifications} (default: @code{#~'()})
18694A gexp (@pxref{G-Ausdrücke}) that evaluates to a list of specifications,
18695where a specification is an association list (@pxref{Associations Lists,,,
18696guile, GNU Guile Reference Manual}) whose keys are keywords
18697(@code{#:keyword-example}) as shown in the example above.
18698
18699@item @code{use-substitutes?} (default: @code{#f})
18700This allows using substitutes to avoid building every dependencies of a job
18701from source.
18702
18703@item @code{one-shot?} (default: @code{#f})
18704Only evaluate specifications and build derivations once.
18705
18706@item @code{fallback?} (default: @code{#f})
18707When substituting a pre-built binary fails, fall back to building packages
18708locally.
18709
18710@item @code{cuirass} (default: @code{cuirass})
18711The Cuirass package to use.
18712@end table
18713@end deftp
18714
18715@node Power Management Services
18716@subsubsection Power Management Services
18717
18718@cindex tlp
18719@cindex power management with TLP
18720@subsubheading TLP daemon
18721
18722The @code{(gnu services pm)} module provides a Guix service definition for
18723the Linux power management tool TLP.
18724
18725TLP enables various powersaving modes in userspace and kernel. Contrary to
18726@code{upower-service}, it is not a passive, monitoring tool, as it will
18727apply custom settings each time a new power source is detected. More
18728information can be found at @uref{http://linrunner.de/en/tlp/tlp.html, TLP
18729home page}.
18730
18731@deffn {Scheme Variable} tlp-service-type
18732The service type for the TLP tool. Its value should be a valid TLP
18733configuration (see below). To use the default settings, simply write:
18734@example
18735(service tlp-service-type)
18736@end example
18737@end deffn
18738
18739By default TLP does not need much configuration but most TLP parameters can
18740be tweaked using @code{tlp-configuration}.
18741
18742Each parameter definition is preceded by its type; for example,
18743@samp{boolean foo} indicates that the @code{foo} parameter should be
18744specified as a boolean. Types starting with @code{maybe-} denote parameters
18745that won't show up in TLP config file when their value is @code{'disabled}.
18746
18747@c The following documentation was initially generated by
18748@c (generate-tlp-documentation) in (gnu services pm). Manually maintained
18749@c documentation is better, so we shouldn't hesitate to edit below as
18750@c needed. However if the change you want to make to this documentation
18751@c can be done in an automated way, it's probably easier to change
18752@c (generate-documentation) than to make it below and have to deal with
18753@c the churn as TLP updates.
18754
18755Available @code{tlp-configuration} fields are:
18756
18757@deftypevr {@code{tlp-configuration} parameter} package tlp
18758The TLP package.
18759
18760@end deftypevr
18761
18762@deftypevr {@code{tlp-configuration} parameter} boolean tlp-enable?
18763Set to true if you wish to enable TLP.
18764
18765Defaults to @samp{#t}.
18766
18767@end deftypevr
18768
18769@deftypevr {@code{tlp-configuration} parameter} string tlp-default-mode
18770Default mode when no power supply can be detected. Alternatives are AC and
18771BAT.
18772
18773Defaults to @samp{"AC"}.
18774
18775@end deftypevr
18776
18777@deftypevr {@code{tlp-configuration} parameter} non-negative-integer disk-idle-secs-on-ac
18778Number of seconds Linux kernel has to wait after the disk goes idle, before
18779syncing on AC.
18780
18781Defaults to @samp{0}.
18782
18783@end deftypevr
18784
18785@deftypevr {@code{tlp-configuration} parameter} non-negative-integer disk-idle-secs-on-bat
18786Same as @code{disk-idle-ac} but on BAT mode.
18787
18788Defaults to @samp{2}.
18789
18790@end deftypevr
18791
18792@deftypevr {@code{tlp-configuration} parameter} non-negative-integer max-lost-work-secs-on-ac
18793Dirty pages flushing periodicity, expressed in seconds.
18794
18795Defaults to @samp{15}.
18796
18797@end deftypevr
18798
18799@deftypevr {@code{tlp-configuration} parameter} non-negative-integer max-lost-work-secs-on-bat
18800Same as @code{max-lost-work-secs-on-ac} but on BAT mode.
18801
18802Defaults to @samp{60}.
18803
18804@end deftypevr
18805
18806@deftypevr {@code{tlp-configuration} parameter} maybe-space-separated-string-list cpu-scaling-governor-on-ac
18807CPU frequency scaling governor on AC mode. With intel_pstate driver,
18808alternatives are powersave and performance. With acpi-cpufreq driver,
18809alternatives are ondemand, powersave, performance and conservative.
18810
18811Defaults to @samp{disabled}.
18812
18813@end deftypevr
18814
18815@deftypevr {@code{tlp-configuration} parameter} maybe-space-separated-string-list cpu-scaling-governor-on-bat
18816Same as @code{cpu-scaling-governor-on-ac} but on BAT mode.
18817
18818Defaults to @samp{disabled}.
18819
18820@end deftypevr
18821
18822@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-scaling-min-freq-on-ac
18823Set the min available frequency for the scaling governor on AC.
18824
18825Defaults to @samp{disabled}.
18826
18827@end deftypevr
18828
18829@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-scaling-max-freq-on-ac
18830Set the max available frequency for the scaling governor on AC.
18831
18832Defaults to @samp{disabled}.
18833
18834@end deftypevr
18835
18836@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-scaling-min-freq-on-bat
18837Set the min available frequency for the scaling governor on BAT.
18838
18839Defaults to @samp{disabled}.
18840
18841@end deftypevr
18842
18843@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-scaling-max-freq-on-bat
18844Set the max available frequency for the scaling governor on BAT.
18845
18846Defaults to @samp{disabled}.
18847
18848@end deftypevr
18849
18850@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-min-perf-on-ac
18851Limit the min P-state to control the power dissipation of the CPU, in AC
18852mode. Values are stated as a percentage of the available performance.
18853
18854Defaults to @samp{disabled}.
18855
18856@end deftypevr
18857
18858@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-max-perf-on-ac
18859Limit the max P-state to control the power dissipation of the CPU, in AC
18860mode. Values are stated as a percentage of the available performance.
18861
18862Defaults to @samp{disabled}.
18863
18864@end deftypevr
18865
18866@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-min-perf-on-bat
18867Same as @code{cpu-min-perf-on-ac} on BAT mode.
18868
18869Defaults to @samp{disabled}.
18870
18871@end deftypevr
18872
18873@deftypevr {@code{tlp-configuration} parameter} maybe-non-negative-integer cpu-max-perf-on-bat
18874Same as @code{cpu-max-perf-on-ac} on BAT mode.
18875
18876Defaults to @samp{disabled}.
18877
18878@end deftypevr
18879
18880@deftypevr {@code{tlp-configuration} parameter} maybe-boolean cpu-boost-on-ac?
18881Enable CPU turbo boost feature on AC mode.
18882
18883Defaults to @samp{disabled}.
18884
18885@end deftypevr
18886
18887@deftypevr {@code{tlp-configuration} parameter} maybe-boolean cpu-boost-on-bat?
18888Same as @code{cpu-boost-on-ac?} on BAT mode.
18889
18890Defaults to @samp{disabled}.
18891
18892@end deftypevr
18893
18894@deftypevr {@code{tlp-configuration} parameter} boolean sched-powersave-on-ac?
18895Allow Linux kernel to minimize the number of CPU cores/hyper-threads used
18896under light load conditions.
18897
18898Defaults to @samp{#f}.
18899
18900@end deftypevr
18901
18902@deftypevr {@code{tlp-configuration} parameter} boolean sched-powersave-on-bat?
18903Same as @code{sched-powersave-on-ac?} but on BAT mode.
18904
18905Defaults to @samp{#t}.
18906
18907@end deftypevr
18908
18909@deftypevr {@code{tlp-configuration} parameter} boolean nmi-watchdog?
18910Enable Linux kernel NMI watchdog.
18911
18912Defaults to @samp{#f}.
18913
18914@end deftypevr
18915
18916@deftypevr {@code{tlp-configuration} parameter} maybe-string phc-controls
18917For Linux kernels with PHC patch applied, change CPU voltages. An example
18918value would be @samp{"F:V F:V F:V F:V"}.
18919
18920Defaults to @samp{disabled}.
18921
18922@end deftypevr
18923
18924@deftypevr {@code{tlp-configuration} parameter} string energy-perf-policy-on-ac
18925Set CPU performance versus energy saving policy on AC. Alternatives are
18926performance, normal, powersave.
18927
18928Defaults to @samp{"performance"}.
18929
18930@end deftypevr
18931
18932@deftypevr {@code{tlp-configuration} parameter} string energy-perf-policy-on-bat
18933Same as @code{energy-perf-policy-ac} but on BAT mode.
18934
18935Defaults to @samp{"powersave"}.
18936
18937@end deftypevr
18938
18939@deftypevr {@code{tlp-configuration} parameter} space-separated-string-list disks-devices
18940Hard disk devices.
18941
18942@end deftypevr
18943
18944@deftypevr {@code{tlp-configuration} parameter} space-separated-string-list disk-apm-level-on-ac
18945Hard disk advanced power management level.
18946
18947@end deftypevr
18948
18949@deftypevr {@code{tlp-configuration} parameter} space-separated-string-list disk-apm-level-on-bat
18950Same as @code{disk-apm-bat} but on BAT mode.
18951
18952@end deftypevr
18953
18954@deftypevr {@code{tlp-configuration} parameter} maybe-space-separated-string-list disk-spindown-timeout-on-ac
18955Hard disk spin down timeout. One value has to be specified for each
18956declared hard disk.
18957
18958Defaults to @samp{disabled}.
18959
18960@end deftypevr
18961
18962@deftypevr {@code{tlp-configuration} parameter} maybe-space-separated-string-list disk-spindown-timeout-on-bat
18963Same as @code{disk-spindown-timeout-on-ac} but on BAT mode.
18964
18965Defaults to @samp{disabled}.
18966
18967@end deftypevr
18968
18969@deftypevr {@code{tlp-configuration} parameter} maybe-space-separated-string-list disk-iosched
18970Select IO scheduler for disk devices. One value has to be specified for
18971each declared hard disk. Example alternatives are cfq, deadline and noop.
18972
18973Defaults to @samp{disabled}.
18974
18975@end deftypevr
18976
18977@deftypevr {@code{tlp-configuration} parameter} string sata-linkpwr-on-ac
18978SATA aggressive link power management (ALPM) level. Alternatives are
18979min_power, medium_power, max_performance.
18980
18981Defaults to @samp{"max_performance"}.
18982
18983@end deftypevr
18984
18985@deftypevr {@code{tlp-configuration} parameter} string sata-linkpwr-on-bat
18986Same as @code{sata-linkpwr-ac} but on BAT mode.
18987
18988Defaults to @samp{"min_power"}.
18989
18990@end deftypevr
18991
18992@deftypevr {@code{tlp-configuration} parameter} maybe-string sata-linkpwr-blacklist
18993Exclude specified SATA host devices for link power management.
18994
18995Defaults to @samp{disabled}.
18996
18997@end deftypevr
18998
18999@deftypevr {@code{tlp-configuration} parameter} maybe-on-off-boolean ahci-runtime-pm-on-ac?
19000Enable Runtime Power Management for AHCI controller and disks on AC mode.
19001
19002Defaults to @samp{disabled}.
19003
19004@end deftypevr
19005
19006@deftypevr {@code{tlp-configuration} parameter} maybe-on-off-boolean ahci-runtime-pm-on-bat?
19007Same as @code{ahci-runtime-pm-on-ac} on BAT mode.
19008
19009Defaults to @samp{disabled}.
19010
19011@end deftypevr
19012
19013@deftypevr {@code{tlp-configuration} parameter} non-negative-integer ahci-runtime-pm-timeout
19014Seconds of inactivity before disk is suspended.
19015
19016Defaults to @samp{15}.
19017
19018@end deftypevr
19019
19020@deftypevr {@code{tlp-configuration} parameter} string pcie-aspm-on-ac
19021PCI Express Active State Power Management level. Alternatives are default,
19022performance, powersave.
19023
19024Defaults to @samp{"performance"}.
19025
19026@end deftypevr
19027
19028@deftypevr {@code{tlp-configuration} parameter} string pcie-aspm-on-bat
19029Same as @code{pcie-aspm-ac} but on BAT mode.
19030
19031Defaults to @samp{"powersave"}.
19032
19033@end deftypevr
19034
19035@deftypevr {@code{tlp-configuration} parameter} string radeon-power-profile-on-ac
19036Radeon graphics clock speed level. Alternatives are low, mid, high, auto,
19037default.
19038
19039Defaults to @samp{"high"}.
19040
19041@end deftypevr
19042
19043@deftypevr {@code{tlp-configuration} parameter} string radeon-power-profile-on-bat
19044Same as @code{radeon-power-ac} but on BAT mode.
19045
19046Defaults to @samp{"low"}.
19047
19048@end deftypevr
19049
19050@deftypevr {@code{tlp-configuration} parameter} string radeon-dpm-state-on-ac
19051Radeon dynamic power management method (DPM). Alternatives are battery,
19052performance.
19053
19054Defaults to @samp{"performance"}.
19055
19056@end deftypevr
19057
19058@deftypevr {@code{tlp-configuration} parameter} string radeon-dpm-state-on-bat
19059Same as @code{radeon-dpm-state-ac} but on BAT mode.
19060
19061Defaults to @samp{"battery"}.
19062
19063@end deftypevr
19064
19065@deftypevr {@code{tlp-configuration} parameter} string radeon-dpm-perf-level-on-ac
19066Radeon DPM performance level. Alternatives are auto, low, high.
19067
19068Defaults to @samp{"auto"}.
19069
19070@end deftypevr
19071
19072@deftypevr {@code{tlp-configuration} parameter} string radeon-dpm-perf-level-on-bat
19073Same as @code{radeon-dpm-perf-ac} but on BAT mode.
19074
19075Defaults to @samp{"auto"}.
19076
19077@end deftypevr
19078
19079@deftypevr {@code{tlp-configuration} parameter} on-off-boolean wifi-pwr-on-ac?
19080Wifi power saving mode.
19081
19082Defaults to @samp{#f}.
19083
19084@end deftypevr
19085
19086@deftypevr {@code{tlp-configuration} parameter} on-off-boolean wifi-pwr-on-bat?
19087Same as @code{wifi-power-ac?} but on BAT mode.
19088
19089Defaults to @samp{#t}.
19090
19091@end deftypevr
19092
19093@deftypevr {@code{tlp-configuration} parameter} y-n-boolean wol-disable?
19094Disable wake on LAN.
19095
19096Defaults to @samp{#t}.
19097
19098@end deftypevr
19099
19100@deftypevr {@code{tlp-configuration} parameter} non-negative-integer sound-power-save-on-ac
19101Timeout duration in seconds before activating audio power saving on Intel
19102HDA and AC97 devices. A value of 0 disables power saving.
19103
19104Defaults to @samp{0}.
19105
19106@end deftypevr
19107
19108@deftypevr {@code{tlp-configuration} parameter} non-negative-integer sound-power-save-on-bat
19109Same as @code{sound-powersave-ac} but on BAT mode.
19110
19111Defaults to @samp{1}.
19112
19113@end deftypevr
19114
19115@deftypevr {@code{tlp-configuration} parameter} y-n-boolean sound-power-save-controller?
19116Disable controller in powersaving mode on Intel HDA devices.
19117
19118Defaults to @samp{#t}.
19119
19120@end deftypevr
19121
19122@deftypevr {@code{tlp-configuration} parameter} boolean bay-poweroff-on-bat?
19123Enable optical drive in UltraBay/MediaBay on BAT mode. Drive can be powered
19124on again by releasing (and reinserting) the eject lever or by pressing the
19125disc eject button on newer models.
19126
19127Defaults to @samp{#f}.
19128
19129@end deftypevr
19130
19131@deftypevr {@code{tlp-configuration} parameter} string bay-device
19132Name of the optical drive device to power off.
19133
19134Defaults to @samp{"sr0"}.
19135
19136@end deftypevr
19137
19138@deftypevr {@code{tlp-configuration} parameter} string runtime-pm-on-ac
19139Runtime Power Management for PCI(e) bus devices. Alternatives are on and
19140auto.
19141
19142Defaults to @samp{"on"}.
19143
19144@end deftypevr
19145
19146@deftypevr {@code{tlp-configuration} parameter} string runtime-pm-on-bat
19147Same as @code{runtime-pm-ac} but on BAT mode.
19148
19149Defaults to @samp{"auto"}.
19150
19151@end deftypevr
19152
19153@deftypevr {@code{tlp-configuration} parameter} boolean runtime-pm-all?
19154Runtime Power Management for all PCI(e) bus devices, except blacklisted
19155ones.
19156
19157Defaults to @samp{#t}.
19158
19159@end deftypevr
19160
19161@deftypevr {@code{tlp-configuration} parameter} maybe-space-separated-string-list runtime-pm-blacklist
19162Exclude specified PCI(e) device addresses from Runtime Power Management.
19163
19164Defaults to @samp{disabled}.
19165
19166@end deftypevr
19167
19168@deftypevr {@code{tlp-configuration} parameter} space-separated-string-list runtime-pm-driver-blacklist
19169Exclude PCI(e) devices assigned to the specified drivers from Runtime Power
19170Management.
19171
19172@end deftypevr
19173
19174@deftypevr {@code{tlp-configuration} parameter} boolean usb-autosuspend?
19175Enable USB autosuspend feature.
19176
19177Defaults to @samp{#t}.
19178
19179@end deftypevr
19180
19181@deftypevr {@code{tlp-configuration} parameter} maybe-string usb-blacklist
19182Exclude specified devices from USB autosuspend.
19183
19184Defaults to @samp{disabled}.
19185
19186@end deftypevr
19187
19188@deftypevr {@code{tlp-configuration} parameter} boolean usb-blacklist-wwan?
19189Exclude WWAN devices from USB autosuspend.
19190
19191Defaults to @samp{#t}.
19192
19193@end deftypevr
19194
19195@deftypevr {@code{tlp-configuration} parameter} maybe-string usb-whitelist
19196Include specified devices into USB autosuspend, even if they are already
19197excluded by the driver or via @code{usb-blacklist-wwan?}.
19198
19199Defaults to @samp{disabled}.
19200
19201@end deftypevr
19202
19203@deftypevr {@code{tlp-configuration} parameter} maybe-boolean usb-autosuspend-disable-on-shutdown?
19204Enable USB autosuspend before shutdown.
19205
19206Defaults to @samp{disabled}.
19207
19208@end deftypevr
19209
19210@deftypevr {@code{tlp-configuration} parameter} boolean restore-device-state-on-startup?
19211Restore radio device state (bluetooth, wifi, wwan) from previous shutdown on
19212system startup.
19213
19214Defaults to @samp{#f}.
19215
19216@end deftypevr
19217
19218@cindex thermald
19219@cindex CPU frequency scaling with thermald
19220@subsubheading Thermald daemon
19221
19222The @code{(gnu services pm)} module provides an interface to thermald, a CPU
19223frequency scaling service which helps prevent overheating.
19224
19225@defvr {Scheme Variable} thermald-service-type
19226This is the service type for @uref{https://01.org/linux-thermal-daemon/,
19227thermald}, the Linux Thermal Daemon, which is responsible for controlling
19228the thermal state of processors and preventing overheating.
19229@end defvr
19230
19231@deftp {Data Type} thermald-configuration
19232Data type representing the configuration of @code{thermald-service-type}.
19233
19234@table @asis
19235@item @code{ignore-cpuid-check?} (default: @code{#f})
19236Ignore cpuid check for supported CPU models.
19237
19238@item @code{thermald} (default: @var{thermald})
19239Package object of thermald.
19240
19241@end table
19242@end deftp
19243
19244@node Audio-Dienste
19245@subsubsection Audio-Dienste
19246
19247The @code{(gnu services audio)} module provides a service to start MPD (the
19248Music Player Daemon).
19249
19250@cindex mpd
19251@subsubheading Music Player Daemon
19252
19253The Music Player Daemon (MPD) is a service that can play music while being
19254controlled from the local machine or over the network by a variety of
19255clients.
19256
19257The following example shows how one might run @code{mpd} as user
19258@code{"bob"} on port @code{6666}. It uses pulseaudio for output.
19259
19260@example
19261(service mpd-service-type
19262 (mpd-configuration
19263 (user "bob")
19264 (port "6666")))
19265@end example
19266
19267@defvr {Scheme Variable} mpd-service-type
19268The service type for @command{mpd}
19269@end defvr
19270
19271@deftp {Data Type} mpd-configuration
19272Data type representing the configuration of @command{mpd}.
19273
19274@table @asis
19275@item @code{user} (default: @code{"mpd"})
19276The user to run mpd as.
19277
19278@item @code{music-dir} (default: @code{"~/Music"})
19279The directory to scan for music files.
19280
19281@item @code{playlist-dir} (default: @code{"~/.mpd/playlists"})
19282The directory to store playlists.
19283
19284@item @code{port} (default: @code{"6600"})
19285The port to run mpd on.
19286
19287@item @code{address} (default: @code{"any"})
19288The address that mpd will bind to. To use a Unix domain socket, an absolute
19289path can be specified here.
19290
19291@end table
19292@end deftp
19293
19294@node Virtualisierungsdienste
19295@subsubsection Virtualization services
19296
19297The @code{(gnu services virtualization)} module provides services for the
19298libvirt and virtlog daemons, as well as other virtualization-related
19299services.
19300
19301@subsubheading Libvirt daemon
19302@code{libvirtd} is the server side daemon component of the libvirt
19303virtualization management system. This daemon runs on host servers and
19304performs required management tasks for virtualized guests.
19305
19306@deffn {Scheme Variable} libvirt-service-type
19307This is the type of the @uref{https://libvirt.org, libvirt daemon}. Its
19308value must be a @code{libvirt-configuration}.
19309
19310@example
19311(service libvirt-service-type
19312 (libvirt-configuration
19313 (unix-sock-group "libvirt")
19314 (tls-port "16555")))
19315@end example
19316@end deffn
19317
19318@c Auto-generated with (generate-libvirt-documentation)
19319Available @code{libvirt-configuration} fields are:
19320
19321@deftypevr {@code{libvirt-configuration} parameter} package libvirt
19322Libvirt package.
19323
19324@end deftypevr
19325
19326@deftypevr {@code{libvirt-configuration} parameter} boolean listen-tls?
19327Flag listening for secure TLS connections on the public TCP/IP port. must
19328set @code{listen} for this to have any effect.
19329
19330It is necessary to setup a CA and issue server certificates before using
19331this capability.
19332
19333Defaults to @samp{#t}.
19334
19335@end deftypevr
19336
19337@deftypevr {@code{libvirt-configuration} parameter} boolean listen-tcp?
19338Listen for unencrypted TCP connections on the public TCP/IP port. must set
19339@code{listen} for this to have any effect.
19340
19341Using the TCP socket requires SASL authentication by default. Only SASL
19342mechanisms which support data encryption are allowed. This is DIGEST_MD5
19343and GSSAPI (Kerberos5)
19344
19345Defaults to @samp{#f}.
19346
19347@end deftypevr
19348
19349@deftypevr {@code{libvirt-configuration} parameter} string tls-port
19350Port for accepting secure TLS connections This can be a port number, or
19351service name
19352
19353Defaults to @samp{"16514"}.
19354
19355@end deftypevr
19356
19357@deftypevr {@code{libvirt-configuration} parameter} string tcp-port
19358Port for accepting insecure TCP connections This can be a port number, or
19359service name
19360
19361Defaults to @samp{"16509"}.
19362
19363@end deftypevr
19364
19365@deftypevr {@code{libvirt-configuration} parameter} string listen-addr
19366IP address or hostname used for client connections.
19367
19368Defaults to @samp{"0.0.0.0"}.
19369
19370@end deftypevr
19371
19372@deftypevr {@code{libvirt-configuration} parameter} boolean mdns-adv?
19373Flag toggling mDNS advertisement of the libvirt service.
19374
19375Alternatively can disable for all services on a host by stopping the Avahi
19376daemon.
19377
19378Defaults to @samp{#f}.
19379
19380@end deftypevr
19381
19382@deftypevr {@code{libvirt-configuration} parameter} string mdns-name
19383Default mDNS advertisement name. This must be unique on the immediate
19384broadcast network.
19385
19386Defaults to @samp{"Virtualization Host <hostname>"}.
19387
19388@end deftypevr
19389
19390@deftypevr {@code{libvirt-configuration} parameter} string unix-sock-group
19391UNIX domain socket group ownership. This can be used to allow a 'trusted'
19392set of users access to management capabilities without becoming root.
19393
19394Defaults to @samp{"root"}.
19395
19396@end deftypevr
19397
19398@deftypevr {@code{libvirt-configuration} parameter} string unix-sock-ro-perms
19399UNIX socket permissions for the R/O socket. This is used for monitoring VM
19400status only.
19401
19402Defaults to @samp{"0777"}.
19403
19404@end deftypevr
19405
19406@deftypevr {@code{libvirt-configuration} parameter} string unix-sock-rw-perms
19407UNIX socket permissions for the R/W socket. Default allows only root. If
19408PolicyKit is enabled on the socket, the default will change to allow
19409everyone (eg, 0777)
19410
19411Defaults to @samp{"0770"}.
19412
19413@end deftypevr
19414
19415@deftypevr {@code{libvirt-configuration} parameter} string unix-sock-admin-perms
19416UNIX socket permissions for the admin socket. Default allows only owner
19417(root), do not change it unless you are sure to whom you are exposing the
19418access to.
19419
19420Defaults to @samp{"0777"}.
19421
19422@end deftypevr
19423
19424@deftypevr {@code{libvirt-configuration} parameter} string unix-sock-dir
19425The directory in which sockets will be found/created.
19426
19427Defaults to @samp{"/var/run/libvirt"}.
19428
19429@end deftypevr
19430
19431@deftypevr {@code{libvirt-configuration} parameter} string auth-unix-ro
19432Authentication scheme for UNIX read-only sockets. By default socket
19433permissions allow anyone to connect
19434
19435Defaults to @samp{"polkit"}.
19436
19437@end deftypevr
19438
19439@deftypevr {@code{libvirt-configuration} parameter} string auth-unix-rw
19440Authentication scheme for UNIX read-write sockets. By default socket
19441permissions only allow root. If PolicyKit support was compiled into
19442libvirt, the default will be to use 'polkit' auth.
19443
19444Defaults to @samp{"polkit"}.
19445
19446@end deftypevr
19447
19448@deftypevr {@code{libvirt-configuration} parameter} string auth-tcp
19449Authentication scheme for TCP sockets. If you don't enable SASL, then all
19450TCP traffic is cleartext. Don't do this outside of a dev/test scenario.
19451
19452Defaults to @samp{"sasl"}.
19453
19454@end deftypevr
19455
19456@deftypevr {@code{libvirt-configuration} parameter} string auth-tls
19457Authentication scheme for TLS sockets. TLS sockets already have encryption
19458provided by the TLS layer, and limited authentication is done by
19459certificates.
19460
19461It is possible to make use of any SASL authentication mechanism as well, by
19462using 'sasl' for this option
19463
19464Defaults to @samp{"none"}.
19465
19466@end deftypevr
19467
19468@deftypevr {@code{libvirt-configuration} parameter} optional-list access-drivers
19469API access control scheme.
19470
19471By default an authenticated user is allowed access to all APIs. Access
19472drivers can place restrictions on this.
19473
19474Defaults to @samp{()}.
19475
19476@end deftypevr
19477
19478@deftypevr {@code{libvirt-configuration} parameter} string key-file
19479Server key file path. If set to an empty string, then no private key is
19480loaded.
19481
19482Defaults to @samp{""}.
19483
19484@end deftypevr
19485
19486@deftypevr {@code{libvirt-configuration} parameter} string cert-file
19487Server key file path. If set to an empty string, then no certificate is
19488loaded.
19489
19490Defaults to @samp{""}.
19491
19492@end deftypevr
19493
19494@deftypevr {@code{libvirt-configuration} parameter} string ca-file
19495Server key file path. If set to an empty string, then no CA certificate is
19496loaded.
19497
19498Defaults to @samp{""}.
19499
19500@end deftypevr
19501
19502@deftypevr {@code{libvirt-configuration} parameter} string crl-file
19503Certificate revocation list path. If set to an empty string, then no CRL is
19504loaded.
19505
19506Defaults to @samp{""}.
19507
19508@end deftypevr
19509
19510@deftypevr {@code{libvirt-configuration} parameter} boolean tls-no-sanity-cert
19511Disable verification of our own server certificates.
19512
19513When libvirtd starts it performs some sanity checks against its own
19514certificates.
19515
19516Defaults to @samp{#f}.
19517
19518@end deftypevr
19519
19520@deftypevr {@code{libvirt-configuration} parameter} boolean tls-no-verify-cert
19521Disable verification of client certificates.
19522
19523Client certificate verification is the primary authentication mechanism.
19524Any client which does not present a certificate signed by the CA will be
19525rejected.
19526
19527Defaults to @samp{#f}.
19528
19529@end deftypevr
19530
19531@deftypevr {@code{libvirt-configuration} parameter} optional-list tls-allowed-dn-list
19532Whitelist of allowed x509 Distinguished Name.
19533
19534Defaults to @samp{()}.
19535
19536@end deftypevr
19537
19538@deftypevr {@code{libvirt-configuration} parameter} optional-list sasl-allowed-usernames
19539Whitelist of allowed SASL usernames. The format for username depends on the
19540SASL authentication mechanism.
19541
19542Defaults to @samp{()}.
19543
19544@end deftypevr
19545
19546@deftypevr {@code{libvirt-configuration} parameter} string tls-priority
19547Override the compile time default TLS priority string. The default is
19548usually "NORMAL" unless overridden at build time. Only set this is it is
19549desired for libvirt to deviate from the global default settings.
19550
19551Defaults to @samp{"NORMAL"}.
19552
19553@end deftypevr
19554
19555@deftypevr {@code{libvirt-configuration} parameter} integer max-clients
19556Maximum number of concurrent client connections to allow over all sockets
19557combined.
19558
19559Defaults to @samp{5000}.
19560
19561@end deftypevr
19562
19563@deftypevr {@code{libvirt-configuration} parameter} integer max-queued-clients
19564Maximum length of queue of connections waiting to be accepted by the
19565daemon. Note, that some protocols supporting retransmission may obey this
19566so that a later reattempt at connection succeeds.
19567
19568Defaults to @samp{1000}.
19569
19570@end deftypevr
19571
19572@deftypevr {@code{libvirt-configuration} parameter} integer max-anonymous-clients
19573Maximum length of queue of accepted but not yet authenticated clients. Set
19574this to zero to turn this feature off
19575
19576Defaults to @samp{20}.
19577
19578@end deftypevr
19579
19580@deftypevr {@code{libvirt-configuration} parameter} integer min-workers
19581Number of workers to start up initially.
19582
19583Defaults to @samp{5}.
19584
19585@end deftypevr
19586
19587@deftypevr {@code{libvirt-configuration} parameter} integer max-workers
19588Maximum number of worker threads.
19589
19590If the number of active clients exceeds @code{min-workers}, then more
19591threads are spawned, up to max_workers limit. Typically you'd want
19592max_workers to equal maximum number of clients allowed.
19593
19594Defaults to @samp{20}.
19595
19596@end deftypevr
19597
19598@deftypevr {@code{libvirt-configuration} parameter} integer prio-workers
19599Number of priority workers. If all workers from above pool are stuck, some
19600calls marked as high priority (notably domainDestroy) can be executed in
19601this pool.
19602
19603Defaults to @samp{5}.
19604
19605@end deftypevr
19606
19607@deftypevr {@code{libvirt-configuration} parameter} integer max-requests
19608Total global limit on concurrent RPC calls.
19609
19610Defaults to @samp{20}.
19611
19612@end deftypevr
19613
19614@deftypevr {@code{libvirt-configuration} parameter} integer max-client-requests
19615Limit on concurrent requests from a single client connection. To avoid one
19616client monopolizing the server this should be a small fraction of the global
19617max_requests and max_workers parameter.
19618
19619Defaults to @samp{5}.
19620
19621@end deftypevr
19622
19623@deftypevr {@code{libvirt-configuration} parameter} integer admin-min-workers
19624Same as @code{min-workers} but for the admin interface.
19625
19626Defaults to @samp{1}.
19627
19628@end deftypevr
19629
19630@deftypevr {@code{libvirt-configuration} parameter} integer admin-max-workers
19631Same as @code{max-workers} but for the admin interface.
19632
19633Defaults to @samp{5}.
19634
19635@end deftypevr
19636
19637@deftypevr {@code{libvirt-configuration} parameter} integer admin-max-clients
19638Same as @code{max-clients} but for the admin interface.
19639
19640Defaults to @samp{5}.
19641
19642@end deftypevr
19643
19644@deftypevr {@code{libvirt-configuration} parameter} integer admin-max-queued-clients
19645Same as @code{max-queued-clients} but for the admin interface.
19646
19647Defaults to @samp{5}.
19648
19649@end deftypevr
19650
19651@deftypevr {@code{libvirt-configuration} parameter} integer admin-max-client-requests
19652Same as @code{max-client-requests} but for the admin interface.
19653
19654Defaults to @samp{5}.
19655
19656@end deftypevr
19657
19658@deftypevr {@code{libvirt-configuration} parameter} integer log-level
19659Logging level. 4 errors, 3 warnings, 2 information, 1 debug.
19660
19661Defaults to @samp{3}.
19662
19663@end deftypevr
19664
19665@deftypevr {@code{libvirt-configuration} parameter} string log-filters
19666Logging filters.
19667
19668A filter allows to select a different logging level for a given category of
19669logs The format for a filter is one of:
19670
19671@itemize @bullet
19672@item
19673x:name
19674
19675@item
19676x:+name
19677
19678@end itemize
19679
19680where @code{name} is a string which is matched against the category given in
19681the @code{VIR_LOG_INIT()} at the top of each libvirt source file, e.g.,
19682"remote", "qemu", or "util.json" (the name in the filter can be a substring
19683of the full category name, in order to match multiple similar categories),
19684the optional "+" prefix tells libvirt to log stack trace for each message
19685matching name, and @code{x} is the minimal level where matching messages
19686should be logged:
19687
19688@itemize @bullet
19689@item
196901: DEBUG
19691
19692@item
196932: INFO
19694
19695@item
196963: WARNING
19697
19698@item
196994: ERROR
19700
19701@end itemize
19702
19703Multiple filters can be defined in a single filters statement, they just
19704need to be separated by spaces.
19705
19706Defaults to @samp{"3:remote 4:event"}.
19707
19708@end deftypevr
19709
19710@deftypevr {@code{libvirt-configuration} parameter} string log-outputs
19711Logging outputs.
19712
19713An output is one of the places to save logging information The format for an
19714output can be:
19715
19716@table @code
19717@item x:stderr
19718output goes to stderr
19719
19720@item x:syslog:name
19721use syslog for the output and use the given name as the ident
19722
19723@item x:file:file_path
19724output to a file, with the given filepath
19725
19726@item x:journald
19727output to journald logging system
19728
19729@end table
19730
19731In all case the x prefix is the minimal level, acting as a filter
19732
19733@itemize @bullet
19734@item
197351: DEBUG
19736
19737@item
197382: INFO
19739
19740@item
197413: WARNING
19742
19743@item
197444: ERROR
19745
19746@end itemize
19747
19748Multiple outputs can be defined, they just need to be separated by spaces.
19749
19750Defaults to @samp{"3:stderr"}.
19751
19752@end deftypevr
19753
19754@deftypevr {@code{libvirt-configuration} parameter} integer audit-level
19755Allows usage of the auditing subsystem to be altered
19756
19757@itemize @bullet
19758@item
197590: disable all auditing
19760
19761@item
197621: enable auditing, only if enabled on host
19763
19764@item
197652: enable auditing, and exit if disabled on host.
19766
19767@end itemize
19768
19769Defaults to @samp{1}.
19770
19771@end deftypevr
19772
19773@deftypevr {@code{libvirt-configuration} parameter} boolean audit-logging
19774Send audit messages via libvirt logging infrastructure.
19775
19776Defaults to @samp{#f}.
19777
19778@end deftypevr
19779
19780@deftypevr {@code{libvirt-configuration} parameter} optional-string host-uuid
19781Host UUID. UUID must not have all digits be the same.
19782
19783Defaults to @samp{""}.
19784
19785@end deftypevr
19786
19787@deftypevr {@code{libvirt-configuration} parameter} string host-uuid-source
19788Source to read host UUID.
19789
19790@itemize @bullet
19791@item
19792@code{smbios}: fetch the UUID from @code{dmidecode -s system-uuid}
19793
19794@item
19795@code{machine-id}: fetch the UUID from @code{/etc/machine-id}
19796
19797@end itemize
19798
19799If @code{dmidecode} does not provide a valid UUID a temporary UUID will be
19800generated.
19801
19802Defaults to @samp{"smbios"}.
19803
19804@end deftypevr
19805
19806@deftypevr {@code{libvirt-configuration} parameter} integer keepalive-interval
19807A keepalive message is sent to a client after @code{keepalive_interval}
19808seconds of inactivity to check if the client is still responding. If set to
19809-1, libvirtd will never send keepalive requests; however clients can still
19810send them and the daemon will send responses.
19811
19812Defaults to @samp{5}.
19813
19814@end deftypevr
19815
19816@deftypevr {@code{libvirt-configuration} parameter} integer keepalive-count
19817Maximum number of keepalive messages that are allowed to be sent to the
19818client without getting any response before the connection is considered
19819broken.
19820
19821In other words, the connection is automatically closed approximately after
19822@code{keepalive_interval * (keepalive_count + 1)} seconds since the last
19823message received from the client. When @code{keepalive-count} is set to 0,
19824connections will be automatically closed after @code{keepalive-interval}
19825seconds of inactivity without sending any keepalive messages.
19826
19827Defaults to @samp{5}.
19828
19829@end deftypevr
19830
19831@deftypevr {@code{libvirt-configuration} parameter} integer admin-keepalive-interval
19832Same as above but for admin interface.
19833
19834Defaults to @samp{5}.
19835
19836@end deftypevr
19837
19838@deftypevr {@code{libvirt-configuration} parameter} integer admin-keepalive-count
19839Same as above but for admin interface.
19840
19841Defaults to @samp{5}.
19842
19843@end deftypevr
19844
19845@deftypevr {@code{libvirt-configuration} parameter} integer ovs-timeout
19846Timeout for Open vSwitch calls.
19847
19848The @code{ovs-vsctl} utility is used for the configuration and its timeout
19849option is set by default to 5 seconds to avoid potential infinite waits
19850blocking libvirt.
19851
19852Defaults to @samp{5}.
19853
19854@end deftypevr
19855
19856@c %end of autogenerated docs
19857
19858@subsubheading Virtlog daemon
19859The virtlogd service is a server side daemon component of libvirt that is
19860used to manage logs from virtual machine consoles.
19861
19862This daemon is not used directly by libvirt client applications, rather it
19863is called on their behalf by @code{libvirtd}. By maintaining the logs in a
19864standalone daemon, the main @code{libvirtd} daemon can be restarted without
19865risk of losing logs. The @code{virtlogd} daemon has the ability to re-exec()
19866itself upon receiving @code{SIGUSR1}, to allow live upgrades without
19867downtime.
19868
19869@deffn {Scheme Variable} virtlog-service-type
19870This is the type of the virtlog daemon. Its value must be a
19871@code{virtlog-configuration}.
19872
19873@example
19874(service virtlog-service-type
19875 (virtlog-configuration
19876 (max-clients 1000)))
19877@end example
19878@end deffn
19879
19880@deftypevr {@code{virtlog-configuration} parameter} integer log-level
19881Logging level. 4 errors, 3 warnings, 2 information, 1 debug.
19882
19883Defaults to @samp{3}.
19884
19885@end deftypevr
19886
19887@deftypevr {@code{virtlog-configuration} parameter} string log-filters
19888Logging filters.
19889
19890A filter allows to select a different logging level for a given category of
19891logs The format for a filter is one of:
19892
19893@itemize @bullet
19894@item
19895x:name
19896
19897@item
19898x:+name
19899
19900@end itemize
19901
19902where @code{name} is a string which is matched against the category given in
19903the @code{VIR_LOG_INIT()} at the top of each libvirt source file, e.g.,
19904"remote", "qemu", or "util.json" (the name in the filter can be a substring
19905of the full category name, in order to match multiple similar categories),
19906the optional "+" prefix tells libvirt to log stack trace for each message
19907matching name, and @code{x} is the minimal level where matching messages
19908should be logged:
19909
19910@itemize @bullet
19911@item
199121: DEBUG
19913
19914@item
199152: INFO
19916
19917@item
199183: WARNING
19919
19920@item
199214: ERROR
19922
19923@end itemize
19924
19925Multiple filters can be defined in a single filters statement, they just
19926need to be separated by spaces.
19927
19928Defaults to @samp{"3:remote 4:event"}.
19929
19930@end deftypevr
19931
19932@deftypevr {@code{virtlog-configuration} parameter} string log-outputs
19933Logging outputs.
19934
19935An output is one of the places to save logging information The format for an
19936output can be:
19937
19938@table @code
19939@item x:stderr
19940output goes to stderr
19941
19942@item x:syslog:name
19943use syslog for the output and use the given name as the ident
19944
19945@item x:file:file_path
19946output to a file, with the given filepath
19947
19948@item x:journald
19949output to journald logging system
19950
19951@end table
19952
19953In all case the x prefix is the minimal level, acting as a filter
19954
19955@itemize @bullet
19956@item
199571: DEBUG
19958
19959@item
199602: INFO
19961
19962@item
199633: WARNING
19964
19965@item
199664: ERROR
19967
19968@end itemize
19969
19970Multiple outputs can be defined, they just need to be separated by spaces.
19971
19972Defaults to @samp{"3:stderr"}.
19973
19974@end deftypevr
19975
19976@deftypevr {@code{virtlog-configuration} parameter} integer max-clients
19977Maximum number of concurrent client connections to allow over all sockets
19978combined.
19979
19980Defaults to @samp{1024}.
19981
19982@end deftypevr
19983
19984@deftypevr {@code{virtlog-configuration} parameter} integer max-size
19985Maximum file size before rolling over.
19986
19987Defaults to @samp{2MB}
19988
19989@end deftypevr
19990
19991@deftypevr {@code{virtlog-configuration} parameter} integer max-backups
19992Maximum number of backup files to keep.
19993
19994Defaults to @samp{3}
19995
19996@end deftypevr
19997
19998@subsubheading Transparent Emulation with QEMU
19999
20000@cindex emulation
20001@cindex @code{binfmt_misc}
20002@code{qemu-binfmt-service-type} provides support for transparent emulation
20003of program binaries built for different architectures---e.g., it allows you
20004to transparently execute an ARMv7 program on an x86_64 machine. It achieves
20005this by combining the @uref{https://www.qemu.org, QEMU} emulator and the
20006@code{binfmt_misc} feature of the kernel Linux.
20007
20008@defvr {Scheme Variable} qemu-binfmt-service-type
20009This is the type of the QEMU/binfmt service for transparent emulation. Its
20010value must be a @code{qemu-binfmt-configuration} object, which specifies the
20011QEMU package to use as well as the architecture we want to emulated:
20012
20013@example
20014(service qemu-binfmt-service-type
20015 (qemu-binfmt-configuration
20016 (platforms (lookup-qemu-platforms "arm" "aarch64" "ppc"))))
20017@end example
20018
20019In this example, we enable transparent emulation for the ARM and aarch64
20020platforms. Running @code{herd stop qemu-binfmt} turns it off, and running
20021@code{herd start qemu-binfmt} turns it back on (@pxref{Invoking herd, the
20022@command{herd} command,, shepherd, The GNU Shepherd Manual}).
20023@end defvr
20024
20025@deftp {Data Type} qemu-binfmt-configuration
20026This is the configuration for the @code{qemu-binfmt} service.
20027
20028@table @asis
20029@item @code{platforms} (default: @code{'()})
20030The list of emulated QEMU platforms. Each item must be a @dfn{platform
20031object} as returned by @code{lookup-qemu-platforms} (see below).
20032
20033@item @code{guix-support?} (default: @code{#f})
20034When it is true, QEMU and all its dependencies are added to the build
20035environment of @command{guix-daemon} (@pxref{Aufruf des guix-daemon,
20036@code{--chroot-directory} option}). This allows the @code{binfmt_misc}
20037handlers to be used within the build environment, which in turn means that
20038you can transparently build programs for another architecture.
20039
20040For example, let's suppose you're on an x86_64 machine and you have this
20041service:
20042
20043@example
20044(service qemu-binfmt-service-type
20045 (qemu-binfmt-configuration
20046 (platforms (lookup-qemu-platforms "arm"))
20047 (guix-support? #t)))
20048@end example
20049
20050You can run:
20051
20052@example
20053guix build -s armhf-linux inkscape
20054@end example
20055
20056@noindent
20057and it will build Inkscape for ARMv7 @emph{as if it were a native build},
20058transparently using QEMU to emulate the ARMv7 CPU. Pretty handy if you'd
20059like to test a package build for an architecture you don't have access to!
20060
20061@item @code{qemu} (default: @code{qemu})
20062The QEMU package to use.
20063@end table
20064@end deftp
20065
20066@deffn {Scheme Procedure} lookup-qemu-platforms @var{platforms}@dots{}
20067Return the list of QEMU platform objects corresponding to
20068@var{platforms}@dots{}. @var{platforms} must be a list of strings
20069corresponding to platform names, such as @code{"arm"}, @code{"sparc"},
20070@code{"mips64el"}, and so on.
20071@end deffn
20072
20073@deffn {Scheme Procedure} qemu-platform? @var{obj}
20074Return true if @var{obj} is a platform object.
20075@end deffn
20076
20077@deffn {Scheme Procedure} qemu-platform-name @var{platform}
20078Return the name of @var{platform}---a string such as @code{"arm"}.
20079@end deffn
20080
20081@node Versionskontrolldienste
20082@subsubsection Versionskontrolldienste
20083
20084The @code{(gnu services version-control)} module provides a service to allow
20085remote access to local Git repositories. There are three options: the
20086@code{git-daemon-service}, which provides access to repositories via the
20087@code{git://} unsecured TCP-based protocol, extending the @code{nginx} web
20088server to proxy some requests to @code{git-http-backend}, or providing a web
20089interface with @code{cgit-service-type}.
20090
20091@deffn {Scheme Procedure} git-daemon-service [#:config (git-daemon-configuration)]
20092
20093Return a service that runs @command{git daemon}, a simple TCP server to
20094expose repositories over the Git protocol for anonymous access.
20095
20096The optional @var{config} argument should be a
20097@code{<git-daemon-configuration>} object, by default it allows read-only
20098access to exported@footnote{By creating the magic file
20099"git-daemon-export-ok" in the repository directory.} repositories under
20100@file{/srv/git}.
20101
20102@end deffn
20103
20104@deftp {Data Type} git-daemon-configuration
20105Data type representing the configuration for @code{git-daemon-service}.
20106
20107@table @asis
20108@item @code{package} (default: @var{git})
20109Package object of the Git distributed version control system.
20110
20111@item @code{export-all?} (default: @var{#f})
20112Whether to allow access for all Git repositories, even if they do not have
20113the @file{git-daemon-export-ok} file.
20114
20115@item @code{base-path} (default: @file{/srv/git})
20116Whether to remap all the path requests as relative to the given path. If
20117you run git daemon with @var{(base-path "/srv/git")} on example.com, then if
20118you later try to pull @code{git://example.com/hello.git}, git daemon will
20119interpret the path as @code{/srv/git/hello.git}.
20120
20121@item @code{user-path} (default: @var{#f})
20122Whether to allow @code{~user} notation to be used in requests. When
20123specified with empty string, requests to @code{git://host/~alice/foo} is
20124taken as a request to access @code{foo} repository in the home directory of
20125user @code{alice}. If @var{(user-path "path")} is specified, the same
20126request is taken as a request to access @code{path/foo} repository in the
20127home directory of user @code{alice}.
20128
20129@item @code{listen} (default: @var{'()})
20130Whether to listen on specific IP addresses or hostnames, defaults to all.
20131
20132@item @code{port} (default: @var{#f})
20133Whether to listen on an alternative port, which defaults to 9418.
20134
20135@item @code{whitelist} (default: @var{'()})
20136If not empty, only allow access to this list of directories.
20137
20138@item @code{extra-options} (default: @var{'()})
20139Extra options will be passed to @code{git daemon}, please run @command{man
20140git-daemon} for more information.
20141
20142@end table
20143@end deftp
20144
20145The @code{git://} protocol lacks authentication. When you pull from a
20146repository fetched via @code{git://}, you don't know that the data you
20147receive was modified is really coming from the specified host, and you have
20148your connection is subject to eavesdropping. It's better to use an
20149authenticated and encrypted transport, such as @code{https}. Although Git
20150allows you to serve repositories using unsophisticated file-based web
20151servers, there is a faster protocol implemented by the
20152@code{git-http-backend} program. This program is the back-end of a proper
20153Git web service. It is designed to sit behind a FastCGI proxy. @xref{Web-Dienste}, for more on running the necessary @code{fcgiwrap} daemon.
20154
20155Guix has a separate configuration data type for serving Git repositories
20156over HTTP.
20157
20158@deftp {Data Type} git-http-configuration
20159Data type representing the configuration for @code{git-http-service}.
20160
20161@table @asis
20162@item @code{package} (default: @var{git})
20163Package object of the Git distributed version control system.
20164
20165@item @code{git-root} (default: @file{/srv/git})
20166Directory containing the Git repositories to expose to the world.
20167
20168@item @code{export-all?} (default: @var{#f})
20169Whether to expose access for all Git repositories in @var{git-root}, even if
20170they do not have the @file{git-daemon-export-ok} file.
20171
20172@item @code{uri-path} (default: @file{/git/})
20173Path prefix for Git access. With the default @code{/git/} prefix, this will
20174map @code{http://@var{server}/git/@var{repo}.git} to
20175@code{/srv/git/@var{repo}.git}. Requests whose URI paths do not begin with
20176this prefix are not passed on to this Git instance.
20177
20178@item @code{fcgiwrap-socket} (default: @code{127.0.0.1:9000})
20179The socket on which the @code{fcgiwrap} daemon is listening. @xref{Web-Dienste}.
20180@end table
20181@end deftp
20182
20183There is no @code{git-http-service-type}, currently; instead you can create
20184an @code{nginx-location-configuration} from a @code{git-http-configuration}
20185and then add that location to a web server.
20186
20187@deffn {Scheme Procedure} git-http-nginx-location-configuration @
20188 [config=(git-http-configuration)] Compute an
20189@code{nginx-location-configuration} that corresponds to the given Git http
20190configuration. An example nginx service definition to serve the default
20191@file{/srv/git} over HTTPS might be:
20192
20193@example
20194(service nginx-service-type
20195 (nginx-configuration
20196 (server-blocks
20197 (list
20198 (nginx-server-configuration
20199 (listen '("443 ssl"))
20200 (server-name "git.my-host.org")
20201 (ssl-certificate
20202 "/etc/letsencrypt/live/git.my-host.org/fullchain.pem")
20203 (ssl-certificate-key
20204 "/etc/letsencrypt/live/git.my-host.org/privkey.pem")
20205 (locations
20206 (list
20207 (git-http-nginx-location-configuration
20208 (git-http-configuration (uri-path "/"))))))))))
20209@end example
20210
20211This example assumes that you are using Let's Encrypt to get your TLS
20212certificate. @xref{Zertifikatsdienste}. The default @code{certbot}
20213service will redirect all HTTP traffic on @code{git.my-host.org} to HTTPS.
20214You will also need to add an @code{fcgiwrap} proxy to your system services.
20215@xref{Web-Dienste}.
20216@end deffn
20217
20218@subsubheading Cgit Service
20219
20220@cindex Cgit service
20221@cindex Git, web interface
20222@uref{https://git.zx2c4.com/cgit/, Cgit} is a web frontend for Git
20223repositories written in C.
20224
20225The following example will configure the service with default values. By
20226default, Cgit can be accessed on port 80 (@code{http://localhost:80}).
20227
20228@example
20229(service cgit-service-type)
20230@end example
20231
20232The @code{file-object} type designates either a file-like object
20233(@pxref{G-Ausdrücke, file-like objects}) or a string.
20234
20235@c %start of fragment
20236
20237Available @code{cgit-configuration} fields are:
20238
20239@deftypevr {@code{cgit-configuration} parameter} package package
20240The CGIT package.
20241
20242@end deftypevr
20243
20244@deftypevr {@code{cgit-configuration} parameter} nginx-server-configuration-list nginx
20245NGINX configuration.
20246
20247@end deftypevr
20248
20249@deftypevr {@code{cgit-configuration} parameter} file-object about-filter
20250Specifies a command which will be invoked to format the content of about
20251pages (both top-level and for each repository).
20252
20253Defaults to @samp{""}.
20254
20255@end deftypevr
20256
20257@deftypevr {@code{cgit-configuration} parameter} string agefile
20258Specifies a path, relative to each repository path, which can be used to
20259specify the date and time of the youngest commit in the repository.
20260
20261Defaults to @samp{""}.
20262
20263@end deftypevr
20264
20265@deftypevr {@code{cgit-configuration} parameter} file-object auth-filter
20266Specifies a command that will be invoked for authenticating repository
20267access.
20268
20269Defaults to @samp{""}.
20270
20271@end deftypevr
20272
20273@deftypevr {@code{cgit-configuration} parameter} string branch-sort
20274Flag which, when set to @samp{age}, enables date ordering in the branch ref
20275list, and when set @samp{name} enables ordering by branch name.
20276
20277Defaults to @samp{"name"}.
20278
20279@end deftypevr
20280
20281@deftypevr {@code{cgit-configuration} parameter} string cache-root
20282Path used to store the cgit cache entries.
20283
20284Defaults to @samp{"/var/cache/cgit"}.
20285
20286@end deftypevr
20287
20288@deftypevr {@code{cgit-configuration} parameter} integer cache-static-ttl
20289Number which specifies the time-to-live, in minutes, for the cached version
20290of repository pages accessed with a fixed SHA1.
20291
20292Defaults to @samp{-1}.
20293
20294@end deftypevr
20295
20296@deftypevr {@code{cgit-configuration} parameter} integer cache-dynamic-ttl
20297Number which specifies the time-to-live, in minutes, for the cached version
20298of repository pages accessed without a fixed SHA1.
20299
20300Defaults to @samp{5}.
20301
20302@end deftypevr
20303
20304@deftypevr {@code{cgit-configuration} parameter} integer cache-repo-ttl
20305Number which specifies the time-to-live, in minutes, for the cached version
20306of the repository summary page.
20307
20308Defaults to @samp{5}.
20309
20310@end deftypevr
20311
20312@deftypevr {@code{cgit-configuration} parameter} integer cache-root-ttl
20313Number which specifies the time-to-live, in minutes, for the cached version
20314of the repository index page.
20315
20316Defaults to @samp{5}.
20317
20318@end deftypevr
20319
20320@deftypevr {@code{cgit-configuration} parameter} integer cache-scanrc-ttl
20321Number which specifies the time-to-live, in minutes, for the result of
20322scanning a path for Git repositories.
20323
20324Defaults to @samp{15}.
20325
20326@end deftypevr
20327
20328@deftypevr {@code{cgit-configuration} parameter} integer cache-about-ttl
20329Number which specifies the time-to-live, in minutes, for the cached version
20330of the repository about page.
20331
20332Defaults to @samp{15}.
20333
20334@end deftypevr
20335
20336@deftypevr {@code{cgit-configuration} parameter} integer cache-snapshot-ttl
20337Number which specifies the time-to-live, in minutes, for the cached version
20338of snapshots.
20339
20340Defaults to @samp{5}.
20341
20342@end deftypevr
20343
20344@deftypevr {@code{cgit-configuration} parameter} integer cache-size
20345The maximum number of entries in the cgit cache. When set to @samp{0},
20346caching is disabled.
20347
20348Defaults to @samp{0}.
20349
20350@end deftypevr
20351
20352@deftypevr {@code{cgit-configuration} parameter} boolean case-sensitive-sort?
20353Sort items in the repo list case sensitively.
20354
20355Defaults to @samp{#t}.
20356
20357@end deftypevr
20358
20359@deftypevr {@code{cgit-configuration} parameter} list clone-prefix
20360List of common prefixes which, when combined with a repository URL,
20361generates valid clone URLs for the repository.
20362
20363Defaults to @samp{()}.
20364
20365@end deftypevr
20366
20367@deftypevr {@code{cgit-configuration} parameter} list clone-url
20368List of @code{clone-url} templates.
20369
20370Defaults to @samp{()}.
20371
20372@end deftypevr
20373
20374@deftypevr {@code{cgit-configuration} parameter} file-object commit-filter
20375Command which will be invoked to format commit messages.
20376
20377Defaults to @samp{""}.
20378
20379@end deftypevr
20380
20381@deftypevr {@code{cgit-configuration} parameter} string commit-sort
20382Flag which, when set to @samp{date}, enables strict date ordering in the
20383commit log, and when set to @samp{topo} enables strict topological ordering.
20384
20385Defaults to @samp{"git log"}.
20386
20387@end deftypevr
20388
20389@deftypevr {@code{cgit-configuration} parameter} file-object css
20390URL which specifies the css document to include in all cgit pages.
20391
20392Defaults to @samp{"/share/cgit/cgit.css"}.
20393
20394@end deftypevr
20395
20396@deftypevr {@code{cgit-configuration} parameter} file-object email-filter
20397Specifies a command which will be invoked to format names and email address
20398of committers, authors, and taggers, as represented in various places
20399throughout the cgit interface.
20400
20401Defaults to @samp{""}.
20402
20403@end deftypevr
20404
20405@deftypevr {@code{cgit-configuration} parameter} boolean embedded?
20406Flag which, when set to @samp{#t}, will make cgit generate a HTML fragment
20407suitable for embedding in other HTML pages.
20408
20409Defaults to @samp{#f}.
20410
20411@end deftypevr
20412
20413@deftypevr {@code{cgit-configuration} parameter} boolean enable-commit-graph?
20414Flag which, when set to @samp{#t}, will make cgit print an ASCII-art commit
20415history graph to the left of the commit messages in the repository log page.
20416
20417Defaults to @samp{#f}.
20418
20419@end deftypevr
20420
20421@deftypevr {@code{cgit-configuration} parameter} boolean enable-filter-overrides?
20422Flag which, when set to @samp{#t}, allows all filter settings to be
20423overridden in repository-specific cgitrc files.
20424
20425Defaults to @samp{#f}.
20426
20427@end deftypevr
20428
20429@deftypevr {@code{cgit-configuration} parameter} boolean enable-follow-links?
20430Flag which, when set to @samp{#t}, allows users to follow a file in the log
20431view.
20432
20433Defaults to @samp{#f}.
20434
20435@end deftypevr
20436
20437@deftypevr {@code{cgit-configuration} parameter} boolean enable-http-clone?
20438If set to @samp{#t}, cgit will act as an dumb HTTP endpoint for Git clones.
20439
20440Defaults to @samp{#t}.
20441
20442@end deftypevr
20443
20444@deftypevr {@code{cgit-configuration} parameter} boolean enable-index-links?
20445Flag which, when set to @samp{#t}, will make cgit generate extra links
20446"summary", "commit", "tree" for each repo in the repository index.
20447
20448Defaults to @samp{#f}.
20449
20450@end deftypevr
20451
20452@deftypevr {@code{cgit-configuration} parameter} boolean enable-index-owner?
20453Flag which, when set to @samp{#t}, will make cgit display the owner of each
20454repo in the repository index.
20455
20456Defaults to @samp{#t}.
20457
20458@end deftypevr
20459
20460@deftypevr {@code{cgit-configuration} parameter} boolean enable-log-filecount?
20461Flag which, when set to @samp{#t}, will make cgit print the number of
20462modified files for each commit on the repository log page.
20463
20464Defaults to @samp{#f}.
20465
20466@end deftypevr
20467
20468@deftypevr {@code{cgit-configuration} parameter} boolean enable-log-linecount?
20469Flag which, when set to @samp{#t}, will make cgit print the number of added
20470and removed lines for each commit on the repository log page.
20471
20472Defaults to @samp{#f}.
20473
20474@end deftypevr
20475
20476@deftypevr {@code{cgit-configuration} parameter} boolean enable-remote-branches?
20477Flag which, when set to @code{#t}, will make cgit display remote branches in
20478the summary and refs views.
20479
20480Defaults to @samp{#f}.
20481
20482@end deftypevr
20483
20484@deftypevr {@code{cgit-configuration} parameter} boolean enable-subject-links?
20485Flag which, when set to @code{1}, will make cgit use the subject of the
20486parent commit as link text when generating links to parent commits in commit
20487view.
20488
20489Defaults to @samp{#f}.
20490
20491@end deftypevr
20492
20493@deftypevr {@code{cgit-configuration} parameter} boolean enable-html-serving?
20494Flag which, when set to @samp{#t}, will make cgit use the subject of the
20495parent commit as link text when generating links to parent commits in commit
20496view.
20497
20498Defaults to @samp{#f}.
20499
20500@end deftypevr
20501
20502@deftypevr {@code{cgit-configuration} parameter} boolean enable-tree-linenumbers?
20503Flag which, when set to @samp{#t}, will make cgit generate linenumber links
20504for plaintext blobs printed in the tree view.
20505
20506Defaults to @samp{#t}.
20507
20508@end deftypevr
20509
20510@deftypevr {@code{cgit-configuration} parameter} boolean enable-git-config?
20511Flag which, when set to @samp{#f}, will allow cgit to use Git config to set
20512any repo specific settings.
20513
20514Defaults to @samp{#f}.
20515
20516@end deftypevr
20517
20518@deftypevr {@code{cgit-configuration} parameter} file-object favicon
20519URL used as link to a shortcut icon for cgit.
20520
20521Defaults to @samp{"/favicon.ico"}.
20522
20523@end deftypevr
20524
20525@deftypevr {@code{cgit-configuration} parameter} string footer
20526The content of the file specified with this option will be included verbatim
793dcd8c
LC
20527at the bottom of all pages (i.e.@: it replaces the standard "generated
20528by..."@: message).
1e40e70b
JL
20529
20530Defaults to @samp{""}.
20531
20532@end deftypevr
20533
20534@deftypevr {@code{cgit-configuration} parameter} string head-include
20535The content of the file specified with this option will be included verbatim
20536in the HTML HEAD section on all pages.
20537
20538Defaults to @samp{""}.
20539
20540@end deftypevr
20541
20542@deftypevr {@code{cgit-configuration} parameter} string header
20543The content of the file specified with this option will be included verbatim
20544at the top of all pages.
20545
20546Defaults to @samp{""}.
20547
20548@end deftypevr
20549
20550@deftypevr {@code{cgit-configuration} parameter} file-object include
20551Name of a configfile to include before the rest of the current config- file
20552is parsed.
20553
20554Defaults to @samp{""}.
20555
20556@end deftypevr
20557
20558@deftypevr {@code{cgit-configuration} parameter} string index-header
20559The content of the file specified with this option will be included verbatim
20560above the repository index.
20561
20562Defaults to @samp{""}.
20563
20564@end deftypevr
20565
20566@deftypevr {@code{cgit-configuration} parameter} string index-info
20567The content of the file specified with this option will be included verbatim
20568below the heading on the repository index page.
20569
20570Defaults to @samp{""}.
20571
20572@end deftypevr
20573
20574@deftypevr {@code{cgit-configuration} parameter} boolean local-time?
20575Flag which, if set to @samp{#t}, makes cgit print commit and tag times in
20576the servers timezone.
20577
20578Defaults to @samp{#f}.
20579
20580@end deftypevr
20581
20582@deftypevr {@code{cgit-configuration} parameter} file-object logo
20583URL which specifies the source of an image which will be used as a logo on
20584all cgit pages.
20585
20586Defaults to @samp{"/share/cgit/cgit.png"}.
20587
20588@end deftypevr
20589
20590@deftypevr {@code{cgit-configuration} parameter} string logo-link
20591URL loaded when clicking on the cgit logo image.
20592
20593Defaults to @samp{""}.
20594
20595@end deftypevr
20596
20597@deftypevr {@code{cgit-configuration} parameter} file-object owner-filter
20598Command which will be invoked to format the Owner column of the main page.
20599
20600Defaults to @samp{""}.
20601
20602@end deftypevr
20603
20604@deftypevr {@code{cgit-configuration} parameter} integer max-atom-items
20605Number of items to display in atom feeds view.
20606
20607Defaults to @samp{10}.
20608
20609@end deftypevr
20610
20611@deftypevr {@code{cgit-configuration} parameter} integer max-commit-count
20612Number of entries to list per page in "log" view.
20613
20614Defaults to @samp{50}.
20615
20616@end deftypevr
20617
20618@deftypevr {@code{cgit-configuration} parameter} integer max-message-length
20619Number of commit message characters to display in "log" view.
20620
20621Defaults to @samp{80}.
20622
20623@end deftypevr
20624
20625@deftypevr {@code{cgit-configuration} parameter} integer max-repo-count
20626Specifies the number of entries to list per page on the repository index
20627page.
20628
20629Defaults to @samp{50}.
20630
20631@end deftypevr
20632
20633@deftypevr {@code{cgit-configuration} parameter} integer max-repodesc-length
20634Specifies the maximum number of repo description characters to display on
20635the repository index page.
20636
20637Defaults to @samp{80}.
20638
20639@end deftypevr
20640
20641@deftypevr {@code{cgit-configuration} parameter} integer max-blob-size
20642Specifies the maximum size of a blob to display HTML for in KBytes.
20643
20644Defaults to @samp{0}.
20645
20646@end deftypevr
20647
20648@deftypevr {@code{cgit-configuration} parameter} string max-stats
20649Maximum statistics period. Valid values are @samp{week},@samp{month},
20650@samp{quarter} and @samp{year}.
20651
20652Defaults to @samp{""}.
20653
20654@end deftypevr
20655
20656@deftypevr {@code{cgit-configuration} parameter} mimetype-alist mimetype
20657Mimetype for the specified filename extension.
20658
20659Defaults to @samp{((gif "image/gif") (html "text/html") (jpg "image/jpeg")
20660(jpeg "image/jpeg") (pdf "application/pdf") (png "image/png") (svg
20661"image/svg+xml"))}.
20662
20663@end deftypevr
20664
20665@deftypevr {@code{cgit-configuration} parameter} file-object mimetype-file
20666Specifies the file to use for automatic mimetype lookup.
20667
20668Defaults to @samp{""}.
20669
20670@end deftypevr
20671
20672@deftypevr {@code{cgit-configuration} parameter} string module-link
20673Text which will be used as the formatstring for a hyperlink when a submodule
20674is printed in a directory listing.
20675
20676Defaults to @samp{""}.
20677
20678@end deftypevr
20679
20680@deftypevr {@code{cgit-configuration} parameter} boolean nocache?
20681If set to the value @samp{#t} caching will be disabled.
20682
20683Defaults to @samp{#f}.
20684
20685@end deftypevr
20686
20687@deftypevr {@code{cgit-configuration} parameter} boolean noplainemail?
20688If set to @samp{#t} showing full author email addresses will be disabled.
20689
20690Defaults to @samp{#f}.
20691
20692@end deftypevr
20693
20694@deftypevr {@code{cgit-configuration} parameter} boolean noheader?
20695Flag which, when set to @samp{#t}, will make cgit omit the standard header
20696on all pages.
20697
20698Defaults to @samp{#f}.
20699
20700@end deftypevr
20701
20702@deftypevr {@code{cgit-configuration} parameter} project-list project-list
20703A list of subdirectories inside of @code{repository-directory}, relative to
20704it, that should loaded as Git repositories. An empty list means that all
20705subdirectories will be loaded.
20706
20707Defaults to @samp{()}.
20708
20709@end deftypevr
20710
20711@deftypevr {@code{cgit-configuration} parameter} file-object readme
20712Text which will be used as default value for @code{cgit-repo-readme}.
20713
20714Defaults to @samp{""}.
20715
20716@end deftypevr
20717
20718@deftypevr {@code{cgit-configuration} parameter} boolean remove-suffix?
20719If set to @code{#t} and @code{repository-directory} is enabled, if any
20720repositories are found with a suffix of @code{.git}, this suffix will be
20721removed for the URL and name.
20722
20723Defaults to @samp{#f}.
20724
20725@end deftypevr
20726
20727@deftypevr {@code{cgit-configuration} parameter} integer renamelimit
20728Maximum number of files to consider when detecting renames.
20729
20730Defaults to @samp{-1}.
20731
20732@end deftypevr
20733
20734@deftypevr {@code{cgit-configuration} parameter} string repository-sort
20735The way in which repositories in each section are sorted.
20736
20737Defaults to @samp{""}.
20738
20739@end deftypevr
20740
20741@deftypevr {@code{cgit-configuration} parameter} robots-list robots
20742Text used as content for the @code{robots} meta-tag.
20743
20744Defaults to @samp{("noindex" "nofollow")}.
20745
20746@end deftypevr
20747
20748@deftypevr {@code{cgit-configuration} parameter} string root-desc
20749Text printed below the heading on the repository index page.
20750
20751Defaults to @samp{"a fast webinterface for the git dscm"}.
20752
20753@end deftypevr
20754
20755@deftypevr {@code{cgit-configuration} parameter} string root-readme
20756The content of the file specified with this option will be included verbatim
20757below thef "about" link on the repository index page.
20758
20759Defaults to @samp{""}.
20760
20761@end deftypevr
20762
20763@deftypevr {@code{cgit-configuration} parameter} string root-title
20764Text printed as heading on the repository index page.
20765
20766Defaults to @samp{""}.
20767
20768@end deftypevr
20769
20770@deftypevr {@code{cgit-configuration} parameter} boolean scan-hidden-path
20771If set to @samp{#t} and repository-directory is enabled,
20772repository-directory will recurse into directories whose name starts with a
20773period. Otherwise, repository-directory will stay away from such
20774directories, considered as "hidden". Note that this does not apply to the
20775".git" directory in non-bare repos.
20776
20777Defaults to @samp{#f}.
20778
20779@end deftypevr
20780
20781@deftypevr {@code{cgit-configuration} parameter} list snapshots
20782Text which specifies the default set of snapshot formats that cgit generates
20783links for.
20784
20785Defaults to @samp{()}.
20786
20787@end deftypevr
20788
20789@deftypevr {@code{cgit-configuration} parameter} repository-directory repository-directory
20790Name of the directory to scan for repositories (represents
20791@code{scan-path}).
20792
20793Defaults to @samp{"/srv/git"}.
20794
20795@end deftypevr
20796
20797@deftypevr {@code{cgit-configuration} parameter} string section
20798The name of the current repository section - all repositories defined after
20799this option will inherit the current section name.
20800
20801Defaults to @samp{""}.
20802
20803@end deftypevr
20804
20805@deftypevr {@code{cgit-configuration} parameter} string section-sort
20806Flag which, when set to @samp{1}, will sort the sections on the repository
20807listing by name.
20808
20809Defaults to @samp{""}.
20810
20811@end deftypevr
20812
20813@deftypevr {@code{cgit-configuration} parameter} integer section-from-path
20814A number which, if defined prior to repository-directory, specifies how many
20815path elements from each repo path to use as a default section name.
20816
20817Defaults to @samp{0}.
20818
20819@end deftypevr
20820
20821@deftypevr {@code{cgit-configuration} parameter} boolean side-by-side-diffs?
20822If set to @samp{#t} shows side-by-side diffs instead of unidiffs per
20823default.
20824
20825Defaults to @samp{#f}.
20826
20827@end deftypevr
20828
20829@deftypevr {@code{cgit-configuration} parameter} file-object source-filter
20830Specifies a command which will be invoked to format plaintext blobs in the
20831tree view.
20832
20833Defaults to @samp{""}.
20834
20835@end deftypevr
20836
20837@deftypevr {@code{cgit-configuration} parameter} integer summary-branches
20838Specifies the number of branches to display in the repository "summary"
20839view.
20840
20841Defaults to @samp{10}.
20842
20843@end deftypevr
20844
20845@deftypevr {@code{cgit-configuration} parameter} integer summary-log
20846Specifies the number of log entries to display in the repository "summary"
20847view.
20848
20849Defaults to @samp{10}.
20850
20851@end deftypevr
20852
20853@deftypevr {@code{cgit-configuration} parameter} integer summary-tags
20854Specifies the number of tags to display in the repository "summary" view.
20855
20856Defaults to @samp{10}.
20857
20858@end deftypevr
20859
20860@deftypevr {@code{cgit-configuration} parameter} string strict-export
20861Filename which, if specified, needs to be present within the repository for
20862cgit to allow access to that repository.
20863
20864Defaults to @samp{""}.
20865
20866@end deftypevr
20867
20868@deftypevr {@code{cgit-configuration} parameter} string virtual-root
20869URL which, if specified, will be used as root for all cgit links.
20870
20871Defaults to @samp{"/"}.
20872
20873@end deftypevr
20874
20875@deftypevr {@code{cgit-configuration} parameter} repository-cgit-configuration-list repositories
20876A list of @dfn{cgit-repo} records to use with config.
20877
20878Defaults to @samp{()}.
20879
20880Available @code{repository-cgit-configuration} fields are:
20881
20882@deftypevr {@code{repository-cgit-configuration} parameter} repo-list snapshots
20883A mask of snapshot formats for this repo that cgit generates links for,
20884restricted by the global @code{snapshots} setting.
20885
20886Defaults to @samp{()}.
20887
20888@end deftypevr
20889
20890@deftypevr {@code{repository-cgit-configuration} parameter} repo-file-object source-filter
20891Override the default @code{source-filter}.
20892
20893Defaults to @samp{""}.
20894
20895@end deftypevr
20896
20897@deftypevr {@code{repository-cgit-configuration} parameter} repo-string url
20898The relative URL used to access the repository.
20899
20900Defaults to @samp{""}.
20901
20902@end deftypevr
20903
20904@deftypevr {@code{repository-cgit-configuration} parameter} repo-file-object about-filter
20905Override the default @code{about-filter}.
20906
20907Defaults to @samp{""}.
20908
20909@end deftypevr
20910
20911@deftypevr {@code{repository-cgit-configuration} parameter} repo-string branch-sort
20912Flag which, when set to @samp{age}, enables date ordering in the branch ref
20913list, and when set to @samp{name} enables ordering by branch name.
20914
20915Defaults to @samp{""}.
20916
20917@end deftypevr
20918
20919@deftypevr {@code{repository-cgit-configuration} parameter} repo-list clone-url
20920A list of URLs which can be used to clone repo.
20921
20922Defaults to @samp{()}.
20923
20924@end deftypevr
20925
20926@deftypevr {@code{repository-cgit-configuration} parameter} repo-file-object commit-filter
20927Override the default @code{commit-filter}.
20928
20929Defaults to @samp{""}.
20930
20931@end deftypevr
20932
20933@deftypevr {@code{repository-cgit-configuration} parameter} repo-string commit-sort
20934Flag which, when set to @samp{date}, enables strict date ordering in the
20935commit log, and when set to @samp{topo} enables strict topological ordering.
20936
20937Defaults to @samp{""}.
20938
20939@end deftypevr
20940
20941@deftypevr {@code{repository-cgit-configuration} parameter} repo-string defbranch
20942The name of the default branch for this repository. If no such branch
20943exists in the repository, the first branch name (when sorted) is used as
20944default instead. By default branch pointed to by HEAD, or "master" if there
20945is no suitable HEAD.
20946
20947Defaults to @samp{""}.
20948
20949@end deftypevr
20950
20951@deftypevr {@code{repository-cgit-configuration} parameter} repo-string desc
20952The value to show as repository description.
20953
20954Defaults to @samp{""}.
20955
20956@end deftypevr
20957
20958@deftypevr {@code{repository-cgit-configuration} parameter} repo-string homepage
20959The value to show as repository homepage.
20960
20961Defaults to @samp{""}.
20962
20963@end deftypevr
20964
20965@deftypevr {@code{repository-cgit-configuration} parameter} repo-file-object email-filter
20966Override the default @code{email-filter}.
20967
20968Defaults to @samp{""}.
20969
20970@end deftypevr
20971
20972@deftypevr {@code{repository-cgit-configuration} parameter} maybe-repo-boolean enable-commit-graph?
20973A flag which can be used to disable the global setting
20974@code{enable-commit-graph?}.
20975
20976Defaults to @samp{disabled}.
20977
20978@end deftypevr
20979
20980@deftypevr {@code{repository-cgit-configuration} parameter} maybe-repo-boolean enable-log-filecount?
20981A flag which can be used to disable the global setting
20982@code{enable-log-filecount?}.
20983
20984Defaults to @samp{disabled}.
20985
20986@end deftypevr
20987
20988@deftypevr {@code{repository-cgit-configuration} parameter} maybe-repo-boolean enable-log-linecount?
20989A flag which can be used to disable the global setting
20990@code{enable-log-linecount?}.
20991
20992Defaults to @samp{disabled}.
20993
20994@end deftypevr
20995
20996@deftypevr {@code{repository-cgit-configuration} parameter} maybe-repo-boolean enable-remote-branches?
20997Flag which, when set to @code{#t}, will make cgit display remote branches in
20998the summary and refs views.
20999
21000Defaults to @samp{disabled}.
21001
21002@end deftypevr
21003
21004@deftypevr {@code{repository-cgit-configuration} parameter} maybe-repo-boolean enable-subject-links?
21005A flag which can be used to override the global setting
21006@code{enable-subject-links?}.
21007
21008Defaults to @samp{disabled}.
21009
21010@end deftypevr
21011
21012@deftypevr {@code{repository-cgit-configuration} parameter} maybe-repo-boolean enable-html-serving?
21013A flag which can be used to override the global setting
21014@code{enable-html-serving?}.
21015
21016Defaults to @samp{disabled}.
21017
21018@end deftypevr
21019
21020@deftypevr {@code{repository-cgit-configuration} parameter} repo-boolean hide?
21021Flag which, when set to @code{#t}, hides the repository from the repository
21022index.
21023
21024Defaults to @samp{#f}.
21025
21026@end deftypevr
21027
21028@deftypevr {@code{repository-cgit-configuration} parameter} repo-boolean ignore?
21029Flag which, when set to @samp{#t}, ignores the repository.
21030
21031Defaults to @samp{#f}.
21032
21033@end deftypevr
21034
21035@deftypevr {@code{repository-cgit-configuration} parameter} repo-file-object logo
21036URL which specifies the source of an image which will be used as a logo on
21037this repo’s pages.
21038
21039Defaults to @samp{""}.
21040
21041@end deftypevr
21042
21043@deftypevr {@code{repository-cgit-configuration} parameter} repo-string logo-link
21044URL loaded when clicking on the cgit logo image.
21045
21046Defaults to @samp{""}.
21047
21048@end deftypevr
21049
21050@deftypevr {@code{repository-cgit-configuration} parameter} repo-file-object owner-filter
21051Override the default @code{owner-filter}.
21052
21053Defaults to @samp{""}.
21054
21055@end deftypevr
21056
21057@deftypevr {@code{repository-cgit-configuration} parameter} repo-string module-link
21058Text which will be used as the formatstring for a hyperlink when a submodule
21059is printed in a directory listing. The arguments for the formatstring are
21060the path and SHA1 of the submodule commit.
21061
21062Defaults to @samp{""}.
21063
21064@end deftypevr
21065
21066@deftypevr {@code{repository-cgit-configuration} parameter} module-link-path module-link-path
21067Text which will be used as the formatstring for a hyperlink when a submodule
21068with the specified subdirectory path is printed in a directory listing.
21069
21070Defaults to @samp{()}.
21071
21072@end deftypevr
21073
21074@deftypevr {@code{repository-cgit-configuration} parameter} repo-string max-stats
21075Override the default maximum statistics period.
21076
21077Defaults to @samp{""}.
21078
21079@end deftypevr
21080
21081@deftypevr {@code{repository-cgit-configuration} parameter} repo-string name
21082The value to show as repository name.
21083
21084Defaults to @samp{""}.
21085
21086@end deftypevr
21087
21088@deftypevr {@code{repository-cgit-configuration} parameter} repo-string owner
21089A value used to identify the owner of the repository.
21090
21091Defaults to @samp{""}.
21092
21093@end deftypevr
21094
21095@deftypevr {@code{repository-cgit-configuration} parameter} repo-string path
21096An absolute path to the repository directory.
21097
21098Defaults to @samp{""}.
21099
21100@end deftypevr
21101
21102@deftypevr {@code{repository-cgit-configuration} parameter} repo-string readme
21103A path (relative to repo) which specifies a file to include verbatim as the
21104"About" page for this repo.
21105
21106Defaults to @samp{""}.
21107
21108@end deftypevr
21109
21110@deftypevr {@code{repository-cgit-configuration} parameter} repo-string section
21111The name of the current repository section - all repositories defined after
21112this option will inherit the current section name.
21113
21114Defaults to @samp{""}.
21115
21116@end deftypevr
21117
21118@deftypevr {@code{repository-cgit-configuration} parameter} repo-list extra-options
21119Extra options will be appended to cgitrc file.
21120
21121Defaults to @samp{()}.
21122
21123@end deftypevr
21124
21125@end deftypevr
21126
21127@deftypevr {@code{cgit-configuration} parameter} list extra-options
21128Extra options will be appended to cgitrc file.
21129
21130Defaults to @samp{()}.
21131
21132@end deftypevr
21133
21134
21135@c %end of fragment
21136
21137However, it could be that you just want to get a @code{cgitrc} up and
21138running. In that case, you can pass an @code{opaque-cgit-configuration} as
21139a record to @code{cgit-service-type}. As its name indicates, an opaque
21140configuration does not have easy reflective capabilities.
21141
21142Available @code{opaque-cgit-configuration} fields are:
21143
21144@deftypevr {@code{opaque-cgit-configuration} parameter} package cgit
21145The cgit package.
21146@end deftypevr
21147
21148@deftypevr {@code{opaque-cgit-configuration} parameter} string string
21149The contents of the @code{cgitrc}, as a string.
21150@end deftypevr
21151
21152For example, if your @code{cgitrc} is just the empty string, you could
21153instantiate a cgit service like this:
21154
21155@example
21156(service cgit-service-type
21157 (opaque-cgit-configuration
21158 (cgitrc "")))
21159@end example
21160
21161@subsubheading Gitolite Service
21162
21163@cindex Gitolite service
21164@cindex Git, hosting
21165@uref{http://gitolite.com/gitolite/, Gitolite} is a tool for hosting Git
21166repositories on a central server.
21167
21168Gitolite can handle multiple repositories and users, and supports flexible
21169configuration of the permissions for the users on the repositories.
21170
21171The following example will configure Gitolite using the default @code{git}
21172user, and the provided SSH public key.
21173
21174@example
21175(service gitolite-service-type
21176 (gitolite-configuration
21177 (admin-pubkey (plain-file
21178 "yourname.pub"
21179 "ssh-rsa AAAA... guix@@example.com"))))
21180@end example
21181
21182Gitolite is configured through a special admin repository which you can
21183clone, for example, if you setup Gitolite on @code{example.com}, you would
21184run the following command to clone the admin repository.
21185
21186@example
21187git clone git@@example.com:gitolite-admin
21188@end example
21189
21190When the Gitolite service is activated, the provided @code{admin-pubkey}
21191will be inserted in to the @file{keydir} directory in the gitolite-admin
21192repository. If this results in a change in the repository, it will be
21193committed using the message ``gitolite setup by GNU Guix''.
21194
21195@deftp {Data Type} gitolite-configuration
21196Data type representing the configuration for @code{gitolite-service-type}.
21197
21198@table @asis
21199@item @code{package} (default: @var{gitolite})
21200Gitolite package to use.
21201
21202@item @code{user} (default: @var{git})
21203User to use for Gitolite. This will be user that you use when accessing
21204Gitolite over SSH.
21205
21206@item @code{group} (default: @var{git})
21207Group to use for Gitolite.
21208
21209@item @code{home-directory} (default: @var{"/var/lib/gitolite"})
21210Directory in which to store the Gitolite configuration and repositories.
21211
21212@item @code{rc-file} (default: @var{(gitolite-rc-file)})
21213A ``file-like'' object (@pxref{G-Ausdrücke, file-like objects}),
21214representing the configuration for Gitolite.
21215
21216@item @code{admin-pubkey} (default: @var{#f})
21217A ``file-like'' object (@pxref{G-Ausdrücke, file-like objects}) used to
21218setup Gitolite. This will be inserted in to the @file{keydir} directory
21219within the gitolite-admin repository.
21220
21221To specify the SSH key as a string, use the @code{plain-file} function.
21222
21223@example
21224(plain-file "yourname.pub" "ssh-rsa AAAA... guix@@example.com")
21225@end example
21226
21227@end table
21228@end deftp
21229
21230@deftp {Data Type} gitolite-rc-file
21231Data type representing the Gitolite RC file.
21232
21233@table @asis
21234@item @code{umask} (default: @code{#o0077})
21235This controls the permissions Gitolite sets on the repositories and their
21236contents.
21237
21238A value like @code{#o0027} will give read access to the group used by
21239Gitolite (by default: @code{git}). This is necessary when using Gitolite
21240with software like cgit or gitweb.
21241
21242@item @code{git-config-keys} (default: @code{""})
21243Gitolite allows you to set git config values using the "config"
21244keyword. This setting allows control over the config keys to accept.
21245
21246@item @code{roles} (default: @code{'(("READERS" . 1) ("WRITERS" . ))})
21247Set the role names allowed to be used by users running the perms command.
21248
21249@item @code{enable} (default: @code{'("help" "desc" "info" "perms" "writable" "ssh-authkeys" "git-config" "daemon" "gitweb")})
21250This setting controls the commands and features to enable within Gitolite.
21251
21252@end table
21253@end deftp
21254
21255
21256@node Spieldienste
21257@subsubsection Spieldienste
21258
21259@subsubheading The Battle for Wesnoth Service
21260@cindex wesnothd
21261@uref{https://wesnoth.org, The Battle for Wesnoth} is a fantasy, turn based
21262tactical strategy game, with several single player campaigns, and
21263multiplayer games (both networked and local).
21264
21265@defvar {Scheme Variable} wesnothd-service-type
21266Service type for the wesnothd service. Its value must be a
21267@code{wesnothd-configuration} object. To run wesnothd in the default
21268configuration, instantiate it as:
21269
21270@example
21271(service wesnothd-service-type)
21272@end example
21273@end defvar
21274
21275@deftp {Data Type} wesnothd-configuration
21276Data type representing the configuration of @command{wesnothd}.
21277
21278@table @asis
21279@item @code{package} (default: @code{wesnoth-server})
21280The wesnoth server package to use.
21281
21282@item @code{port} (default: @code{15000})
21283The port to bind the server to.
21284@end table
21285@end deftp
21286
21287@node Verschiedene Dienste
21288@subsubsection Verschiedene Dienste
21289
21290@cindex fingerprint
21291@subsubheading Fingerprint Service
21292
21293The @code{(gnu services fingerprint)} module provides a DBus service to read
21294and identify fingerprints via a fingerprint sensor.
21295
21296@defvr {Scheme Variable} fprintd-service-type
21297The service type for @command{fprintd}, which provides the fingerprint
21298reading capability.
21299
21300@example
21301(service fprintd-service-type)
21302@end example
21303@end defvr
21304
21305@cindex sysctl
21306@subsubheading System Control Service
21307
21308The @code{(gnu services sysctl)} provides a service to configure kernel
21309parameters at boot.
21310
21311@defvr {Scheme Variable} sysctl-service-type
21312The service type for @command{sysctl}, which modifies kernel parameters
21313under @file{/proc/sys/}. To enable IPv4 forwarding, it can be instantiated
21314as:
21315
21316@example
21317(service sysctl-service-type
21318 (sysctl-configuration
21319 (settings '(("net.ipv4.ip_forward" . "1")))))
21320@end example
21321@end defvr
21322
21323@deftp {Data Type} sysctl-configuration
21324The data type representing the configuration of @command{sysctl}.
21325
21326@table @asis
21327@item @code{sysctl} (default: @code{(file-append procps "/sbin/sysctl"})
21328The @command{sysctl} executable to use.
21329
21330@item @code{settings} (default: @code{'()})
21331An association list specifies kernel parameters and their values.
21332@end table
21333@end deftp
21334
21335@cindex pcscd
21336@subsubheading PC/SC Smart Card Daemon Service
21337
21338The @code{(gnu services security-token)} module provides the following
21339service to run @command{pcscd}, the PC/SC Smart Card Daemon.
21340@command{pcscd} is the daemon program for pcsc-lite and the MuscleCard
21341framework. It is a resource manager that coordinates communications with
21342smart card readers, smart cards and cryptographic tokens that are connected
21343to the system.
21344
21345@defvr {Scheme Variable} pcscd-service-type
21346Service type for the @command{pcscd} service. Its value must be a
21347@code{pcscd-configuration} object. To run pcscd in the default
21348configuration, instantiate it as:
21349
21350@example
21351(service pcscd-service-type)
21352@end example
21353@end defvr
21354
21355@deftp {Data Type} pcscd-configuration
21356The data type representing the configuration of @command{pcscd}.
21357
21358@table @asis
21359@item @code{pcsc-lite} (default: @code{pcsc-lite})
21360The pcsc-lite package that provides pcscd.
21361@item @code{usb-drivers} (default: @code{(list ccid)})
21362List of packages that provide USB drivers to pcscd. Drivers are expected to
21363be under @file{pcsc/drivers} in the store directory of the package.
21364@end table
21365@end deftp
21366
21367@cindex lirc
21368@subsubheading Lirc Service
21369
21370The @code{(gnu services lirc)} module provides the following service.
21371
21372@deffn {Scheme Procedure} lirc-service [#:lirc lirc] @
21373 [#:device #f] [#:driver #f] [#:config-file #f] @ [#:extra-options '()]
21374Return a service that runs @url{http://www.lirc.org,LIRC}, a daemon that
21375decodes infrared signals from remote controls.
21376
21377Optionally, @var{device}, @var{driver} and @var{config-file} (configuration
21378file name) may be specified. See @command{lircd} manual for details.
21379
21380Finally, @var{extra-options} is a list of additional command-line options
21381passed to @command{lircd}.
21382@end deffn
21383
21384@cindex spice
21385@subsubheading Spice Service
21386
21387The @code{(gnu services spice)} module provides the following service.
21388
21389@deffn {Scheme Procedure} spice-vdagent-service [#:spice-vdagent]
21390Returns a service that runs @url{http://www.spice-space.org,VDAGENT}, a
21391daemon that enables sharing the clipboard with a vm and setting the guest
21392display resolution when the graphical console window resizes.
21393@end deffn
21394
21395@subsubsection Dictionary Services
21396@cindex dictionary
21397The @code{(gnu services dict)} module provides the following service:
21398
21399@deffn {Scheme Procedure} dicod-service [#:config (dicod-configuration)]
21400Return a service that runs the @command{dicod} daemon, an implementation of
21401DICT server (@pxref{Dicod,,, dico, GNU Dico Manual}).
21402
21403The optional @var{config} argument specifies the configuration for
21404@command{dicod}, which should be a @code{<dicod-configuration>} object, by
21405default it serves the GNU Collaborative International Dictonary of English.
21406
21407You can add @command{open localhost} to your @file{~/.dico} file to make
21408@code{localhost} the default server for @command{dico} client
21409(@pxref{Initialization File,,, dico, GNU Dico Manual}).
21410@end deffn
21411
21412@deftp {Data Type} dicod-configuration
21413Data type representing the configuration of dicod.
21414
21415@table @asis
21416@item @code{dico} (default: @var{dico})
21417Package object of the GNU Dico dictionary server.
21418
21419@item @code{interfaces} (default: @var{'("localhost")})
21420This is the list of IP addresses and ports and possibly socket file names to
21421listen to (@pxref{Server Settings, @code{listen} directive,, dico, GNU Dico
21422Manual}).
21423
21424@item @code{handlers} (default: @var{'()})
21425List of @code{<dicod-handler>} objects denoting handlers (module instances).
21426
21427@item @code{databases} (default: @var{(list %dicod-database:gcide)})
21428List of @code{<dicod-database>} objects denoting dictionaries to be served.
21429@end table
21430@end deftp
21431
21432@deftp {Data Type} dicod-handler
21433Data type representing a dictionary handler (module instance).
21434
21435@table @asis
21436@item @code{name}
21437Name of the handler (module instance).
21438
21439@item @code{module} (default: @var{#f})
21440Name of the dicod module of the handler (instance). If it is @code{#f}, the
21441module has the same name as the handler. (@pxref{Module,,, dico, GNU Dico
21442Manual}).
21443
21444@item @code{options}
21445List of strings or gexps representing the arguments for the module handler
21446@end table
21447@end deftp
21448
21449@deftp {Data Type} dicod-database
21450Data type representing a dictionary database.
21451
21452@table @asis
21453@item @code{name}
21454Name of the database, will be used in DICT commands.
21455
21456@item @code{handler}
21457Name of the dicod handler (module instance) used by this database
21458(@pxref{Handlers,,, dico, GNU Dico Manual}).
21459
21460@item @code{complex?} (default: @var{#f})
21461Whether the database configuration complex. The complex configuration will
21462need a corresponding @code{<dicod-handler>} object, otherwise not.
21463
21464@item @code{options}
21465List of strings or gexps representing the arguments for the database
21466(@pxref{Databases,,, dico, GNU Dico Manual}).
21467@end table
21468@end deftp
21469
21470@defvr {Scheme Variable} %dicod-database:gcide
21471A @code{<dicod-database>} object serving the GNU Collaborative International
21472Dictionary of English using the @code{gcide} package.
21473@end defvr
21474
21475The following is an example @code{dicod-service} configuration.
21476
21477@example
21478(dicod-service #:config
21479 (dicod-configuration
21480 (handlers (list (dicod-handler
21481 (name "wordnet")
21482 (module "dictorg")
21483 (options
21484 (list #~(string-append "dbdir=" #$wordnet))))))
21485 (databases (list (dicod-database
21486 (name "wordnet")
21487 (complex? #t)
21488 (handler "wordnet")
21489 (options '("database=wn")))
21490 %dicod-database:gcide))))
21491@end example
21492
21493@node Setuid-Programme
21494@subsection Setuid-Programme
21495
21496@cindex setuid programs
21497Some programs need to run with ``root'' privileges, even when they are
21498launched by unprivileged users. A notorious example is the @command{passwd}
21499program, which users can run to change their password, and which needs to
21500access the @file{/etc/passwd} and @file{/etc/shadow} files---something
21501normally restricted to root, for obvious security reasons. To address that,
21502these executables are @dfn{setuid-root}, meaning that they always run with
21503root privileges (@pxref{How Change Persona,,, libc, The GNU C Library
21504Reference Manual}, for more info about the setuid mechanism.)
21505
21506The store itself @emph{cannot} contain setuid programs: that would be a
21507security issue since any user on the system can write derivations that
21508populate the store (@pxref{Der Store}). Thus, a different mechanism is
21509used: instead of changing the setuid bit directly on files that are in the
21510store, we let the system administrator @emph{declare} which programs should
21511be setuid root.
21512
21513The @code{setuid-programs} field of an @code{operating-system} declaration
21514contains a list of G-expressions denoting the names of programs to be
793dcd8c 21515setuid-root (@pxref{Das Konfigurationssystem nutzen}). For instance, the
1e40e70b
JL
21516@command{passwd} program, which is part of the Shadow package, can be
21517designated by this G-expression (@pxref{G-Ausdrücke}):
21518
21519@example
21520#~(string-append #$shadow "/bin/passwd")
21521@end example
21522
21523A default set of setuid programs is defined by the @code{%setuid-programs}
21524variable of the @code{(gnu system)} module.
21525
21526@defvr {Scheme Variable} %setuid-programs
21527A list of G-expressions denoting common programs that are setuid-root.
21528
21529The list includes commands such as @command{passwd}, @command{ping},
21530@command{su}, and @command{sudo}.
21531@end defvr
21532
21533Under the hood, the actual setuid programs are created in the
21534@file{/run/setuid-programs} directory at system activation time. The files
21535in this directory refer to the ``real'' binaries, which are in the store.
21536
21537@node X.509-Zertifikate
21538@subsection X.509-Zertifikate
21539
21540@cindex HTTPS, certificates
21541@cindex X.509 certificates
21542@cindex TLS
21543Web servers available over HTTPS (that is, HTTP over the transport-layer
21544security mechanism, TLS) send client programs an @dfn{X.509 certificate}
21545that the client can then use to @emph{authenticate} the server. To do that,
21546clients verify that the server's certificate is signed by a so-called
21547@dfn{certificate authority} (CA). But to verify the CA's signature, clients
21548must have first acquired the CA's certificate.
21549
21550Web browsers such as GNU@tie{}IceCat include their own set of CA
21551certificates, such that they are able to verify CA signatures
21552out-of-the-box.
21553
21554However, most other programs that can talk HTTPS---@command{wget},
21555@command{git}, @command{w3m}, etc.---need to be told where CA certificates
21556can be found.
21557
21558@cindex @code{nss-certs}
21559In GuixSD, this is done by adding a package that provides certificates to
21560the @code{packages} field of the @code{operating-system} declaration
21561(@pxref{„operating-system“-Referenz}). GuixSD includes one such package,
21562@code{nss-certs}, which is a set of CA certificates provided as part of
21563Mozilla's Network Security Services.
21564
21565Note that it is @emph{not} part of @var{%base-packages}, so you need to
21566explicitly add it. The @file{/etc/ssl/certs} directory, which is where most
21567applications and libraries look for certificates by default, points to the
21568certificates installed globally.
21569
21570Unprivileged users, including users of Guix on a foreign distro, can also
21571install their own certificate package in their profile. A number of
21572environment variables need to be defined so that applications and libraries
21573know where to find them. Namely, the OpenSSL library honors the
21574@code{SSL_CERT_DIR} and @code{SSL_CERT_FILE} variables. Some applications
21575add their own environment variables; for instance, the Git version control
21576system honors the certificate bundle pointed to by the @code{GIT_SSL_CAINFO}
21577environment variable. Thus, you would typically run something like:
21578
21579@example
21580$ guix package -i nss-certs
21581$ export SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
21582$ export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
21583$ export GIT_SSL_CAINFO="$SSL_CERT_FILE"
21584@end example
21585
21586As another example, R requires the @code{CURL_CA_BUNDLE} environment
21587variable to point to a certificate bundle, so you would have to run
21588something like this:
21589
21590@example
21591$ guix package -i nss-certs
21592$ export CURL_CA_BUNDLE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
21593@end example
21594
21595For other applications you may want to look up the required environment
21596variable in the relevant documentation.
21597
21598
21599@node Name Service Switch
21600@subsection Name Service Switch
21601
21602@cindex name service switch
21603@cindex NSS
21604The @code{(gnu system nss)} module provides bindings to the configuration
21605file of the libc @dfn{name service switch} or @dfn{NSS} (@pxref{NSS
21606Configuration File,,, libc, The GNU C Library Reference Manual}). In a
21607nutshell, the NSS is a mechanism that allows libc to be extended with new
21608``name'' lookup methods for system databases, which includes host names,
21609service names, user accounts, and more (@pxref{Name Service Switch, System
21610Databases and Name Service Switch,, libc, The GNU C Library Reference
21611Manual}).
21612
21613The NSS configuration specifies, for each system database, which lookup
21614method is to be used, and how the various methods are chained together---for
21615instance, under which circumstances NSS should try the next method in the
21616list. The NSS configuration is given in the @code{name-service-switch}
21617field of @code{operating-system} declarations (@pxref{„operating-system“-Referenz, @code{name-service-switch}}).
21618
21619@cindex nss-mdns
21620@cindex .local, host name lookup
21621As an example, the declaration below configures the NSS to use the
21622@uref{http://0pointer.de/lennart/projects/nss-mdns/, @code{nss-mdns}
21623back-end}, which supports host name lookups over multicast DNS (mDNS) for
21624host names ending in @code{.local}:
21625
21626@example
21627(name-service-switch
21628 (hosts (list %files ;first, check /etc/hosts
21629
21630 ;; If the above did not succeed, try
21631 ;; with 'mdns_minimal'.
21632 (name-service
21633 (name "mdns_minimal")
21634
21635 ;; 'mdns_minimal' is authoritative for
21636 ;; '.local'. When it returns "not found",
21637 ;; no need to try the next methods.
21638 (reaction (lookup-specification
21639 (not-found => return))))
21640
21641 ;; Then fall back to DNS.
21642 (name-service
21643 (name "dns"))
21644
21645 ;; Finally, try with the "full" 'mdns'.
21646 (name-service
21647 (name "mdns")))))
21648@end example
21649
21650Do not worry: the @code{%mdns-host-lookup-nss} variable (see below)
21651contains this configuration, so you will not have to type it if all you want
21652is to have @code{.local} host lookup working.
21653
21654Note that, in this case, in addition to setting the
21655@code{name-service-switch} of the @code{operating-system} declaration, you
21656also need to use @code{avahi-service} (@pxref{Netzwerkdienste,
21657@code{avahi-service}}), or @var{%desktop-services}, which includes it
21658(@pxref{Desktop-Dienste}). Doing this makes @code{nss-mdns} accessible to
21659the name service cache daemon (@pxref{Basisdienste, @code{nscd-service}}).
21660
21661For convenience, the following variables provide typical NSS configurations.
21662
21663@defvr {Scheme Variable} %default-nss
21664This is the default name service switch configuration, a
21665@code{name-service-switch} object.
21666@end defvr
21667
21668@defvr {Scheme Variable} %mdns-host-lookup-nss
21669This is the name service switch configuration with support for host name
21670lookup over multicast DNS (mDNS) for host names ending in @code{.local}.
21671@end defvr
21672
21673The reference for name service switch configuration is given below. It is a
21674direct mapping of the configuration file format of the C library , so please
21675refer to the C library manual for more information (@pxref{NSS Configuration
21676File,,, libc, The GNU C Library Reference Manual}). Compared to the
21677configuration file format of libc NSS, it has the advantage not only of
21678adding this warm parenthetic feel that we like, but also static checks: you
21679will know about syntax errors and typos as soon as you run @command{guix
21680system}.
21681
21682@deftp {Data Type} name-service-switch
21683
21684This is the data type representation the configuration of libc's name
21685service switch (NSS). Each field below represents one of the supported
21686system databases.
21687
21688@table @code
21689@item aliases
21690@itemx ethers
21691@itemx group
21692@itemx gshadow
21693@itemx hosts
21694@itemx initgroups
21695@itemx netgroup
21696@itemx networks
21697@itemx password
21698@itemx public-key
21699@itemx rpc
21700@itemx services
21701@itemx shadow
21702The system databases handled by the NSS. Each of these fields must be a
21703list of @code{<name-service>} objects (see below).
21704@end table
21705@end deftp
21706
21707@deftp {Data Type} name-service
21708
21709This is the data type representing an actual name service and the associated
21710lookup action.
21711
21712@table @code
21713@item name
21714A string denoting the name service (@pxref{Services in the NSS
21715configuration,,, libc, The GNU C Library Reference Manual}).
21716
21717Note that name services listed here must be visible to nscd. This is
21718achieved by passing the @code{#:name-services} argument to
21719@code{nscd-service} the list of packages providing the needed name services
21720(@pxref{Basisdienste, @code{nscd-service}}).
21721
21722@item reaction
21723An action specified using the @code{lookup-specification} macro
21724(@pxref{Actions in the NSS configuration,,, libc, The GNU C Library
21725Reference Manual}). For example:
21726
21727@example
21728(lookup-specification (unavailable => continue)
21729 (success => return))
21730@end example
21731@end table
21732@end deftp
21733
21734@node Initiale RAM-Disk
21735@subsection Initiale RAM-Disk
21736
21737@cindex initrd
21738@cindex initial RAM disk
21739For bootstrapping purposes, the Linux-Libre kernel is passed an @dfn{initial
21740RAM disk}, or @dfn{initrd}. An initrd contains a temporary root file system
21741as well as an initialization script. The latter is responsible for mounting
21742the real root file system, and for loading any kernel modules that may be
21743needed to achieve that.
21744
21745The @code{initrd-modules} field of an @code{operating-system} declaration
21746allows you to specify Linux-libre kernel modules that must be available in
21747the initrd. In particular, this is where you would list modules needed to
21748actually drive the hard disk where your root partition is---although the
21749default value of @code{initrd-modules} should cover most use cases. For
21750example, assuming you need the @code{megaraid_sas} module in addition to the
21751default modules to be able to access your root file system, you would write:
21752
21753@example
21754(operating-system
21755 ;; @dots{}
21756 (initrd-modules (cons "megaraid_sas" %base-initrd-modules)))
21757@end example
21758
21759@defvr {Scheme Variable} %base-initrd-modules
21760This is the list of kernel modules included in the initrd by default.
21761@end defvr
21762
21763Furthermore, if you need lower-level customization, the @code{initrd} field
21764of an @code{operating-system} declaration allows you to specify which initrd
21765you would like to use. The @code{(gnu system linux-initrd)} module provides
21766three ways to build an initrd: the high-level @code{base-initrd} procedure
21767and the low-level @code{raw-initrd} and @code{expression->initrd}
21768procedures.
21769
21770The @code{base-initrd} procedure is intended to cover most common uses. For
21771example, if you want to add a bunch of kernel modules to be loaded at boot
21772time, you can define the @code{initrd} field of the operating system
21773declaration like this:
21774
21775@example
21776(initrd (lambda (file-systems . rest)
21777 ;; Create a standard initrd but set up networking
21778 ;; with the parameters QEMU expects by default.
21779 (apply base-initrd file-systems
21780 #:qemu-networking? #t
21781 rest)))
21782@end example
21783
21784The @code{base-initrd} procedure also handles common use cases that involves
21785using the system as a QEMU guest, or as a ``live'' system with volatile root
21786file system.
21787
21788The @code{base-initrd} procedure is built from @code{raw-initrd} procedure.
21789Unlike @code{base-initrd}, @code{raw-initrd} doesn't do anything high-level,
21790such as trying to guess which kernel modules and packages should be included
21791to the initrd. An example use of @code{raw-initrd} is when a user has a
21792custom Linux kernel configuration and default kernel modules included by
21793@code{base-initrd} are not available.
21794
21795The initial RAM disk produced by @code{base-initrd} or @code{raw-initrd}
21796honors several options passed on the Linux kernel command line (that is,
21797arguments passed @i{via} the @code{linux} command of GRUB, or the
21798@code{-append} option of QEMU), notably:
21799
21800@table @code
21801@item --load=@var{boot}
21802Tell the initial RAM disk to load @var{boot}, a file containing a Scheme
21803program, once it has mounted the root file system.
21804
21805GuixSD uses this option to yield control to a boot program that runs the
21806service activation programs and then spawns the GNU@tie{}Shepherd, the
21807initialization system.
21808
21809@item --root=@var{root}
21810Mount @var{root} as the root file system. @var{root} can be a device name
21811like @code{/dev/sda1}, a file system label, or a file system UUID.
21812
21813@item --system=@var{System}
21814Have @file{/run/booted-system} and @file{/run/current-system} point to
21815@var{system}.
21816
21817@item modprobe.blacklist=@var{modules}@dots{}
21818@cindex module, black-listing
21819@cindex black list, of kernel modules
21820Instruct the initial RAM disk as well as the @command{modprobe} command
21821(from the kmod package) to refuse to load @var{modules}. @var{modules} must
21822be a comma-separated list of module names---e.g., @code{usbkbd,9pnet}.
21823
21824@item --repl
21825Start a read-eval-print loop (REPL) from the initial RAM disk before it
21826tries to load kernel modules and to mount the root file system. Our
21827marketing team calls it @dfn{boot-to-Guile}. The Schemer in you will love
21828it. @xref{Using Guile Interactively,,, guile, GNU Guile Reference Manual},
21829for more information on Guile's REPL.
21830
21831@end table
21832
21833Now that you know all the features that initial RAM disks produced by
21834@code{base-initrd} and @code{raw-initrd} provide, here is how to use it and
21835customize it further.
21836
21837@cindex initrd
21838@cindex initial RAM disk
793dcd8c 21839@deffn {Scheme Procedure} raw-initrd @var{file-systems} @
1e40e70b 21840 [#:linux-modules '()] [#:mapped-devices '()] @ [#:helper-packages '()]
793dcd8c
LC
21841[#:qemu-networking? #f] [#:volatile-root? #f] Return a derivation that
21842builds a raw initrd. @var{file-systems} is a list of file systems to be
21843mounted by the initrd, possibly in addition to the root file system
1e40e70b
JL
21844specified on the kernel command line via @code{--root}. @var{linux-modules}
21845is a list of kernel modules to be loaded at boot time. @var{mapped-devices}
21846is a list of device mappings to realize before @var{file-systems} are
21847mounted (@pxref{Abgebildete Geräte}). @var{helper-packages} is a list of
21848packages to be copied in the initrd. It may include @code{e2fsck/static} or
21849other packages needed by the initrd to check the root file system.
21850
21851When @var{qemu-networking?} is true, set up networking with the standard
21852QEMU parameters. When @var{virtio?} is true, load additional modules so
21853that the initrd can be used as a QEMU guest with para-virtualized I/O
21854drivers.
21855
21856When @var{volatile-root?} is true, the root file system is writable but any
21857changes to it are lost.
21858@end deffn
21859
793dcd8c 21860@deffn {Scheme Procedure} base-initrd @var{file-systems} @
1e40e70b 21861 [#:mapped-devices '()] [#:qemu-networking? #f] [#:volatile-root? #f]@
793dcd8c
LC
21862[#:linux-modules '()] Return as a file-like object a generic initrd, with
21863kernel modules taken from @var{linux}. @var{file-systems} is a list of
21864file-systems to be mounted by the initrd, possibly in addition to the root
21865file system specified on the kernel command line via @code{--root}.
21866@var{mapped-devices} is a list of device mappings to realize before
21867@var{file-systems} are mounted.
1e40e70b
JL
21868
21869@var{qemu-networking?} and @var{volatile-root?} behaves as in
21870@code{raw-initrd}.
21871
21872The initrd is automatically populated with all the kernel modules necessary
21873for @var{file-systems} and for the given options. Additional kernel modules
21874can be listed in @var{linux-modules}. They will be added to the initrd, and
21875loaded at boot time in the order in which they appear.
21876@end deffn
21877
21878Needless to say, the initrds we produce and use embed a statically-linked
21879Guile, and the initialization program is a Guile program. That gives a lot
21880of flexibility. The @code{expression->initrd} procedure builds such an
21881initrd, given the program to run in that initrd.
21882
793dcd8c
LC
21883@deffn {Scheme Procedure} expression->initrd @var{exp} @
21884 [#:guile %guile-static-stripped] [#:name "guile-initrd"] Return as a
21885file-like object a Linux initrd (a gzipped cpio archive) containing
21886@var{guile} and that evaluates @var{exp}, a G-expression, upon booting. All
21887the derivations referenced by @var{exp} are automatically copied to the
21888initrd.
1e40e70b
JL
21889@end deffn
21890
21891@node Bootloader-Konfiguration
21892@subsection Bootloader-Konfiguration
21893
21894@cindex bootloader
21895@cindex boot loader
21896
21897The operating system supports multiple bootloaders. The bootloader is
21898configured using @code{bootloader-configuration} declaration. All the
21899fields of this structure are bootloader agnostic except for one field,
21900@code{bootloader} that indicates the bootloader to be configured and
21901installed.
21902
21903Some of the bootloaders do not honor every field of
21904@code{bootloader-configuration}. For instance, the extlinux bootloader does
21905not support themes and thus ignores the @code{theme} field.
21906
21907@deftp {Data Type} bootloader-configuration
21908The type of a bootloader configuration declaration.
21909
21910@table @asis
21911
21912@item @code{bootloader}
21913@cindex EFI, bootloader
21914@cindex UEFI, bootloader
21915@cindex BIOS, bootloader
21916The bootloader to use, as a @code{bootloader} object. For now
21917@code{grub-bootloader}, @code{grub-efi-bootloader},
21918@code{extlinux-bootloader} and @code{u-boot-bootloader} are supported.
21919
21920@vindex grub-efi-bootloader
21921@code{grub-efi-bootloader} allows to boot on modern systems using the
21922@dfn{Unified Extensible Firmware Interface} (UEFI). This is what you should
21923use if the installation image contains a @file{/sys/firmware/efi} directory
21924when you boot it on your system.
21925
21926@vindex grub-bootloader
21927@code{grub-bootloader} allows you to boot in particular Intel-based machines
21928in ``legacy'' BIOS mode.
21929
21930@cindex ARM, bootloaders
21931@cindex AArch64, bootloaders
21932Available bootloaders are described in @code{(gnu bootloader @dots{})}
21933modules. In particular, @code{(gnu bootloader u-boot)} contains definitions
21934of bootloaders for a wide range of ARM and AArch64 systems, using the
21935@uref{http://www.denx.de/wiki/U-Boot/, U-Boot bootloader}.
21936
21937@item @code{target}
21938This is a string denoting the target onto which to install the bootloader.
21939
21940The interpretation depends on the bootloader in question. For
21941@code{grub-bootloader}, for example, it should be a device name understood
21942by the bootloader @command{installer} command, such as @code{/dev/sda} or
21943@code{(hd0)} (@pxref{Invoking grub-install,,, grub, GNU GRUB Manual}). For
21944@code{grub-efi-bootloader}, it should be the mount point of the EFI file
21945system, usually @file{/boot/efi}.
21946
21947@item @code{menu-entries} (default: @code{()})
21948A possibly empty list of @code{menu-entry} objects (see below), denoting
21949entries to appear in the bootloader menu, in addition to the current system
21950entry and the entry pointing to previous system generations.
21951
21952@item @code{default-entry} (default: @code{0})
21953The index of the default boot menu entry. Index 0 is for the entry of the
21954current system.
21955
21956@item @code{timeout} (default: @code{5})
21957The number of seconds to wait for keyboard input before booting. Set to 0
21958to boot immediately, and to -1 to wait indefinitely.
21959
21960@item @code{theme} (default: @var{#f})
21961The bootloader theme object describing the theme to use. If no theme is
21962provided, some bootloaders might use a default theme, that's true for GRUB.
21963
21964@item @code{terminal-outputs} (default: @code{'gfxterm})
21965The output terminals used for the bootloader boot menu, as a list of
21966symbols. GRUB accepts the values: @code{console}, @code{serial},
21967@code{serial_@{0-3@}}, @code{gfxterm}, @code{vga_text}, @code{mda_text},
21968@code{morse}, and @code{pkmodem}. This field corresponds to the GRUB
21969variable @code{GRUB_TERMINAL_OUTPUT} (@pxref{Simple configuration,,,
21970grub,GNU GRUB manual}).
21971
21972@item @code{terminal-inputs} (default: @code{'()})
21973The input terminals used for the bootloader boot menu, as a list of
21974symbols. For GRUB, the default is the native platform terminal as
21975determined at run-time. GRUB accepts the values: @code{console},
21976@code{serial}, @code{serial_@{0-3@}}, @code{at_keyboard}, and
21977@code{usb_keyboard}. This field corresponds to the GRUB variable
21978@code{GRUB_TERMINAL_INPUT} (@pxref{Simple configuration,,, grub,GNU GRUB
21979manual}).
21980
21981@item @code{serial-unit} (default: @code{#f})
21982The serial unit used by the bootloader, as an integer from 0 to 3. For
21983GRUB, it is chosen at run-time; currently GRUB chooses 0, which corresponds
21984to COM1 (@pxref{Serial terminal,,, grub,GNU GRUB manual}).
21985
21986@item @code{serial-speed} (default: @code{#f})
21987The speed of the serial interface, as an integer. For GRUB, the default
21988value is chosen at run-time; currently GRUB chooses 9600@tie{}bps
21989(@pxref{Serial terminal,,, grub,GNU GRUB manual}).
21990@end table
21991
21992@end deftp
21993
21994@cindex dual boot
21995@cindex boot menu
21996Should you want to list additional boot menu entries @i{via} the
21997@code{menu-entries} field above, you will need to create them with the
21998@code{menu-entry} form. For example, imagine you want to be able to boot
21999another distro (hard to imagine!), you can define a menu entry along these
22000lines:
22001
22002@example
22003(menu-entry
22004 (label "The Other Distro")
22005 (linux "/boot/old/vmlinux-2.6.32")
22006 (linux-arguments '("root=/dev/sda2"))
22007 (initrd "/boot/old/initrd"))
22008@end example
22009
22010Details below.
22011
22012@deftp {Data Type} menu-entry
22013The type of an entry in the bootloader menu.
22014
22015@table @asis
22016
22017@item @code{label}
22018The label to show in the menu---e.g., @code{"GNU"}.
22019
22020@item @code{linux}
22021The Linux kernel image to boot, for example:
22022
22023@example
22024(file-append linux-libre "/bzImage")
22025@end example
22026
22027For GRUB, it is also possible to specify a device explicitly in the file
22028path using GRUB's device naming convention (@pxref{Naming convention,,,
22029grub, GNU GRUB manual}), for example:
22030
22031@example
22032"(hd0,msdos1)/boot/vmlinuz"
22033@end example
22034
22035If the device is specified explicitly as above, then the @code{device} field
22036is ignored entirely.
22037
22038@item @code{linux-arguments} (default: @code{()})
22039The list of extra Linux kernel command-line arguments---e.g.,
22040@code{("console=ttyS0")}.
22041
22042@item @code{initrd}
22043A G-Expression or string denoting the file name of the initial RAM disk to
22044use (@pxref{G-Ausdrücke}).
22045@item @code{device} (default: @code{#f})
22046The device where the kernel and initrd are to be found---i.e., for GRUB,
22047@dfn{root} for this menu entry (@pxref{root,,, grub, GNU GRUB manual}).
22048
22049This may be a file system label (a string), a file system UUID (a
22050bytevector, @pxref{Dateisysteme}), or @code{#f}, in which case the
22051bootloader will search the device containing the file specified by the
22052@code{linux} field (@pxref{search,,, grub, GNU GRUB manual}). It must
22053@emph{not} be an OS device name such as @file{/dev/sda1}.
22054
22055@end table
22056@end deftp
22057
22058@c FIXME: Write documentation once it's stable.
22059Fow now only GRUB has theme support. GRUB themes are created using the
22060@code{grub-theme} form, which is not documented yet.
22061
22062@defvr {Scheme Variable} %default-theme
22063This is the default GRUB theme used by the operating system if no
22064@code{theme} field is specified in @code{bootloader-configuration} record.
22065
22066It comes with a fancy background image displaying the GNU and Guix logos.
22067@end defvr
22068
22069
22070@node Aufruf von guix system
22071@subsection Invoking @code{guix system}
22072
22073Once you have written an operating system declaration as seen in the
22074previous section, it can be @dfn{instantiated} using the @command{guix
22075system} command. The synopsis is:
22076
22077@example
22078guix system @var{options}@dots{} @var{action} @var{file}
22079@end example
22080
22081@var{file} must be the name of a file containing an @code{operating-system}
22082declaration. @var{action} specifies how the operating system is
22083instantiated. Currently the following values are supported:
22084
22085@table @code
22086@item search
22087Display available service type definitions that match the given regular
22088expressions, sorted by relevance:
22089
22090@example
22091$ guix system search console font
22092name: console-fonts
22093location: gnu/services/base.scm:729:2
22094extends: shepherd-root
22095description: Install the given fonts on the specified ttys (fonts are
22096+ per virtual console on GNU/Linux). The value of this service is a list
22097+ of tty/font pairs like:
22098+
22099+ '(("tty1" . "LatGrkCyr-8x16"))
22100relevance: 20
22101
22102name: mingetty
22103location: gnu/services/base.scm:1048:2
22104extends: shepherd-root
22105description: Provide console login using the `mingetty' program.
22106relevance: 2
22107
22108name: login
22109location: gnu/services/base.scm:775:2
22110extends: pam
22111description: Provide a console log-in service as specified by its
22112+ configuration value, a `login-configuration' object.
22113relevance: 2
22114
22115@dots{}
22116@end example
22117
22118As for @command{guix package --search}, the result is written in
22119@code{recutils} format, which makes it easy to filter the output
22120(@pxref{Top, GNU recutils databases,, recutils, GNU recutils manual}).
22121
22122@item reconfigure
22123Build the operating system described in @var{file}, activate it, and switch
22124to it@footnote{This action (and the related actions @code{switch-generation}
22125and @code{roll-back}) are usable only on systems already running GuixSD.}.
22126
22127This effects all the configuration specified in @var{file}: user accounts,
22128system services, global package list, setuid programs, etc. The command
22129starts system services specified in @var{file} that are not currently
22130running; if a service is currently running this command will arrange for it
793dcd8c 22131to be upgraded the next time it is stopped (e.g.@: by @code{herd stop X} or
1e40e70b
JL
22132@code{herd restart X}).
22133
22134This command creates a new generation whose number is one greater than the
22135current generation (as reported by @command{guix system list-generations}).
22136If that generation already exists, it will be overwritten. This behavior
22137mirrors that of @command{guix package} (@pxref{Aufruf von guix package}).
22138
22139It also adds a bootloader menu entry for the new OS configuration, ---unless
22140@option{--no-bootloader} is passed. For GRUB, it moves entries for older
22141configurations to a submenu, allowing you to choose an older system
22142generation at boot time should you need it.
22143
22144@quotation Anmerkung
22145@c The paragraph below refers to the problem discussed at
22146@c <http://lists.gnu.org/archive/html/guix-devel/2014-08/msg00057.html>.
22147It is highly recommended to run @command{guix pull} once before you run
22148@command{guix system reconfigure} for the first time (@pxref{Aufruf von guix pull}). Failing to do that you would see an older version of Guix once
22149@command{reconfigure} has completed.
22150@end quotation
22151
22152@item switch-generation
22153@cindex Generationen
22154Switch to an existing system generation. This action atomically switches
22155the system profile to the specified system generation. It also rearranges
22156the system's existing bootloader menu entries. It makes the menu entry for
22157the specified system generation the default, and it moves the entries for
22158the other generatiors to a submenu, if supported by the bootloader being
22159used. The next time the system boots, it will use the specified system
22160generation.
22161
22162The bootloader itself is not being reinstalled when using this command.
22163Thus, the installed bootloader is used with an updated configuration file.
22164
22165The target generation can be specified explicitly by its generation number.
22166For example, the following invocation would switch to system generation 7:
22167
22168@example
22169guix system switch-generation 7
22170@end example
22171
22172The target generation can also be specified relative to the current
22173generation with the form @code{+N} or @code{-N}, where @code{+3} means ``3
22174generations ahead of the current generation,'' and @code{-1} means ``1
22175generation prior to the current generation.'' When specifying a negative
22176value such as @code{-1}, you must precede it with @code{--} to prevent it
22177from being parsed as an option. For example:
22178
22179@example
22180guix system switch-generation -- -1
22181@end example
22182
22183Currently, the effect of invoking this action is @emph{only} to switch the
22184system profile to an existing generation and rearrange the bootloader menu
22185entries. To actually start using the target system generation, you must
22186reboot after running this action. In the future, it will be updated to do
22187the same things as @command{reconfigure}, like activating and deactivating
22188services.
22189
22190This action will fail if the specified generation does not exist.
22191
22192@item roll-back
22193@cindex rücksetzen
22194Switch to the preceding system generation. The next time the system boots,
22195it will use the preceding system generation. This is the inverse of
22196@command{reconfigure}, and it is exactly the same as invoking
22197@command{switch-generation} with an argument of @code{-1}.
22198
22199Currently, as with @command{switch-generation}, you must reboot after
22200running this action to actually start using the preceding system generation.
22201
22202@item build
22203Build the derivation of the operating system, which includes all the
22204configuration files and programs needed to boot and run the system. This
22205action does not actually install anything.
22206
22207@item init
22208Populate the given directory with all the files necessary to run the
22209operating system specified in @var{file}. This is useful for first-time
22210installations of GuixSD. For instance:
22211
22212@example
22213guix system init my-os-config.scm /mnt
22214@end example
22215
22216copies to @file{/mnt} all the store items required by the configuration
22217specified in @file{my-os-config.scm}. This includes configuration files,
22218packages, and so on. It also creates other essential files needed for the
22219system to operate correctly---e.g., the @file{/etc}, @file{/var}, and
22220@file{/run} directories, and the @file{/bin/sh} file.
22221
22222This command also installs bootloader on the target specified in
22223@file{my-os-config}, unless the @option{--no-bootloader} option was passed.
22224
22225@item vm
22226@cindex virtual machine
22227@cindex VM
22228@anchor{guix system vm}
22229Build a virtual machine that contains the operating system declared in
22230@var{file}, and return a script to run that virtual machine (VM). Arguments
22231given to the script are passed to QEMU as in the example below, which
22232enables networking and requests 1@tie{}GiB of RAM for the emulated machine:
22233
22234@example
22235$ /gnu/store/@dots{}-run-vm.sh -m 1024 -net user
22236@end example
22237
22238The VM shares its store with the host system.
22239
22240Additional file systems can be shared between the host and the VM using the
22241@code{--share} and @code{--expose} command-line options: the former
22242specifies a directory to be shared with write access, while the latter
22243provides read-only access to the shared directory.
22244
22245The example below creates a VM in which the user's home directory is
22246accessible read-only, and where the @file{/exchange} directory is a
22247read-write mapping of @file{$HOME/tmp} on the host:
22248
22249@example
22250guix system vm my-config.scm \
22251 --expose=$HOME --share=$HOME/tmp=/exchange
22252@end example
22253
22254On GNU/Linux, the default is to boot directly to the kernel; this has the
22255advantage of requiring only a very tiny root disk image since the store of
22256the host can then be mounted.
22257
22258The @code{--full-boot} option forces a complete boot sequence, starting with
22259the bootloader. This requires more disk space since a root image containing
22260at least the kernel, initrd, and bootloader data files must be created. The
22261@code{--image-size} option can be used to specify the size of the image.
22262
22263@cindex System images, creation in various formats
22264@cindex Creating system images in various formats
22265@item vm-image
22266@itemx disk-image
22267@itemx docker-image
22268Return a virtual machine, disk image, or Docker image of the operating
22269system declared in @var{file} that stands alone. By default, @command{guix
22270system} estimates the size of the image needed to store the system, but you
22271can use the @option{--image-size} option to specify a value. Docker images
22272are built to contain exactly what they need, so the @option{--image-size}
22273option is ignored in the case of @code{docker-image}.
22274
22275You can specify the root file system type by using the
22276@option{--file-system-type} option. It defaults to @code{ext4}.
22277
22278When using @code{vm-image}, the returned image is in qcow2 format, which the
22279QEMU emulator can efficiently use. @xref{GuixSD in einer VM starten}, for more
22280information on how to run the image in a virtual machine.
22281
22282When using @code{disk-image}, a raw disk image is produced; it can be copied
22283as is to a USB stick, for instance. Assuming @code{/dev/sdc} is the device
22284corresponding to a USB stick, one can copy the image to it using the
22285following command:
22286
22287@example
22288# dd if=$(guix system disk-image my-os.scm) of=/dev/sdc
22289@end example
22290
22291When using @code{docker-image}, a Docker image is produced. Guix builds the
22292image from scratch, not from a pre-existing Docker base image. As a result,
22293it contains @emph{exactly} what you define in the operating system
22294configuration file. You can then load the image and launch a Docker
22295container using commands like the following:
22296
22297@example
22298image_id="$(docker load < guixsd-docker-image.tar.gz)"
22299docker run -e GUIX_NEW_SYSTEM=/var/guix/profiles/system \\
22300 --entrypoint /var/guix/profiles/system/profile/bin/guile \\
22301 $image_id /var/guix/profiles/system/boot
22302@end example
22303
22304This command starts a new Docker container from the specified image. It
22305will boot the GuixSD system in the usual manner, which means it will start
22306any services you have defined in the operating system configuration.
22307Depending on what you run in the Docker container, it may be necessary to
22308give the container additional permissions. For example, if you intend to
22309build software using Guix inside of the Docker container, you may need to
22310pass the @option{--privileged} option to @code{docker run}.
22311
22312@item container
22313Return a script to run the operating system declared in @var{file} within a
22314container. Containers are a set of lightweight isolation mechanisms
22315provided by the kernel Linux-libre. Containers are substantially less
22316resource-demanding than full virtual machines since the kernel, shared
22317objects, and other resources can be shared with the host system; this also
22318means they provide thinner isolation.
22319
22320Currently, the script must be run as root in order to support more than a
22321single user and group. The container shares its store with the host system.
22322
22323As with the @code{vm} action (@pxref{guix system vm}), additional file
22324systems to be shared between the host and container can be specified using
22325the @option{--share} and @option{--expose} options:
22326
22327@example
22328guix system container my-config.scm \
22329 --expose=$HOME --share=$HOME/tmp=/exchange
22330@end example
22331
22332@quotation Anmerkung
22333This option requires Linux-libre 3.19 or newer.
22334@end quotation
22335
22336@end table
22337
22338@var{options} can contain any of the common build options (@pxref{Gemeinsame Erstellungsoptionen}). In addition, @var{options} can contain one of the
22339following:
22340
22341@table @option
22342@item --expression=@var{expr}
22343@itemx -e @var{expr}
22344Consider the operating-system @var{expr} evaluates to. This is an
22345alternative to specifying a file which evaluates to an operating system.
22346This is used to generate the GuixSD installer @pxref{Ein Abbild zur Installation erstellen}).
22347
22348@item --system=@var{System}
22349@itemx -s @var{system}
22350Attempt to build for @var{system} instead of the host system type. This
22351works as per @command{guix build} (@pxref{Aufruf von guix build}).
22352
22353@item --derivation
22354@itemx -d
22355Return the derivation file name of the given operating system without
22356building anything.
22357
22358@item --file-system-type=@var{type}
22359@itemx -t @var{type}
22360For the @code{disk-image} action, create a file system of the given
22361@var{type} on the image.
22362
22363When this option is omitted, @command{guix system} uses @code{ext4}.
22364
22365@cindex ISO-9660 format
22366@cindex CD image format
22367@cindex DVD image format
22368@code{--file-system-type=iso9660} produces an ISO-9660 image, suitable for
22369burning on CDs and DVDs.
22370
22371@item --image-size=@var{size}
22372For the @code{vm-image} and @code{disk-image} actions, create an image of
22373the given @var{size}. @var{size} may be a number of bytes, or it may
22374include a unit as a suffix (@pxref{Block size, size specifications,,
22375coreutils, GNU Coreutils}).
22376
22377When this option is omitted, @command{guix system} computes an estimate of
22378the image size as a function of the size of the system declared in
22379@var{file}.
22380
22381@item --root=@var{file}
22382@itemx -r @var{file}
22383Make @var{file} a symlink to the result, and register it as a garbage
22384collector root.
22385
22386@item --skip-checks
22387Skip pre-installation safety checks.
22388
22389By default, @command{guix system init} and @command{guix system reconfigure}
22390perform safety checks: they make sure the file systems that appear in the
22391@code{operating-system} declaration actually exist (@pxref{Dateisysteme}),
22392and that any Linux kernel modules that may be needed at boot time are listed
22393in @code{initrd-modules} (@pxref{Initiale RAM-Disk}). Passing this option
22394skips these tests altogether.
22395
22396@item --on-error=@var{strategy}
22397Apply @var{strategy} when an error occurs when reading @var{file}.
22398@var{strategy} may be one of the following:
22399
22400@table @code
22401@item nothing-special
22402Report the error concisely and exit. This is the default strategy.
22403
22404@item backtrace
22405Likewise, but also display a backtrace.
22406
22407@item debug
22408Report the error and enter Guile's debugger. From there, you can run
22409commands such as @code{,bt} to get a backtrace, @code{,locals} to display
22410local variable values, and more generally inspect the state of the program.
22411@xref{Debug Commands,,, guile, GNU Guile Reference Manual}, for a list of
22412available debugging commands.
22413@end table
22414@end table
22415
22416@quotation Anmerkung
22417All the actions above, except @code{build} and @code{init}, can use KVM
22418support in the Linux-libre kernel. Specifically, if the machine has
22419hardware virtualization support, the corresponding KVM kernel module should
22420be loaded, and the @file{/dev/kvm} device node must exist and be readable
22421and writable by the user and by the build users of the daemon (@pxref{Einrichten der Erstellungsumgebung}).
22422@end quotation
22423
22424Once you have built, configured, re-configured, and re-re-configured your
22425GuixSD installation, you may find it useful to list the operating system
22426generations available on disk---and that you can choose from the bootloader
22427boot menu:
22428
22429@table @code
22430
22431@item list-generations
22432List a summary of each generation of the operating system available on disk,
22433in a human-readable way. This is similar to the @option{--list-generations}
22434option of @command{guix package} (@pxref{Aufruf von guix package}).
22435
22436Optionally, one can specify a pattern, with the same syntax that is used in
22437@command{guix package --list-generations}, to restrict the list of
22438generations displayed. For instance, the following command displays
22439generations that are up to 10 days old:
22440
22441@example
22442$ guix system list-generations 10d
22443@end example
22444
22445@end table
22446
22447The @command{guix system} command has even more to offer! The following
22448sub-commands allow you to visualize how your system services relate to each
22449other:
22450
22451@anchor{system-extension-graph}
22452@table @code
22453
22454@item extension-graph
22455Emit in Dot/Graphviz format to standard output the @dfn{service extension
22456graph} of the operating system defined in @var{file} (@pxref{Dienstkompositionen}, for more information on service extensions.)
22457
22458The command:
22459
22460@example
22461$ guix system extension-graph @var{file} | dot -Tpdf > services.pdf
22462@end example
22463
22464produces a PDF file showing the extension relations among services.
22465
22466@anchor{system-shepherd-graph}
22467@item shepherd-graph
22468Emit in Dot/Graphviz format to standard output the @dfn{dependency graph} of
22469shepherd services of the operating system defined in @var{file}.
22470@xref{Shepherd-Dienste}, for more information and for an example graph.
22471
22472@end table
22473
22474@node GuixSD in einer VM starten
22475@subsection Running GuixSD in a Virtual Machine
22476
22477@cindex virtual machine
22478To run GuixSD in a virtual machine (VM), one can either use the pre-built
22479GuixSD VM image distributed at
22480@indicateurl{https://alpha.gnu.org/gnu/guix/guixsd-vm-image-@value{VERSION}.@var{system}.xz}
22481, or build their own virtual machine image using @command{guix system
22482vm-image} (@pxref{Aufruf von guix system}). The returned image is in qcow2
22483format, which the @uref{http://qemu.org/, QEMU emulator} can efficiently
22484use.
22485
22486@cindex QEMU
22487If you built your own image, you must copy it out of the store (@pxref{Der Store}) and give yourself permission to write to the copy before you can use
22488it. When invoking QEMU, you must choose a system emulator that is suitable
22489for your hardware platform. Here is a minimal QEMU invocation that will
22490boot the result of @command{guix system vm-image} on x86_64 hardware:
22491
22492@example
22493$ qemu-system-x86_64 \
22494 -net user -net nic,model=virtio \
22495 -enable-kvm -m 256 /tmp/qemu-image
22496@end example
22497
22498Here is what each of these options means:
22499
22500@table @code
22501@item qemu-system-x86_64
22502This specifies the hardware platform to emulate. This should match the
22503host.
22504
22505@item -net user
22506Enable the unprivileged user-mode network stack. The guest OS can access
22507the host but not vice versa. This is the simplest way to get the guest OS
22508online.
22509
22510@item -net nic,model=virtio
22511You must create a network interface of a given model. If you do not create
22512a NIC, the boot will fail. Assuming your hardware platform is x86_64, you
22513can get a list of available NIC models by running
22514@command{qemu-system-x86_64 -net nic,model=help}.
22515
22516@item -enable-kvm
22517If your system has hardware virtualization extensions, enabling the virtual
22518machine support (KVM) of the Linux kernel will make things run faster.
22519
22520@item -m 256
22521RAM available to the guest OS, in mebibytes. Defaults to 128@tie{}MiB,
22522which may be insufficient for some operations.
22523
22524@item /tmp/qemu-image
22525The file name of the qcow2 image.
22526@end table
22527
22528The default @command{run-vm.sh} script that is returned by an invocation of
22529@command{guix system vm} does not add a @command{-net user} flag by
22530default. To get network access from within the vm add the
22531@code{(dhcp-client-service)} to your system definition and start the VM
22532using @command{`guix system vm config.scm` -net user}. An important caveat
22533of using @command{-net user} for networking is that @command{ping} will not
22534work, because it uses the ICMP protocol. You'll have to use a different
22535command to check for network connectivity, for example @command{guix
22536download}.
22537
22538@subsubsection Connecting Through SSH
22539
22540@cindex SSH
22541@cindex SSH server
22542To enable SSH inside a VM you need to add a SSH server like
22543@code{(dropbear-service)} or @code{(lsh-service)} to your VM. The
22544@code{(lsh-service}) doesn't currently boot unsupervised. It requires you
22545to type some characters to initialize the randomness generator. In addition
22546you need to forward the SSH port, 22 by default, to the host. You can do
22547this with
22548
22549@example
22550`guix system vm config.scm` -net user,hostfwd=tcp::10022-:22
22551@end example
22552
22553To connect to the VM you can run
22554
22555@example
22556ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 10022
22557@end example
22558
22559The @command{-p} tells @command{ssh} the port you want to connect to.
22560@command{-o UserKnownHostsFile=/dev/null} prevents @command{ssh} from
22561complaining every time you modify your @command{config.scm} file and the
22562@command{-o StrictHostKeyChecking=no} prevents you from having to allow a
22563connection to an unknown host every time you connect.
22564
22565@subsubsection Using @command{virt-viewer} with Spice
22566
22567As an alternative to the default @command{qemu} graphical client you can use
22568the @command{remote-viewer} from the @command{virt-viewer} package. To
22569connect pass the @command{-spice port=5930,disable-ticketing} flag to
22570@command{qemu}. See previous section for further information on how to do
22571this.
22572
22573Spice also allows you to do some nice stuff like share your clipboard with
22574your VM. To enable that you'll also have to pass the following flags to
22575@command{qemu}:
22576
22577@example
22578-device virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0,addr=0x5
22579-chardev spicevmc,name=vdagent,id=vdagent
22580-device virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,
22581name=com.redhat.spice.0
22582@end example
22583
22584You'll also need to add the @pxref{Verschiedene Dienste, Spice service}.
22585
22586@node Dienste definieren
22587@subsection Dienste definieren
22588
22589The previous sections show the available services and how one can combine
22590them in an @code{operating-system} declaration. But how do we define them
22591in the first place? And what is a service anyway?
22592
22593@menu
22594* Dienstkompositionen:: Wie Dienste zusammengestellt werden.
22595* Diensttypen und Dienste:: Typen und Dienste.
793dcd8c 22596* Service-Referenz:: Referenz zur Programmierschnittstelle.
1e40e70b
JL
22597* Shepherd-Dienste:: Eine spezielle Art von Dienst.
22598@end menu
22599
22600@node Dienstkompositionen
22601@subsubsection Dienstkompositionen
22602
22603@cindex services
22604@cindex daemons
22605Here we define a @dfn{service} as, broadly, something that extends the
22606functionality of the operating system. Often a service is a process---a
22607@dfn{daemon}---started when the system boots: a secure shell server, a Web
22608server, the Guix build daemon, etc. Sometimes a service is a daemon whose
22609execution can be triggered by another daemon---e.g., an FTP server started
22610by @command{inetd} or a D-Bus service activated by @command{dbus-daemon}.
22611Occasionally, a service does not map to a daemon. For instance, the
22612``account'' service collects user accounts and makes sure they exist when
22613the system runs; the ``udev'' service collects device management rules and
22614makes them available to the eudev daemon; the @file{/etc} service populates
22615the @file{/etc} directory of the system.
22616
22617@cindex service extensions
22618GuixSD services are connected by @dfn{extensions}. For instance, the secure
22619shell service @emph{extends} the Shepherd---the GuixSD initialization
22620system, running as PID@tie{}1---by giving it the command lines to start and
22621stop the secure shell daemon (@pxref{Netzwerkdienste,
22622@code{lsh-service}}); the UPower service extends the D-Bus service by
22623passing it its @file{.service} specification, and extends the udev service
22624by passing it device management rules (@pxref{Desktop-Dienste,
22625@code{upower-service}}); the Guix daemon service extends the Shepherd by
22626passing it the command lines to start and stop the daemon, and extends the
22627account service by passing it a list of required build user accounts
22628(@pxref{Basisdienste}).
22629
22630All in all, services and their ``extends'' relations form a directed acyclic
22631graph (DAG). If we represent services as boxes and extensions as arrows, a
22632typical system might provide something like this:
22633
22634@image{images/service-graph,,5in,Typical service extension graph.}
22635
22636@cindex system service
22637At the bottom, we see the @dfn{system service}, which produces the directory
22638containing everything to run and boot the system, as returned by the
22639@command{guix system build} command. @xref{Service-Referenz}, to learn
22640about the other service types shown here. @xref{system-extension-graph, the
22641@command{guix system extension-graph} command}, for information on how to
22642generate this representation for a particular operating system definition.
22643
22644@cindex service types
22645Technically, developers can define @dfn{service types} to express these
22646relations. There can be any number of services of a given type on the
22647system---for instance, a system running two instances of the GNU secure
22648shell server (lsh) has two instances of @var{lsh-service-type}, with
22649different parameters.
22650
22651The following section describes the programming interface for service types
22652and services.
22653
22654@node Diensttypen und Dienste
22655@subsubsection Diensttypen und Dienste
22656
22657A @dfn{service type} is a node in the DAG described above. Let us start
22658with a simple example, the service type for the Guix build daemon
22659(@pxref{Aufruf des guix-daemon}):
22660
22661@example
22662(define guix-service-type
22663 (service-type
22664 (name 'guix)
22665 (extensions
22666 (list (service-extension shepherd-root-service-type guix-shepherd-service)
22667 (service-extension account-service-type guix-accounts)
22668 (service-extension activation-service-type guix-activation)))
22669 (default-value (guix-configuration))))
22670@end example
22671
22672@noindent
22673It defines three things:
22674
22675@enumerate
22676@item
22677A name, whose sole purpose is to make inspection and debugging easier.
22678
22679@item
22680A list of @dfn{service extensions}, where each extension designates the
22681target service type and a procedure that, given the parameters of the
22682service, returns a list of objects to extend the service of that type.
22683
22684Every service type has at least one service extension. The only exception
22685is the @dfn{boot service type}, which is the ultimate service.
22686
22687@item
22688Optionally, a default value for instances of this type.
22689@end enumerate
22690
22691In this example, @var{guix-service-type} extends three services:
22692
22693@table @var
22694@item shepherd-root-service-type
22695The @var{guix-shepherd-service} procedure defines how the Shepherd service
22696is extended. Namely, it returns a @code{<shepherd-service>} object that
22697defines how @command{guix-daemon} is started and stopped (@pxref{Shepherd-Dienste}).
22698
22699@item account-service-type
22700This extension for this service is computed by @var{guix-accounts}, which
22701returns a list of @code{user-group} and @code{user-account} objects
22702representing the build user accounts (@pxref{Aufruf des guix-daemon}).
22703
22704@item activation-service-type
22705Here @var{guix-activation} is a procedure that returns a gexp, which is a
22706code snippet to run at ``activation time''---e.g., when the service is
22707booted.
22708@end table
22709
22710A service of this type is instantiated like this:
22711
22712@example
22713(service guix-service-type
22714 (guix-configuration
22715 (build-accounts 5)
22716 (use-substitutes? #f)))
22717@end example
22718
22719The second argument to the @code{service} form is a value representing the
22720parameters of this specific service instance.
22721@xref{guix-configuration-type, @code{guix-configuration}}, for information
22722about the @code{guix-configuration} data type. When the value is omitted,
22723the default value specified by @code{guix-service-type} is used:
22724
22725@example
22726(service guix-service-type)
22727@end example
22728
22729@var{guix-service-type} is quite simple because it extends other services
22730but is not extensible itself.
22731
22732@c @subsubsubsection Extensible Service Types
22733
22734The service type for an @emph{extensible} service looks like this:
22735
22736@example
22737(define udev-service-type
22738 (service-type (name 'udev)
22739 (extensions
22740 (list (service-extension shepherd-root-service-type
22741 udev-shepherd-service)))
22742
22743 (compose concatenate) ;concatenate the list of rules
22744 (extend (lambda (config rules)
22745 (match config
22746 (($ <udev-configuration> udev initial-rules)
22747 (udev-configuration
22748 (udev udev) ;the udev package to use
22749 (rules (append initial-rules rules)))))))))
22750@end example
22751
22752This is the service type for the
22753@uref{https://wiki.gentoo.org/wiki/Project:Eudev, eudev device management
22754daemon}. Compared to the previous example, in addition to an extension of
22755@var{shepherd-root-service-type}, we see two new fields:
22756
22757@table @code
22758@item compose
22759This is the procedure to @dfn{compose} the list of extensions to services of
22760this type.
22761
22762Services can extend the udev service by passing it lists of rules; we
22763compose those extensions simply by concatenating them.
22764
22765@item extend
22766This procedure defines how the value of the service is @dfn{extended} with
22767the composition of the extensions.
22768
22769Udev extensions are composed into a list of rules, but the udev service
22770value is itself a @code{<udev-configuration>} record. So here, we extend
22771that record by appending the list of rules it contains to the list of
22772contributed rules.
22773
22774@item description
22775This is a string giving an overview of the service type. The string can
22776contain Texinfo markup (@pxref{Overview,,, texinfo, GNU Texinfo}). The
22777@command{guix system search} command searches these strings and displays
22778them (@pxref{Aufruf von guix system}).
22779@end table
22780
22781There can be only one instance of an extensible service type such as
22782@var{udev-service-type}. If there were more, the @code{service-extension}
22783specifications would be ambiguous.
22784
22785Still here? The next section provides a reference of the programming
22786interface for services.
22787
22788@node Service-Referenz
22789@subsubsection Service-Referenz
22790
22791We have seen an overview of service types (@pxref{Diensttypen und Dienste}). This section provides a reference on how to manipulate services
22792and service types. This interface is provided by the @code{(gnu services)}
22793module.
22794
22795@deffn {Scheme Procedure} service @var{type} [@var{value}]
22796Return a new service of @var{type}, a @code{<service-type>} object (see
22797below.) @var{value} can be any object; it represents the parameters of this
22798particular service instance.
22799
22800When @var{value} is omitted, the default value specified by @var{type} is
22801used; if @var{type} does not specify a default value, an error is raised.
22802
22803For instance, this:
22804
22805@example
22806(service openssh-service-type)
22807@end example
22808
22809@noindent
22810is equivalent to this:
22811
22812@example
22813(service openssh-service-type
22814 (openssh-configuration))
22815@end example
22816
22817In both cases the result is an instance of @code{openssh-service-type} with
22818the default configuration.
22819@end deffn
22820
22821@deffn {Scheme Procedure} service? @var{obj}
22822Return true if @var{obj} is a service.
22823@end deffn
22824
22825@deffn {Scheme Procedure} service-kind @var{service}
22826Return the type of @var{service}---i.e., a @code{<service-type>} object.
22827@end deffn
22828
22829@deffn {Scheme Procedure} service-value @var{service}
22830Return the value associated with @var{service}. It represents its
22831parameters.
22832@end deffn
22833
22834Here is an example of how a service is created and manipulated:
22835
22836@example
22837(define s
22838 (service nginx-service-type
22839 (nginx-configuration
22840 (nginx nginx)
22841 (log-directory log-directory)
22842 (run-directory run-directory)
22843 (file config-file))))
22844
22845(service? s)
22846@result{} #t
22847
22848(eq? (service-kind s) nginx-service-type)
22849@result{} #t
22850@end example
22851
22852The @code{modify-services} form provides a handy way to change the
22853parameters of some of the services of a list such as @var{%base-services}
22854(@pxref{Basisdienste, @code{%base-services}}). It evaluates to a list of
22855services. Of course, you could always use standard list combinators such as
22856@code{map} and @code{fold} to do that (@pxref{SRFI-1, List Library,, guile,
22857GNU Guile Reference Manual}); @code{modify-services} simply provides a more
22858concise form for this common pattern.
22859
22860@deffn {Scheme Syntax} modify-services @var{services} @
22861 (@var{type} @var{variable} => @var{body}) @dots{}
22862
22863Modify the services listed in @var{services} according to the given
22864clauses. Each clause has the form:
22865
22866@example
22867(@var{type} @var{variable} => @var{body})
22868@end example
22869
22870where @var{type} is a service type---e.g., @code{guix-service-type}---and
22871@var{variable} is an identifier that is bound within the @var{body} to the
22872service parameters---e.g., a @code{guix-configuration} instance---of the
22873original service of that @var{type}.
22874
22875The @var{body} should evaluate to the new service parameters, which will be
22876used to configure the new service. This new service will replace the
22877original in the resulting list. Because a service's service parameters are
22878created using @code{define-record-type*}, you can write a succinct
22879@var{body} that evaluates to the new service parameters by using the
22880@code{inherit} feature that @code{define-record-type*} provides.
22881
793dcd8c 22882@xref{Das Konfigurationssystem nutzen}, for example usage.
1e40e70b
JL
22883
22884@end deffn
22885
22886Next comes the programming interface for service types. This is something
22887you want to know when writing new service definitions, but not necessarily
22888when simply looking for ways to customize your @code{operating-system}
22889declaration.
22890
22891@deftp {Data Type} service-type
22892@cindex service type
22893This is the representation of a @dfn{service type} (@pxref{Diensttypen und Dienste}).
22894
22895@table @asis
22896@item @code{name}
22897This is a symbol, used only to simplify inspection and debugging.
22898
22899@item @code{extensions}
22900A non-empty list of @code{<service-extension>} objects (see below).
22901
22902@item @code{compose} (default: @code{#f})
22903If this is @code{#f}, then the service type denotes services that cannot be
22904extended---i.e., services that do not receive ``values'' from other
22905services.
22906
22907Otherwise, it must be a one-argument procedure. The procedure is called by
22908@code{fold-services} and is passed a list of values collected from
22909extensions. It may return any single value.
22910
22911@item @code{extend} (default: @code{#f})
22912If this is @code{#f}, services of this type cannot be extended.
22913
22914Otherwise, it must be a two-argument procedure: @code{fold-services} calls
22915it, passing it the initial value of the service as the first argument and
22916the result of applying @code{compose} to the extension values as the second
22917argument. It must return a value that is a valid parameter value for the
22918service instance.
22919@end table
22920
22921@xref{Diensttypen und Dienste}, for examples.
22922@end deftp
22923
22924@deffn {Scheme Procedure} service-extension @var{target-type} @
22925 @var{compute} Return a new extension for services of type
22926@var{target-type}. @var{compute} must be a one-argument procedure:
22927@code{fold-services} calls it, passing it the value associated with the
22928service that provides the extension; it must return a valid value for the
22929target service.
22930@end deffn
22931
22932@deffn {Scheme Procedure} service-extension? @var{obj}
22933Return true if @var{obj} is a service extension.
22934@end deffn
22935
22936Occasionally, you might want to simply extend an existing service. This
22937involves creating a new service type and specifying the extension of
22938interest, which can be verbose; the @code{simple-service} procedure provides
22939a shorthand for this.
22940
22941@deffn {Scheme Procedure} simple-service @var{name} @var{target} @var{value}
22942Return a service that extends @var{target} with @var{value}. This works by
22943creating a singleton service type @var{name}, of which the returned service
22944is an instance.
22945
22946For example, this extends mcron (@pxref{Geplante Auftragsausführung}) with an
22947additional job:
22948
22949@example
22950(simple-service 'my-mcron-job mcron-service-type
22951 #~(job '(next-hour (3)) "guix gc -F 2G"))
22952@end example
22953@end deffn
22954
22955At the core of the service abstraction lies the @code{fold-services}
22956procedure, which is responsible for ``compiling'' a list of services down to
22957a single directory that contains everything needed to boot and run the
22958system---the directory shown by the @command{guix system build} command
22959(@pxref{Aufruf von guix system}). In essence, it propagates service
22960extensions down the service graph, updating each node parameters on the way,
22961until it reaches the root node.
22962
22963@deffn {Scheme Procedure} fold-services @var{services} @
22964 [#:target-type @var{system-service-type}] Fold @var{services} by propagating
22965their extensions down to the root of type @var{target-type}; return the root
22966service adjusted accordingly.
22967@end deffn
22968
22969Lastly, the @code{(gnu services)} module also defines several essential
22970service types, some of which are listed below.
22971
22972@defvr {Scheme Variable} system-service-type
22973This is the root of the service graph. It produces the system directory as
22974returned by the @command{guix system build} command.
22975@end defvr
22976
22977@defvr {Scheme Variable} boot-service-type
22978The type of the ``boot service'', which produces the @dfn{boot script}. The
22979boot script is what the initial RAM disk runs when booting.
22980@end defvr
22981
22982@defvr {Scheme Variable} etc-service-type
22983The type of the @file{/etc} service. This service is used to create files
22984under @file{/etc} and can be extended by passing it name/file tuples such
22985as:
22986
22987@example
22988(list `("issue" ,(plain-file "issue" "Welcome!\n")))
22989@end example
22990
22991In this example, the effect would be to add an @file{/etc/issue} file
22992pointing to the given file.
22993@end defvr
22994
22995@defvr {Scheme Variable} setuid-program-service-type
22996Type for the ``setuid-program service''. This service collects lists of
22997executable file names, passed as gexps, and adds them to the set of
22998setuid-root programs on the system (@pxref{Setuid-Programme}).
22999@end defvr
23000
23001@defvr {Scheme Variable} profile-service-type
23002Type of the service that populates the @dfn{system profile}---i.e., the
23003programs under @file{/run/current-system/profile}. Other services can
23004extend it by passing it lists of packages to add to the system profile.
23005@end defvr
23006
23007
23008@node Shepherd-Dienste
23009@subsubsection Shepherd-Dienste
23010
23011@cindex shepherd services
23012@cindex PID 1
23013@cindex init system
23014The @code{(gnu services shepherd)} module provides a way to define services
23015managed by the GNU@tie{}Shepherd, which is the GuixSD initialization
23016system---the first process that is started when the system boots, also known
23017as PID@tie{}1 (@pxref{Einführung,,, shepherd, The GNU Shepherd Manual}).
23018
23019Services in the Shepherd can depend on each other. For instance, the SSH
23020daemon may need to be started after the syslog daemon has been started,
23021which in turn can only happen once all the file systems have been mounted.
793dcd8c 23022The simple operating system defined earlier (@pxref{Das Konfigurationssystem nutzen}) results in a service graph like this:
1e40e70b
JL
23023
23024@image{images/shepherd-graph,,5in,Typical shepherd service graph.}
23025
23026You can actually generate such a graph for any operating system definition
23027using the @command{guix system shepherd-graph} command
23028(@pxref{system-shepherd-graph, @command{guix system shepherd-graph}}).
23029
23030The @var{%shepherd-root-service} is a service object representing
23031PID@tie{}1, of type @var{shepherd-root-service-type}; it can be extended by
23032passing it lists of @code{<shepherd-service>} objects.
23033
23034@deftp {Data Type} shepherd-service
23035The data type representing a service managed by the Shepherd.
23036
23037@table @asis
23038@item @code{provision}
23039This is a list of symbols denoting what the service provides.
23040
23041These are the names that may be passed to @command{herd start},
23042@command{herd status}, and similar commands (@pxref{Invoking herd,,,
23043shepherd, The GNU Shepherd Manual}). @xref{Slots of services, the
23044@code{provides} slot,, shepherd, The GNU Shepherd Manual}, for details.
23045
23046@item @code{requirements} (default: @code{'()})
23047List of symbols denoting the Shepherd services this one depends on.
23048
23049@item @code{respawn?} (default: @code{#t})
23050Whether to restart the service when it stops, for instance when the
23051underlying process dies.
23052
23053@item @code{start}
23054@itemx @code{stop} (default: @code{#~(const #f)})
23055The @code{start} and @code{stop} fields refer to the Shepherd's facilities
23056to start and stop processes (@pxref{Service De- and Constructors,,,
23057shepherd, The GNU Shepherd Manual}). They are given as G-expressions that
23058get expanded in the Shepherd configuration file (@pxref{G-Ausdrücke}).
23059
23060@item @code{actions} (default: @code{'()})
23061@cindex actions, of Shepherd services
23062This is a list of @code{shepherd-action} objects (see below) defining
23063@dfn{actions} supported by the service, in addition to the standard
23064@code{start} and @code{stop} actions. Actions listed here become available
23065as @command{herd} sub-commands:
23066
23067@example
23068herd @var{action} @var{service} [@var{arguments}@dots{}]
23069@end example
23070
23071@item @code{Dokumentation}
23072A documentation string, as shown when running:
23073
23074@example
23075herd doc @var{service-name}
23076@end example
23077
23078where @var{service-name} is one of the symbols in @var{provision}
23079(@pxref{Invoking herd,,, shepherd, The GNU Shepherd Manual}).
23080
23081@item @code{modules} (default: @var{%default-modules})
23082This is the list of modules that must be in scope when @code{start} and
23083@code{stop} are evaluated.
23084
23085@end table
23086@end deftp
23087
23088@deftp {Data Type} shepherd-action
23089This is the data type that defines additional actions implemented by a
23090Shepherd service (see above).
23091
23092@table @code
23093@item name
23094Symbol naming the action.
23095
23096@item Dokumentation
23097This is a documentation string for the action. It can be viewed by running:
23098
23099@example
23100herd doc @var{service} action @var{action}
23101@end example
23102
23103@item procedure
23104This should be a gexp that evaluates to a procedure of at least one
23105argument, which is the ``running value'' of the service (@pxref{Slots of
23106services,,, shepherd, The GNU Shepherd Manual}).
23107@end table
23108
23109The following example defines an action called @code{say-hello} that kindly
23110greets the user:
23111
23112@example
23113(shepherd-action
23114 (name 'say-hello)
23115 (documentation "Say hi!")
23116 (procedure #~(lambda (running . args)
23117 (format #t "Hello, friend! arguments: ~s\n"
23118 args)
23119 #t)))
23120@end example
23121
23122Assuming this action is added to the @code{example} service, then you can
23123do:
23124
23125@example
23126# herd say-hello example
23127Hello, friend! arguments: ()
23128# herd say-hello example a b c
23129Hello, friend! arguments: ("a" "b" "c")
23130@end example
23131
23132This, as you can see, is a fairly sophisticated way to say hello.
23133@xref{Service Convenience,,, shepherd, The GNU Shepherd Manual}, for more
23134info on actions.
23135@end deftp
23136
23137@defvr {Scheme Variable} shepherd-root-service-type
23138The service type for the Shepherd ``root service''---i.e., PID@tie{}1.
23139
23140This is the service type that extensions target when they want to create
23141shepherd services (@pxref{Diensttypen und Dienste}, for an example).
23142Each extension must pass a list of @code{<shepherd-service>}.
23143@end defvr
23144
23145@defvr {Scheme Variable} %shepherd-root-service
23146This service represents PID@tie{}1.
23147@end defvr
23148
23149
23150@node Dokumentation
23151@section Dokumentation
23152
23153@cindex documentation, searching for
23154@cindex searching for documentation
23155@cindex Info, documentation format
23156@cindex man pages
23157@cindex manual pages
23158In most cases packages installed with Guix come with documentation. There
23159are two main documentation formats: ``Info'', a browseable hypertext format
23160used for GNU software, and ``manual pages'' (or ``man pages''), the linear
23161documentation format traditionally found on Unix. Info manuals are accessed
23162with the @command{info} command or with Emacs, and man pages are accessed
23163using @command{man}.
23164
23165You can look for documentation of software installed on your system by
23166keyword. For example, the following command searches for information about
23167``TLS'' in Info manuals:
23168
23169@example
23170$ info -k TLS
23171"(emacs)Network Security" -- STARTTLS
23172"(emacs)Network Security" -- TLS
23173"(gnutls)Core TLS API" -- gnutls_certificate_set_verify_flags
23174"(gnutls)Core TLS API" -- gnutls_certificate_set_verify_function
23175@dots{}
23176@end example
23177
23178@noindent
23179The command below searches for the same keyword in man pages:
23180
23181@example
23182$ man -k TLS
23183SSL (7) - OpenSSL SSL/TLS library
23184certtool (1) - GnuTLS certificate tool
23185@dots {}
23186@end example
23187
23188These searches are purely local to your computer so you have the guarantee
23189that documentation you find corresponds to what you have actually installed,
23190you can access it off-line, and your privacy is respected.
23191
23192Once you have these results, you can view the relevant documentation by
23193running, say:
23194
23195@example
23196$ info "(gnutls)Core TLS API"
23197@end example
23198
23199@noindent
23200or:
23201
23202@example
23203$ man certtool
23204@end example
23205
23206Info manuals contain sections and indices as well as hyperlinks like those
23207found in Web pages. The @command{info} reader (@pxref{Top, Info reader,,
23208info-stnd, Stand-alone GNU Info}) and its Emacs counterpart (@pxref{Misc
23209Help,,, emacs, The GNU Emacs Manual}) provide intuitive key bindings to
23210navigate manuals. @xref{Getting Started,,, info, Info: An Introduction},
23211for an introduction to Info navigation.
23212
23213@node Dateien zur Fehlersuche installieren
23214@section Dateien zur Fehlersuche installieren
23215
23216@cindex debugging files
23217Program binaries, as produced by the GCC compilers for instance, are
23218typically written in the ELF format, with a section containing
23219@dfn{debugging information}. Debugging information is what allows the
23220debugger, GDB, to map binary code to source code; it is required to debug a
23221compiled program in good conditions.
23222
23223The problem with debugging information is that is takes up a fair amount of
23224disk space. For example, debugging information for the GNU C Library weighs
23225in at more than 60 MiB. Thus, as a user, keeping all the debugging info of
23226all the installed programs is usually not an option. Yet, space savings
23227should not come at the cost of an impediment to debugging---especially in
23228the GNU system, which should make it easier for users to exert their
23229computing freedom (@pxref{GNU-Distribution}).
23230
23231Thankfully, the GNU Binary Utilities (Binutils) and GDB provide a mechanism
23232that allows users to get the best of both worlds: debugging information can
23233be stripped from the binaries and stored in separate files. GDB is then
23234able to load debugging information from those files, when they are available
23235(@pxref{Separate Debug Files,,, gdb, Debugging with GDB}).
23236
23237The GNU distribution takes advantage of this by storing debugging
23238information in the @code{lib/debug} sub-directory of a separate package
23239output unimaginatively called @code{debug} (@pxref{Pakete mit mehreren Ausgaben.}). Users can choose to install the @code{debug} output of a package
23240when they need it. For instance, the following command installs the
23241debugging information for the GNU C Library and for GNU Guile:
23242
23243@example
23244guix package -i glibc:debug guile:debug
23245@end example
23246
23247GDB must then be told to look for debug files in the user's profile, by
23248setting the @code{debug-file-directory} variable (consider setting it from
23249the @file{~/.gdbinit} file, @pxref{Startup,,, gdb, Debugging with GDB}):
23250
23251@example
23252(gdb) set debug-file-directory ~/.guix-profile/lib/debug
23253@end example
23254
23255From there on, GDB will pick up debugging information from the @code{.debug}
23256files under @file{~/.guix-profile/lib/debug}.
23257
23258In addition, you will most likely want GDB to be able to show the source
23259code being debugged. To do that, you will have to unpack the source code of
23260the package of interest (obtained with @code{guix build --source},
23261@pxref{Aufruf von guix build}), and to point GDB to that source directory
23262using the @code{directory} command (@pxref{Source Path, @code{directory},,
23263gdb, Debugging with GDB}).
23264
23265@c XXX: keep me up-to-date
23266The @code{debug} output mechanism in Guix is implemented by the
23267@code{gnu-build-system} (@pxref{Erstellungssysteme}). Currently, it is
23268opt-in---debugging information is available only for the packages with
23269definitions explicitly declaring a @code{debug} output. This may be changed
23270to opt-out in the future if our build farm servers can handle the load. To
23271check whether a package has a @code{debug} output, use @command{guix package
23272--list-available} (@pxref{Aufruf von guix package}).
23273
23274
23275@node Sicherheitsaktualisierungen
23276@section Sicherheitsaktualisierungen
23277
23278@cindex security updates
23279@cindex security vulnerabilities
23280Occasionally, important security vulnerabilities are discovered in software
23281packages and must be patched. Guix developers try hard to keep track of
23282known vulnerabilities and to apply fixes as soon as possible in the
23283@code{master} branch of Guix (we do not yet provide a ``stable'' branch
23284containing only security updates.) The @command{guix lint} tool helps
23285developers find out about vulnerable versions of software packages in the
23286distribution:
23287
23288@smallexample
23289$ guix lint -c cve
23290gnu/packages/base.scm:652:2: glibc@@2.21: probably vulnerable to CVE-2015-1781, CVE-2015-7547
23291gnu/packages/gcc.scm:334:2: gcc@@4.9.3: probably vulnerable to CVE-2015-5276
23292gnu/packages/image.scm:312:2: openjpeg@@2.1.0: probably vulnerable to CVE-2016-1923, CVE-2016-1924
23293@dots{}
23294@end smallexample
23295
23296@xref{Aufruf von guix lint}, for more information.
23297
23298@quotation Anmerkung
23299As of version @value{VERSION}, the feature described below is considered
23300``beta''.
23301@end quotation
23302
23303Guix follows a functional package management discipline
23304(@pxref{Einführung}), which implies that, when a package is changed,
23305@emph{every package that depends on it} must be rebuilt. This can
23306significantly slow down the deployment of fixes in core packages such as
23307libc or Bash, since basically the whole distribution would need to be
23308rebuilt. Using pre-built binaries helps (@pxref{Substitute}), but
23309deployment may still take more time than desired.
23310
23311@cindex grafts
23312To address this, Guix implements @dfn{grafts}, a mechanism that allows for
23313fast deployment of critical updates without the costs associated with a
23314whole-distribution rebuild. The idea is to rebuild only the package that
23315needs to be patched, and then to ``graft'' it onto packages explicitly
23316installed by the user and that were previously referring to the original
23317package. The cost of grafting is typically very low, and order of
23318magnitudes lower than a full rebuild of the dependency chain.
23319
23320@cindex replacements of packages, for grafts
23321For instance, suppose a security update needs to be applied to Bash. Guix
23322developers will provide a package definition for the ``fixed'' Bash, say
23323@var{bash-fixed}, in the usual way (@pxref{Pakete definieren}). Then, the
23324original package definition is augmented with a @code{replacement} field
23325pointing to the package containing the bug fix:
23326
23327@example
23328(define bash
23329 (package
23330 (name "bash")
23331 ;; @dots{}
23332 (replacement bash-fixed)))
23333@end example
23334
23335From there on, any package depending directly or indirectly on Bash---as
23336reported by @command{guix gc --requisites} (@pxref{Aufruf von guix gc})---that
23337is installed is automatically ``rewritten'' to refer to @var{bash-fixed}
23338instead of @var{bash}. This grafting process takes time proportional to the
23339size of the package, usually less than a minute for an ``average'' package
23340on a recent machine. Grafting is recursive: when an indirect dependency
23341requires grafting, then grafting ``propagates'' up to the package that the
23342user is installing.
23343
23344Currently, the length of the name and version of the graft and that of the
23345package it replaces (@var{bash-fixed} and @var{bash} in the example above)
23346must be equal. This restriction mostly comes from the fact that grafting
23347works by patching files, including binary files, directly. Other
23348restrictions may apply: for instance, when adding a graft to a package
23349providing a shared library, the original shared library and its replacement
23350must have the same @code{SONAME} and be binary-compatible.
23351
23352The @option{--no-grafts} command-line option allows you to forcefully avoid
23353grafting (@pxref{Gemeinsame Erstellungsoptionen, @option{--no-grafts}}). Thus, the
23354command:
23355
23356@example
23357guix build bash --no-grafts
23358@end example
23359
23360@noindent
23361returns the store file name of the original Bash, whereas:
23362
23363@example
23364guix build bash
23365@end example
23366
23367@noindent
23368returns the store file name of the ``fixed'', replacement Bash. This allows
23369you to distinguish between the two variants of Bash.
23370
23371To verify which Bash your whole profile refers to, you can run
23372(@pxref{Aufruf von guix gc}):
23373
23374@example
23375guix gc -R `readlink -f ~/.guix-profile` | grep bash
23376@end example
23377
23378@noindent
23379@dots{} and compare the store file names that you get with those above.
23380Likewise for a complete GuixSD system generation:
23381
23382@example
23383guix gc -R `guix system build my-config.scm` | grep bash
23384@end example
23385
23386Lastly, to check which Bash running processes are using, you can use the
23387@command{lsof} command:
23388
23389@example
23390lsof | grep /gnu/store/.*bash
23391@end example
23392
23393
23394@node Paketmodule
23395@section Paketmodule
23396
23397From a programming viewpoint, the package definitions of the GNU
23398distribution are provided by Guile modules in the @code{(gnu packages
23399@dots{})} name space@footnote{Note that packages under the @code{(gnu
23400packages @dots{})} module name space are not necessarily ``GNU packages''.
23401This module naming scheme follows the usual Guile module naming convention:
23402@code{gnu} means that these modules are distributed as part of the GNU
23403system, and @code{packages} identifies modules that define packages.}
23404(@pxref{Module, Guile modules,, guile, GNU Guile Reference Manual}). For
23405instance, the @code{(gnu packages emacs)} module exports a variable named
23406@code{emacs}, which is bound to a @code{<package>} object (@pxref{Pakete definieren}).
23407
23408The @code{(gnu packages @dots{})} module name space is automatically scanned
23409for packages by the command-line tools. For instance, when running
23410@code{guix package -i emacs}, all the @code{(gnu packages @dots{})} modules
23411are scanned until one that exports a package object whose name is
23412@code{emacs} is found. This package search facility is implemented in the
23413@code{(gnu packages)} module.
23414
23415@cindex Anpassung, von Paketen
23416@cindex package module search path
23417Users can store package definitions in modules with different names---e.g.,
23418@code{(my-packages emacs)}@footnote{Note that the file name and module name
23419must match. For instance, the @code{(my-packages emacs)} module must be
23420stored in a @file{my-packages/emacs.scm} file relative to the load path
23421specified with @option{--load-path} or @code{GUIX_PACKAGE_PATH}.
23422@xref{Modules and the File System,,, guile, GNU Guile Reference Manual}, for
23423details.}. There are two ways to make these package definitions visible to
23424the user interfaces:
23425
23426@enumerate
23427@item
23428By adding the directory containing your package modules to the search path
23429with the @code{-L} flag of @command{guix package} and other commands
23430(@pxref{Gemeinsame Erstellungsoptionen}), or by setting the @code{GUIX_PACKAGE_PATH}
23431environment variable described below.
23432
23433@item
23434By defining a @dfn{channel} and configuring @command{guix pull} so that it
23435pulls from it. A channel is essentially a Git repository containing package
23436modules. @xref{Channels}, for more information on how to define and use
23437channels.
23438@end enumerate
23439
23440@code{GUIX_PACKAGE_PATH} works similarly to other search path variables:
23441
23442@defvr {Environment Variable} GUIX_PACKAGE_PATH
23443This is a colon-separated list of directories to search for additional
23444package modules. Directories listed in this variable take precedence over
23445the own modules of the distribution.
23446@end defvr
23447
23448The distribution is fully @dfn{bootstrapped} and @dfn{self-contained}: each
23449package is built based solely on other packages in the distribution. The
23450root of this dependency graph is a small set of @dfn{bootstrap binaries},
23451provided by the @code{(gnu packages bootstrap)} module. For more
23452information on bootstrapping, @pxref{Bootstrapping}.
23453
23454@node Paketrichtlinien
23455@section Paketrichtlinien
23456
23457@cindex packages, creating
23458The GNU distribution is nascent and may well lack some of your favorite
23459packages. This section describes how you can help make the distribution
23460grow. @xref{Mitwirken}, for additional information on how you can help.
23461
23462Free software packages are usually distributed in the form of @dfn{source
23463code tarballs}---typically @file{tar.gz} files that contain all the source
23464files. Adding a package to the distribution means essentially two things:
23465adding a @dfn{recipe} that describes how to build the package, including a
23466list of other packages required to build it, and adding @dfn{package
23467metadata} along with that recipe, such as a description and licensing
23468information.
23469
23470In Guix all this information is embodied in @dfn{package definitions}.
23471Package definitions provide a high-level view of the package. They are
23472written using the syntax of the Scheme programming language; in fact, for
23473each package we define a variable bound to the package definition, and
23474export that variable from a module (@pxref{Paketmodule}). However,
23475in-depth Scheme knowledge is @emph{not} a prerequisite for creating
23476packages. For more information on package definitions, @pxref{Pakete definieren}.
23477
23478Once a package definition is in place, stored in a file in the Guix source
23479tree, it can be tested using the @command{guix build} command
23480(@pxref{Aufruf von guix build}). For example, assuming the new package is
23481called @code{gnew}, you may run this command from the Guix build tree
23482(@pxref{Guix vor der Installation ausführen}):
23483
23484@example
23485./pre-inst-env guix build gnew --keep-failed
23486@end example
23487
23488Using @code{--keep-failed} makes it easier to debug build failures since it
23489provides access to the failed build tree. Another useful command-line
23490option when debugging is @code{--log-file}, to access the build log.
23491
23492If the package is unknown to the @command{guix} command, it may be that the
23493source file contains a syntax error, or lacks a @code{define-public} clause
23494to export the package variable. To figure it out, you may load the module
23495from Guile to get more information about the actual error:
23496
23497@example
23498./pre-inst-env guile -c '(use-modules (gnu packages gnew))'
23499@end example
23500
23501Once your package builds correctly, please send us a patch
23502(@pxref{Mitwirken}). Well, if you need help, we will be happy to help
23503you too. Once the patch is committed in the Guix repository, the new
23504package automatically gets built on the supported platforms by
23505@url{http://hydra.gnu.org/jobset/gnu/master, our continuous integration
23506system}.
23507
23508@cindex substituter
23509Users can obtain the new package definition simply by running @command{guix
23510pull} (@pxref{Aufruf von guix pull}). When @code{hydra.gnu.org} is done
23511building the package, installing the package automatically downloads
23512binaries from there (@pxref{Substitute}). The only place where human
23513intervention is needed is to review and apply the patch.
23514
23515
23516@menu
23517* Software-Freiheit:: Was in die Distribution aufgenommen werden
23518 darf.
23519* Paketbenennung:: Was macht einen Namen aus?
23520* Versionsnummern:: Wenn der Name noch nicht genug ist.
23521* Zusammenfassungen und Beschreibungen:: Den Nutzern helfen, das richtige
23522 Paket zu finden.
23523* Python-Module:: Ein Touch britischer Comedy.
23524* Perl-Module:: Kleine Perlen.
23525* Java-Pakete:: Kaffeepause.
23526* Schriftarten:: Schriften verschriftlicht.
23527@end menu
23528
23529@node Software-Freiheit
23530@subsection Software-Freiheit
23531
23532@c Adapted from http://www.gnu.org/philosophy/philosophy.html.
23533@cindex free software
23534The GNU operating system has been developed so that users can have freedom
23535in their computing. GNU is @dfn{free software}, meaning that users have the
23536@url{http://www.gnu.org/philosophy/free-sw.html,four essential freedoms}: to
23537run the program, to study and change the program in source code form, to
23538redistribute exact copies, and to distribute modified versions. Packages
23539found in the GNU distribution provide only software that conveys these four
23540freedoms.
23541
23542In addition, the GNU distribution follow the
23543@url{http://www.gnu.org/distros/free-system-distribution-guidelines.html,free
23544software distribution guidelines}. Among other things, these guidelines
23545reject non-free firmware, recommendations of non-free software, and discuss
23546ways to deal with trademarks and patents.
23547
23548Some otherwise free upstream package sources contain a small and optional
23549subset that violates the above guidelines, for instance because this subset
23550is itself non-free code. When that happens, the offending items are removed
23551with appropriate patches or code snippets in the @code{origin} form of the
23552package (@pxref{Pakete definieren}). This way, @code{guix build --source}
23553returns the ``freed'' source rather than the unmodified upstream source.
23554
23555
23556@node Paketbenennung
23557@subsection Paketbenennung
23558
23559@cindex package name
23560A package has actually two names associated with it: First, there is the
23561name of the @emph{Scheme variable}, the one following @code{define-public}.
23562By this name, the package can be made known in the Scheme code, for instance
23563as input to another package. Second, there is the string in the @code{name}
23564field of a package definition. This name is used by package management
23565commands such as @command{guix package} and @command{guix build}.
23566
23567Both are usually the same and correspond to the lowercase conversion of the
23568project name chosen upstream, with underscores replaced with hyphens. For
23569instance, GNUnet is available as @code{gnunet}, and SDL_net as
23570@code{sdl-net}.
23571
23572We do not add @code{lib} prefixes for library packages, unless these are
23573already part of the official project name. But @pxref{Python-Module} and
23574@ref{Perl-Module} for special rules concerning modules for the Python and
23575Perl languages.
23576
23577Font package names are handled differently, @pxref{Schriftarten}.
23578
23579
23580@node Versionsnummern
23581@subsection Versionsnummern
23582
23583@cindex package version
23584We usually package only the latest version of a given free software
23585project. But sometimes, for instance for incompatible library versions, two
23586(or more) versions of the same package are needed. These require different
23587Scheme variable names. We use the name as defined in @ref{Paketbenennung}
23588for the most recent version; previous versions use the same name, suffixed
23589by @code{-} and the smallest prefix of the version number that may
23590distinguish the two versions.
23591
23592The name inside the package definition is the same for all versions of a
23593package and does not contain any version number.
23594
23595For instance, the versions 2.24.20 and 3.9.12 of GTK+ may be packaged as
23596follows:
23597
23598@example
23599(define-public gtk+
23600 (package
23601 (name "gtk+")
23602 (version "3.9.12")
23603 ...))
23604(define-public gtk+-2
23605 (package
23606 (name "gtk+")
23607 (version "2.24.20")
23608 ...))
23609@end example
23610If we also wanted GTK+ 3.8.2, this would be packaged as
23611@example
23612(define-public gtk+-3.8
23613 (package
23614 (name "gtk+")
23615 (version "3.8.2")
23616 ...))
23617@end example
23618
23619@c See <https://lists.gnu.org/archive/html/guix-devel/2016-01/msg00425.html>,
23620@c for a discussion of what follows.
23621@cindex version number, for VCS snapshots
23622Occasionally, we package snapshots of upstream's version control system
23623(VCS) instead of formal releases. This should remain exceptional, because
23624it is up to upstream developers to clarify what the stable release is. Yet,
23625it is sometimes necessary. So, what should we put in the @code{version}
23626field?
23627
23628Clearly, we need to make the commit identifier of the VCS snapshot visible
23629in the version string, but we also need to make sure that the version string
23630is monotonically increasing so that @command{guix package --upgrade} can
23631determine which version is newer. Since commit identifiers, notably with
23632Git, are not monotonically increasing, we add a revision number that we
23633increase each time we upgrade to a newer snapshot. The resulting version
23634string looks like this:
23635
23636@example
236372.0.11-3.cabba9e
23638 ^ ^ ^
23639 | | `-- upstream commit ID
23640 | |
23641 | `--- Guix package revision
23642 |
23643latest upstream version
23644@end example
23645
23646It is a good idea to strip commit identifiers in the @code{version} field
23647to, say, 7 digits. It avoids an aesthetic annoyance (assuming aesthetics
23648have a role to play here) as well as problems related to OS limits such as
23649the maximum shebang length (127 bytes for the Linux kernel.) It is best to
23650use the full commit identifiers in @code{origin}s, though, to avoid
23651ambiguities. A typical package definition may look like this:
23652
23653@example
23654(define my-package
23655 (let ((commit "c3f29bc928d5900971f65965feaae59e1272a3f7")
23656 (revision "1")) ;Guix package revision
23657 (package
23658 (version (git-version "0.9" revision commit))
23659 (source (origin
23660 (method git-fetch)
23661 (uri (git-reference
23662 (url "git://example.org/my-package.git")
23663 (commit commit)))
23664 (sha256 (base32 "1mbikn@dots{}"))
23665 (file-name (git-file-name name version))))
23666 ;; @dots{}
23667 )))
23668@end example
23669
23670@node Zusammenfassungen und Beschreibungen
23671@subsection Zusammenfassungen und Beschreibungen
23672
23673@cindex package description
23674@cindex package synopsis
23675As we have seen before, each package in GNU@tie{}Guix includes a synopsis
23676and a description (@pxref{Pakete definieren}). Synopses and descriptions
23677are important: They are what @command{guix package --search} searches, and a
23678crucial piece of information to help users determine whether a given package
23679suits their needs. Consequently, packagers should pay attention to what
23680goes into them.
23681
23682Synopses must start with a capital letter and must not end with a period.
23683They must not start with ``a'' or ``the'', which usually does not bring
23684anything; for instance, prefer ``File-frobbing tool'' over ``A tool that
23685frobs files''. The synopsis should say what the package is---e.g., ``Core
23686GNU utilities (file, text, shell)''---or what it is used for---e.g., the
23687synopsis for GNU@tie{}grep is ``Print lines matching a pattern''.
23688
23689Keep in mind that the synopsis must be meaningful for a very wide audience.
23690For example, ``Manipulate alignments in the SAM format'' might make sense
23691for a seasoned bioinformatics researcher, but might be fairly unhelpful or
23692even misleading to a non-specialized audience. It is a good idea to come up
23693with a synopsis that gives an idea of the application domain of the
23694package. In this example, this might give something like ``Manipulate
23695nucleotide sequence alignments'', which hopefully gives the user a better
23696idea of whether this is what they are looking for.
23697
23698Descriptions should take between five and ten lines. Use full sentences,
23699and avoid using acronyms without first introducing them. Please avoid
23700marketing phrases such as ``world-leading'', ``industrial-strength'', and
23701``next-generation'', and avoid superlatives like ``the most
23702advanced''---they are not helpful to users looking for a package and may
23703even sound suspicious. Instead, try to be factual, mentioning use cases and
23704features.
23705
23706@cindex Texinfo markup, in package descriptions
23707Descriptions can include Texinfo markup, which is useful to introduce
23708ornaments such as @code{@@code} or @code{@@dfn}, bullet lists, or hyperlinks
23709(@pxref{Overview,,, texinfo, GNU Texinfo}). However you should be careful
23710when using some characters for example @samp{@@} and curly braces which are
23711the basic special characters in Texinfo (@pxref{Special Characters,,,
23712texinfo, GNU Texinfo}). User interfaces such as @command{guix package
23713--show} take care of rendering it appropriately.
23714
23715Synopses and descriptions are translated by volunteers
23716@uref{http://translationproject.org/domain/guix-packages.html, at the
23717Translation Project} so that as many users as possible can read them in
23718their native language. User interfaces search them and display them in the
23719language specified by the current locale.
23720
23721To allow @command{xgettext} to extract them as translatable strings,
23722synopses and descriptions @emph{must be literal strings}. This means that
23723you cannot use @code{string-append} or @code{format} to construct these
23724strings:
23725
23726@lisp
23727(package
23728 ;; @dots{}
23729 (synopsis "This is translatable")
23730 (description (string-append "This is " "*not*" " translatable.")))
23731@end lisp
23732
23733Translation is a lot of work so, as a packager, please pay even more
23734attention to your synopses and descriptions as every change may entail
23735additional work for translators. In order to help them, it is possible to
23736make recommendations or instructions visible to them by inserting special
23737comments like this (@pxref{xgettext Invocation,,, gettext, GNU Gettext}):
23738
23739@example
23740;; TRANSLATORS: "X11 resize-and-rotate" should not be translated.
23741(description "ARandR is designed to provide a simple visual front end
23742for the X11 resize-and-rotate (RandR) extension. @dots{}")
23743@end example
23744
23745
23746@node Python-Module
23747@subsection Python-Module
23748
23749@cindex python
23750We currently package Python 2 and Python 3, under the Scheme variable names
23751@code{python-2} and @code{python} as explained in @ref{Versionsnummern}. To
23752avoid confusion and naming clashes with other programming languages, it
23753seems desirable that the name of a package for a Python module contains the
23754word @code{python}.
23755
23756Some modules are compatible with only one version of Python, others with
23757both. If the package Foo compiles only with Python 3, we name it
23758@code{python-foo}; if it compiles only with Python 2, we name it
23759@code{python2-foo}. If it is compatible with both versions, we create two
23760packages with the corresponding names.
23761
23762If a project already contains the word @code{python}, we drop this; for
23763instance, the module python-dateutil is packaged under the names
23764@code{python-dateutil} and @code{python2-dateutil}. If the project name
793dcd8c 23765starts with @code{py} (e.g.@: @code{pytz}), we keep it and prefix it as
1e40e70b
JL
23766described above.
23767
23768@subsubsection Specifying Dependencies
23769@cindex inputs, for Python packages
23770
23771Dependency information for Python packages is usually available in the
23772package source tree, with varying degrees of accuracy: in the
23773@file{setup.py} file, in @file{requirements.txt}, or in @file{tox.ini}.
23774
23775Your mission, when writing a recipe for a Python package, is to map these
23776dependencies to the appropriate type of ``input'' (@pxref{„package“-Referenz,
23777inputs}). Although the @code{pypi} importer normally does a good job
23778(@pxref{Aufruf von guix import}), you may want to check the following check
23779list to determine which dependency goes where.
23780
23781@itemize
23782
23783@item
23784We currently package Python 2 with @code{setuptools} and @code{pip}
23785installed like Python 3.4 has per default. Thus you don't need to specify
23786either of these as an input. @command{guix lint} will warn you if you do.
23787
23788@item
23789Python dependencies required at run time go into @code{propagated-inputs}.
23790They are typically defined with the @code{install_requires} keyword in
23791@file{setup.py}, or in the @file{requirements.txt} file.
23792
23793@item
23794Python packages required only at build time---e.g., those listed with the
23795@code{setup_requires} keyword in @file{setup.py}---or only for
23796testing---e.g., those in @code{tests_require}---go into
23797@code{native-inputs}. The rationale is that (1) they do not need to be
23798propagated because they are not needed at run time, and (2) in a
23799cross-compilation context, it's the ``native'' input that we'd want.
23800
23801Examples are the @code{pytest}, @code{mock}, and @code{nose} test
23802frameworks. Of course if any of these packages is also required at
23803run-time, it needs to go to @code{propagated-inputs}.
23804
23805@item
23806Anything that does not fall in the previous categories goes to
23807@code{inputs}, for example programs or C libraries required for building
23808Python packages containing C extensions.
23809
23810@item
23811If a Python package has optional dependencies (@code{extras_require}), it is
23812up to you to decide whether to add them or not, based on their
23813usefulness/overhead ratio (@pxref{Einreichen von Patches, @command{guix size}}).
23814
23815@end itemize
23816
23817
23818@node Perl-Module
23819@subsection Perl-Module
23820
23821@cindex perl
23822Perl programs standing for themselves are named as any other package, using
23823the lowercase upstream name. For Perl packages containing a single class,
23824we use the lowercase class name, replace all occurrences of @code{::} by
23825dashes and prepend the prefix @code{perl-}. So the class @code{XML::Parser}
23826becomes @code{perl-xml-parser}. Modules containing several classes keep
23827their lowercase upstream name and are also prepended by @code{perl-}. Such
23828modules tend to have the word @code{perl} somewhere in their name, which
23829gets dropped in favor of the prefix. For instance, @code{libwww-perl}
23830becomes @code{perl-libwww}.
23831
23832
23833@node Java-Pakete
23834@subsection Java-Pakete
23835
23836@cindex java
23837Java programs standing for themselves are named as any other package, using
23838the lowercase upstream name.
23839
23840To avoid confusion and naming clashes with other programming languages, it
23841is desirable that the name of a package for a Java package is prefixed with
23842@code{java-}. If a project already contains the word @code{java}, we drop
23843this; for instance, the package @code{ngsjava} is packaged under the name
23844@code{java-ngs}.
23845
23846For Java packages containing a single class or a small class hierarchy, we
23847use the lowercase class name, replace all occurrences of @code{.} by dashes
23848and prepend the prefix @code{java-}. So the class @code{apache.commons.cli}
23849becomes package @code{java-apache-commons-cli}.
23850
23851
23852@node Schriftarten
23853@subsection Schriftarten
23854
23855@cindex Schriftarten
23856For fonts that are in general not installed by a user for typesetting
23857purposes, or that are distributed as part of a larger software package, we
23858rely on the general packaging rules for software; for instance, this applies
23859to the fonts delivered as part of the X.Org system or fonts that are part of
23860TeX Live.
23861
23862To make it easier for a user to search for fonts, names for other packages
23863containing only fonts are constructed as follows, independently of the
23864upstream package name.
23865
23866The name of a package containing only one font family starts with
23867@code{font-}; it is followed by the foundry name and a dash @code{-} if the
23868foundry is known, and the font family name, in which spaces are replaced by
23869dashes (and as usual, all upper case letters are transformed to lower
23870case). For example, the Gentium font family by SIL is packaged under the
23871name @code{font-sil-gentium}.
23872
23873For a package containing several font families, the name of the collection
23874is used in the place of the font family name. For instance, the Liberation
23875fonts consist of three families, Liberation Sans, Liberation Serif and
23876Liberation Mono. These could be packaged separately under the names
23877@code{font-liberation-sans} and so on; but as they are distributed together
23878under a common name, we prefer to package them together as
23879@code{font-liberation}.
23880
23881In the case where several formats of the same font family or font collection
23882are packaged separately, a short form of the format, prepended by a dash, is
23883added to the package name. We use @code{-ttf} for TrueType fonts,
23884@code{-otf} for OpenType fonts and @code{-type1} for PostScript Type 1
23885fonts.
23886
23887
23888
23889@node Bootstrapping
23890@section Bootstrapping
23891
23892@c Adapted from the ELS 2013 paper.
23893
23894@cindex bootstrapping
23895
23896Bootstrapping in our context refers to how the distribution gets built
23897``from nothing''. Remember that the build environment of a derivation
23898contains nothing but its declared inputs (@pxref{Einführung}). So there's
23899an obvious chicken-and-egg problem: how does the first package get built?
23900How does the first compiler get compiled? Note that this is a question of
23901interest only to the curious hacker, not to the regular user, so you can
23902shamelessly skip this section if you consider yourself a ``regular user''.
23903
23904@cindex bootstrap binaries
23905The GNU system is primarily made of C code, with libc at its core. The GNU
23906build system itself assumes the availability of a Bourne shell and
23907command-line tools provided by GNU Coreutils, Awk, Findutils, `sed', and
23908`grep'. Furthermore, build programs---programs that run @code{./configure},
23909@code{make}, etc.---are written in Guile Scheme (@pxref{Ableitungen}).
23910Consequently, to be able to build anything at all, from scratch, Guix relies
23911on pre-built binaries of Guile, GCC, Binutils, libc, and the other packages
23912mentioned above---the @dfn{bootstrap binaries}.
23913
23914These bootstrap binaries are ``taken for granted'', though we can also
23915re-create them if needed (more on that later).
23916
23917@unnumberedsubsec Preparing to Use the Bootstrap Binaries
23918
23919@c As of Emacs 24.3, Info-mode displays the image, but since it's a
23920@c large image, it's hard to scroll. Oh well.
23921@image{images/bootstrap-graph,6in,,Dependency graph of the early bootstrap
23922derivations}
23923
23924The figure above shows the very beginning of the dependency graph of the
23925distribution, corresponding to the package definitions of the @code{(gnu
23926packages bootstrap)} module. A similar figure can be generated with
23927@command{guix graph} (@pxref{Aufruf von guix graph}), along the lines of:
23928
23929@example
23930guix graph -t derivation \
23931 -e '(@@@@ (gnu packages bootstrap) %bootstrap-gcc)' \
23932 | dot -Tps > t.ps
23933@end example
23934
23935At this level of detail, things are slightly complex. First, Guile itself
23936consists of an ELF executable, along with many source and compiled Scheme
23937files that are dynamically loaded when it runs. This gets stored in the
23938@file{guile-2.0.7.tar.xz} tarball shown in this graph. This tarball is part
23939of Guix's ``source'' distribution, and gets inserted into the store with
23940@code{add-to-store} (@pxref{Der Store}).
23941
23942But how do we write a derivation that unpacks this tarball and adds it to
23943the store? To solve this problem, the @code{guile-bootstrap-2.0.drv}
23944derivation---the first one that gets built---uses @code{bash} as its
23945builder, which runs @code{build-bootstrap-guile.sh}, which in turn calls
23946@code{tar} to unpack the tarball. Thus, @file{bash}, @file{tar}, @file{xz},
23947and @file{mkdir} are statically-linked binaries, also part of the Guix
23948source distribution, whose sole purpose is to allow the Guile tarball to be
23949unpacked.
23950
23951Once @code{guile-bootstrap-2.0.drv} is built, we have a functioning Guile
23952that can be used to run subsequent build programs. Its first task is to
23953download tarballs containing the other pre-built binaries---this is what the
23954@code{.tar.xz.drv} derivations do. Guix modules such as
23955@code{ftp-client.scm} are used for this purpose. The
23956@code{module-import.drv} derivations import those modules in a directory in
23957the store, using the original layout. The @code{module-import-compiled.drv}
23958derivations compile those modules, and write them in an output directory
23959with the right layout. This corresponds to the @code{#:modules} argument of
23960@code{build-expression->derivation} (@pxref{Ableitungen}).
23961
23962Finally, the various tarballs are unpacked by the derivations
23963@code{gcc-bootstrap-0.drv}, @code{glibc-bootstrap-0.drv}, etc., at which
23964point we have a working C tool chain.
23965
23966
23967@unnumberedsubsec Building the Build Tools
23968
23969Bootstrapping is complete when we have a full tool chain that does not
23970depend on the pre-built bootstrap tools discussed above. This no-dependency
23971requirement is verified by checking whether the files of the final tool
23972chain contain references to the @file{/gnu/store} directories of the
23973bootstrap inputs. The process that leads to this ``final'' tool chain is
23974described by the package definitions found in the @code{(gnu packages
23975commencement)} module.
23976
23977The @command{guix graph} command allows us to ``zoom out'' compared to the
23978graph above, by looking at the level of package objects instead of
23979individual derivations---remember that a package may translate to several
23980derivations, typically one derivation to download its source, one to build
23981the Guile modules it needs, and one to actually build the package from
23982source. The command:
23983
23984@example
23985guix graph -t bag \
23986 -e '(@@@@ (gnu packages commencement)
23987 glibc-final-with-bootstrap-bash)' | dot -Tps > t.ps
23988@end example
23989
23990@noindent
23991produces the dependency graph leading to the ``final'' C
23992library@footnote{You may notice the @code{glibc-intermediate} label,
23993suggesting that it is not @emph{quite} final, but as a good approximation,
23994we will consider it final.}, depicted below.
23995
23996@image{images/bootstrap-packages,6in,,Dependency graph of the early
23997packages}
23998
23999@c See <http://lists.gnu.org/archive/html/gnu-system-discuss/2012-10/msg00000.html>.
24000The first tool that gets built with the bootstrap binaries is
24001GNU@tie{}Make---noted @code{make-boot0} above---which is a prerequisite for
24002all the following packages. From there Findutils and Diffutils get built.
24003
24004Then come the first-stage Binutils and GCC, built as pseudo cross
24005tools---i.e., with @code{--target} equal to @code{--host}. They are used to
24006build libc. Thanks to this cross-build trick, this libc is guaranteed not
24007to hold any reference to the initial tool chain.
24008
24009From there the final Binutils and GCC (not shown above) are built. GCC uses
24010@code{ld} from the final Binutils, and links programs against the just-built
24011libc. This tool chain is used to build the other packages used by Guix and
24012by the GNU Build System: Guile, Bash, Coreutils, etc.
24013
24014And voilà! At this point we have the complete set of build tools that the
24015GNU Build System expects. These are in the @code{%final-inputs} variable of
24016the @code{(gnu packages commencement)} module, and are implicitly used by
24017any package that uses @code{gnu-build-system} (@pxref{Erstellungssysteme,
24018@code{gnu-build-system}}).
24019
24020
24021@unnumberedsubsec Building the Bootstrap Binaries
24022
24023@cindex bootstrap binaries
24024Because the final tool chain does not depend on the bootstrap binaries,
24025those rarely need to be updated. Nevertheless, it is useful to have an
24026automated way to produce them, should an update occur, and this is what the
24027@code{(gnu packages make-bootstrap)} module provides.
24028
24029The following command builds the tarballs containing the bootstrap binaries
24030(Guile, Binutils, GCC, libc, and a tarball containing a mixture of Coreutils
24031and other basic command-line tools):
24032
24033@example
24034guix build bootstrap-tarballs
24035@end example
24036
24037The generated tarballs are those that should be referred to in the
24038@code{(gnu packages bootstrap)} module mentioned at the beginning of this
24039section.
24040
24041Still here? Then perhaps by now you've started to wonder: when do we reach a
24042fixed point? That is an interesting question! The answer is unknown, but if
24043you would like to investigate further (and have significant computational
24044and storage resources to do so), then let us know.
24045
24046@unnumberedsubsec Reducing the Set of Bootstrap Binaries
24047
24048Our bootstrap binaries currently include GCC, Guile, etc. That's a lot of
24049binary code! Why is that a problem? It's a problem because these big chunks
24050of binary code are practically non-auditable, which makes it hard to
24051establish what source code produced them. Every unauditable binary also
24052leaves us vulnerable to compiler backdoors as described by Ken Thompson in
24053the 1984 paper @emph{Reflections on Trusting Trust}.
24054
24055This is mitigated by the fact that our bootstrap binaries were generated
24056from an earlier Guix revision. Nevertheless it lacks the level of
24057transparency that we get in the rest of the package dependency graph, where
24058Guix always gives us a source-to-binary mapping. Thus, our goal is to
24059reduce the set of bootstrap binaries to the bare minimum.
24060
24061The @uref{http://bootstrappable.org, Bootstrappable.org web site} lists
24062on-going projects to do that. One of these is about replacing the bootstrap
24063GCC with a sequence of assemblers, interpreters, and compilers of increasing
24064complexity, which could be built from source starting from a simple and
24065auditable assembler. Your help is welcome!
24066
24067
24068@node Portierung
24069@section Porting to a New Platform
24070
24071As discussed above, the GNU distribution is self-contained, and
24072self-containment is achieved by relying on pre-built ``bootstrap binaries''
24073(@pxref{Bootstrapping}). These binaries are specific to an operating system
24074kernel, CPU architecture, and application binary interface (ABI). Thus, to
24075port the distribution to a platform that is not yet supported, one must
24076build those bootstrap binaries, and update the @code{(gnu packages
24077bootstrap)} module to use them on that platform.
24078
24079Fortunately, Guix can @emph{cross compile} those bootstrap binaries. When
24080everything goes well, and assuming the GNU tool chain supports the target
24081platform, this can be as simple as running a command like this one:
24082
24083@example
24084guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs
24085@end example
24086
24087For this to work, the @code{glibc-dynamic-linker} procedure in @code{(gnu
24088packages bootstrap)} must be augmented to return the right file name for
24089libc's dynamic linker on that platform; likewise,
24090@code{system->linux-architecture} in @code{(gnu packages linux)} must be
24091taught about the new platform.
24092
24093Once these are built, the @code{(gnu packages bootstrap)} module needs to be
24094updated to refer to these binaries on the target platform. That is, the
24095hashes and URLs of the bootstrap tarballs for the new platform must be added
24096alongside those of the currently supported platforms. The bootstrap Guile
24097tarball is treated specially: it is expected to be available locally, and
793dcd8c 24098@file{gnu/local.mk} has rules to download it for the supported
1e40e70b
JL
24099architectures; a rule for the new platform must be added as well.
24100
24101In practice, there may be some complications. First, it may be that the
24102extended GNU triplet that specifies an ABI (like the @code{eabi} suffix
24103above) is not recognized by all the GNU tools. Typically, glibc recognizes
24104some of these, whereas GCC uses an extra @code{--with-abi} configure flag
24105(see @code{gcc.scm} for examples of how to handle this). Second, some of
24106the required packages could fail to build for that platform. Lastly, the
24107generated binaries could be broken for some reason.
24108
24109@c *********************************************************************
24110@include contributing.de.texi
24111
24112@c *********************************************************************
24113@node Danksagungen
24114@chapter Danksagungen
24115
24116Guix is based on the @uref{http://nixos.org/nix/, Nix package manager},
24117which was designed and implemented by Eelco Dolstra, with contributions from
24118other people (see the @file{nix/AUTHORS} file in Guix.) Nix pioneered
24119functional package management, and promoted unprecedented features, such as
24120transactional package upgrades and rollbacks, per-user profiles, and
24121referentially transparent build processes. Without this work, Guix would
24122not exist.
24123
24124The Nix-based software distributions, Nixpkgs and NixOS, have also been an
24125inspiration for Guix.
24126
24127GNU@tie{}Guix itself is a collective work with contributions from a number
24128of people. See the @file{AUTHORS} file in Guix for more information on
24129these fine people. The @file{THANKS} file lists people who have helped by
24130reporting bugs, taking care of the infrastructure, providing artwork and
24131themes, making suggestions, and more---thank you!
24132
24133
24134@c *********************************************************************
24135@node GNU-Lizenz für freie Dokumentation
24136@appendix GNU-Lizenz für freie Dokumentation
24137@cindex license, GNU Free Documentation License
24138@include fdl-1.3.texi
24139
24140@c *********************************************************************
24141@node Konzeptverzeichnis
24142@unnumbered Konzeptverzeichnis
24143@printindex cp
24144
24145@node Programmierverzeichnis
24146@unnumbered Programmierverzeichnis
24147@syncodeindex tp fn
24148@syncodeindex vr fn
24149@printindex fn
24150
24151@bye
24152
24153@c Local Variables:
24154@c ispell-local-dictionary: "american";
24155@c End: