Commit | Line | Data |
---|---|---|
b51bde71 MO |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> | |
ff9522fb | 3 | ;;; Copyright © 2019, 2022 Ludovic Courtès <ludo@gnu.org> |
1197b8b2 | 4 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
6f13881f | 5 | ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr> |
2842a42b | 6 | ;;; Copyright © 2021 Leo Famulari <leo@famulari.name> |
b51bde71 MO |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
11 | ;;; under the terms of the GNU General Public License as published by | |
12 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
13 | ;;; your option) any later version. | |
14 | ;;; | |
15 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;;; GNU General Public License for more details. | |
19 | ;;; | |
20 | ;;; You should have received a copy of the GNU General Public License | |
21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
22 | ||
23 | (define-module (gnu installer services) | |
24 | #:use-module (guix records) | |
ff9522fb | 25 | #:use-module (guix read-print) |
75988317 LC |
26 | #:use-module (srfi srfi-1) |
27 | #:export (system-service? | |
28 | system-service-name | |
29 | system-service-type | |
1d9fcdac | 30 | system-service-recommended? |
75988317 | 31 | system-service-snippet |
1d9fcdac | 32 | system-service-packages |
b51bde71 | 33 | |
75988317 | 34 | desktop-system-service? |
b51bde71 | 35 | |
75988317 LC |
36 | %system-services |
37 | system-services->configuration)) | |
38 | ||
ff9522fb LC |
39 | (define-syntax-rule (G_ str) |
40 | ;; In this file, translatable strings are annotated with 'G_' so xgettext | |
41 | ;; catches them, but translation happens later on at run time. | |
42 | str) | |
43 | ||
75988317 LC |
44 | (define-record-type* <system-service> |
45 | system-service make-system-service | |
46 | system-service? | |
47 | (name system-service-name) ;string | |
ed44e626 | 48 | (type system-service-type) ;'desktop|'networking|… |
1d9fcdac LC |
49 | (recommended? system-service-recommended? ;Boolean |
50 | (default #f)) | |
3ad3c558 LC |
51 | (snippet system-service-snippet ;list of sexps |
52 | (default '())) | |
53 | (packages system-service-packages ;list of sexps | |
54 | (default '()))) | |
b51bde71 | 55 | |
75988317 LC |
56 | (define %system-services |
57 | (let-syntax ((desktop-environment (syntax-rules () | |
58 | ((_ fields ...) | |
59 | (system-service | |
60 | (type 'desktop) | |
ff9522fb | 61 | fields ...))))) |
75988317 | 62 | (list |
ed44e626 | 63 | ;; This is the list of desktop environments supported as services. |
75988317 LC |
64 | (desktop-environment |
65 | (name "GNOME") | |
3ad3c558 | 66 | (snippet '((service gnome-desktop-service-type)))) |
75988317 LC |
67 | (desktop-environment |
68 | (name "Xfce") | |
3ad3c558 | 69 | (snippet '((service xfce-desktop-service-type)))) |
75988317 LC |
70 | (desktop-environment |
71 | (name "MATE") | |
3ad3c558 | 72 | (snippet '((service mate-desktop-service-type)))) |
75988317 LC |
73 | (desktop-environment |
74 | (name "Enlightenment") | |
3ad3c558 LC |
75 | (snippet '((service enlightenment-desktop-service-type)))) |
76 | (desktop-environment | |
77 | (name "Openbox") | |
78 | (packages '((specification->package "openbox")))) | |
79 | (desktop-environment | |
80 | (name "awesome") | |
81 | (packages '((specification->package "awesome")))) | |
82 | (desktop-environment | |
83 | (name "i3") | |
676eb588 LC |
84 | (packages (map (lambda (package) |
85 | `(specification->package ,package)) | |
86 | '("i3-wm" "i3status" "dmenu" "st")))) | |
3ad3c558 LC |
87 | (desktop-environment |
88 | (name "ratpoison") | |
d9989022 LC |
89 | (packages '((specification->package "ratpoison") |
90 | (specification->package "xterm")))) | |
1197b8b2 JN |
91 | (desktop-environment |
92 | (name "Emacs EXWM") | |
93 | (packages '((specification->package "emacs") | |
94 | (specification->package "emacs-exwm") | |
95 | (specification->package "emacs-desktop-environment")))) | |
7d1030a6 LC |
96 | |
97 | ;; Networking. | |
98 | (system-service | |
62b0f044 | 99 | (name (G_ "OpenSSH secure shell daemon (sshd)")) |
7d1030a6 | 100 | (type 'networking) |
ff9522fb LC |
101 | (snippet `(,(vertical-space 1) |
102 | ,(comment | |
103 | (G_ "\ | |
104 | ;; To configure OpenSSH, pass an 'openssh-configuration' | |
105 | ;; record as a second argument to 'service' below.\n")) | |
106 | (service openssh-service-type)))) | |
7d1030a6 | 107 | (system-service |
62b0f044 | 108 | (name (G_ "Tor anonymous network router")) |
7d1030a6 | 109 | (type 'networking) |
3ad3c558 | 110 | (snippet '((service tor-service-type)))) |
113bc081 LC |
111 | (system-service |
112 | (name (G_ "Mozilla NSS certificates, for HTTPS access")) | |
113 | (type 'networking) | |
114 | (packages '((specification->package "nss-certs"))) | |
115 | (recommended? #t)) | |
2e55f37c | 116 | |
2842a42b LF |
117 | ;; Miscellaneous system administration services. |
118 | (system-service | |
119 | (name (G_ "Network time service (NTP), to set the clock automatically")) | |
120 | (type 'administration) | |
121 | (recommended? #t) | |
122 | (snippet '((service ntp-service-type)))) | |
0d9d1514 LF |
123 | (system-service |
124 | (name (G_ "GPM mouse daemon, to use the mouse on the console")) | |
125 | (type 'administration) | |
126 | (snippet '((service gpm-service-type)))) | |
2842a42b | 127 | |
2e55f37c LC |
128 | ;; Network connectivity management. |
129 | (system-service | |
62b0f044 | 130 | (name (G_ "NetworkManager network connection manager")) |
2e55f37c | 131 | (type 'network-management) |
c9776d5b LC |
132 | (snippet '((service network-manager-service-type) |
133 | (service wpa-supplicant-service-type)))) | |
2e55f37c | 134 | (system-service |
62b0f044 | 135 | (name (G_ "Connman network connection manager")) |
2e55f37c | 136 | (type 'network-management) |
c9776d5b LC |
137 | (snippet '((service connman-service-type) |
138 | (service wpa-supplicant-service-type)))) | |
2e55f37c | 139 | (system-service |
62b0f044 | 140 | (name (G_ "DHCP client (dynamic IP address assignment)")) |
2e55f37c | 141 | (type 'network-management) |
6f13881f TGR |
142 | (snippet '((service dhcp-client-service-type)))) |
143 | ||
144 | ;; Dealing with documents. | |
145 | (system-service | |
146 | (name (G_ "CUPS printing system (no Web interface by default)")) | |
147 | (type 'document) | |
148 | (snippet '((service cups-service-type))))))) | |
75988317 LC |
149 | |
150 | (define (desktop-system-service? service) | |
151 | "Return true if SERVICE is a desktop environment service." | |
152 | (eq? 'desktop (system-service-type service))) | |
b51bde71 | 153 | |
75988317 LC |
154 | (define (system-services->configuration services) |
155 | "Return the configuration field for SERVICES." | |
3ad3c558 LC |
156 | (let* ((snippets (append-map system-service-snippet services)) |
157 | (packages (append-map system-service-packages services)) | |
75988317 LC |
158 | (desktop? (find desktop-system-service? services)) |
159 | (base (if desktop? | |
160 | '%desktop-services | |
ff9522fb LC |
161 | '%base-services)) |
162 | (heading (list (vertical-space 1) | |
163 | (comment (G_ "\ | |
164 | ;; Below is the list of system services. To search for available | |
165 | ;; services, run 'guix system search KEYWORD' in a terminal.\n"))))) | |
166 | ||
75988317 | 167 | (if (null? snippets) |
3ad3c558 LC |
168 | `(,@(if (null? packages) |
169 | '() | |
ecb0df68 LC |
170 | `((packages (append (list ,@packages) |
171 | %base-packages)))) | |
ff9522fb LC |
172 | |
173 | ,@heading | |
3ad3c558 LC |
174 | (services ,base)) |
175 | `(,@(if (null? packages) | |
176 | '() | |
ecb0df68 LC |
177 | `((packages (append (list ,@packages) |
178 | %base-packages)))) | |
ff9522fb LC |
179 | |
180 | ,@heading | |
3ad3c558 | 181 | (services (append (list ,@snippets |
469e56b4 | 182 | |
8d75e20e LC |
183 | ,@(if desktop? |
184 | ;; XXX: Assume 'keyboard-layout' is in | |
185 | ;; scope. | |
ff9522fb | 186 | `((set-xorg-configuration |
8d75e20e LC |
187 | (xorg-configuration |
188 | (keyboard-layout keyboard-layout)))) | |
189 | '())) | |
ff9522fb LC |
190 | |
191 | ,(vertical-space 1) | |
192 | ,(comment (G_ "\ | |
193 | ;; This is the default list of services we | |
194 | ;; are appending to.\n")) | |
195 | ,base)))))) |