1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
3 ;;; Copyright © 2019, 2022 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
5 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
23 (define-module (gnu installer services)
24 #:use-module (guix records)
25 #:use-module (guix read-print)
26 #:use-module (srfi srfi-1)
27 #:export (system-service?
30 system-service-recommended?
31 system-service-snippet
32 system-service-packages
34 desktop-system-service?
37 system-services->configuration))
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.
44 (define-record-type* <system-service>
45 system-service make-system-service
47 (name system-service-name) ;string
48 (type system-service-type) ;'desktop|'networking|…
49 (recommended? system-service-recommended? ;Boolean
51 (snippet system-service-snippet ;list of sexps
53 (packages system-service-packages ;list of sexps
56 (define %system-services
57 (let-syntax ((desktop-environment (syntax-rules ()
63 ;; This is the list of desktop environments supported as services.
66 (snippet '((service gnome-desktop-service-type))))
69 (snippet '((service xfce-desktop-service-type))))
72 (snippet '((service mate-desktop-service-type))))
74 (name "Enlightenment")
75 (snippet '((service enlightenment-desktop-service-type))))
78 (packages '((specification->package "openbox"))))
81 (packages '((specification->package "awesome"))))
84 (packages (map (lambda (package)
85 `(specification->package ,package))
86 '("i3-wm" "i3status" "dmenu" "st"))))
89 (packages '((specification->package "ratpoison")
90 (specification->package "xterm"))))
93 (packages '((specification->package "emacs")
94 (specification->package "emacs-exwm")
95 (specification->package "emacs-desktop-environment"))))
99 (name (G_ "OpenSSH secure shell daemon (sshd)"))
101 (snippet `(,(vertical-space 1)
104 ;; To configure OpenSSH, pass an 'openssh-configuration'
105 ;; record as a second argument to 'service' below.\n"))
106 (service openssh-service-type))))
108 (name (G_ "Tor anonymous network router"))
110 (snippet '((service tor-service-type))))
112 (name (G_ "Mozilla NSS certificates, for HTTPS access"))
114 (packages '((specification->package "nss-certs")))
117 ;; Miscellaneous system administration services.
119 (name (G_ "Network time service (NTP), to set the clock automatically"))
120 (type 'administration)
122 (snippet '((service ntp-service-type))))
124 (name (G_ "GPM mouse daemon, to use the mouse on the console"))
125 (type 'administration)
126 (snippet '((service gpm-service-type))))
128 ;; Network connectivity management.
130 (name (G_ "NetworkManager network connection manager"))
131 (type 'network-management)
132 (snippet '((service network-manager-service-type)
133 (service wpa-supplicant-service-type))))
135 (name (G_ "Connman network connection manager"))
136 (type 'network-management)
137 (snippet '((service connman-service-type)
138 (service wpa-supplicant-service-type))))
140 (name (G_ "DHCP client (dynamic IP address assignment)"))
141 (type 'network-management)
142 (snippet '((service dhcp-client-service-type))))
144 ;; Dealing with documents.
146 (name (G_ "CUPS printing system (no Web interface by default)"))
148 (snippet '((service cups-service-type)))))))
150 (define (desktop-system-service? service)
151 "Return true if SERVICE is a desktop environment service."
152 (eq? 'desktop (system-service-type service)))
154 (define (system-services->configuration services)
155 "Return the configuration field for SERVICES."
156 (let* ((snippets (append-map system-service-snippet services))
157 (packages (append-map system-service-packages services))
158 (desktop? (find desktop-system-service? services))
162 (heading (list (vertical-space 1)
164 ;; Below is the list of system services. To search for available
165 ;; services, run 'guix system search KEYWORD' in a terminal.\n")))))
168 `(,@(if (null? packages)
170 `((packages (append (list ,@packages)
175 `(,@(if (null? packages)
177 `((packages (append (list ,@packages)
181 (services (append (list ,@snippets
184 ;; XXX: Assume 'keyboard-layout' is in
186 `((set-xorg-configuration
188 (keyboard-layout keyboard-layout))))
193 ;; This is the default list of services we
194 ;; are appending to.\n"))