1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
3 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu installer services)
21 #:use-module (guix records)
22 #:use-module (srfi srfi-1)
23 #:export (system-service?
26 system-service-recommended?
27 system-service-snippet
28 system-service-packages
30 desktop-system-service?
31 networking-system-service?
34 system-services->configuration))
36 (define-record-type* <system-service>
37 system-service make-system-service
39 (name system-service-name) ;string
40 (type system-service-type) ;'desktop | 'networking
41 (recommended? system-service-recommended? ;Boolean
43 (snippet system-service-snippet ;list of sexps
45 (packages system-service-packages ;list of sexps
48 ;; This is the list of desktop environments supported as services.
49 (define %system-services
50 (let-syntax ((desktop-environment (syntax-rules ()
55 (G_ (syntax-rules () ;for xgettext
60 (snippet '((service gnome-desktop-service-type))))
63 (snippet '((service xfce-desktop-service-type))))
66 (snippet '((service mate-desktop-service-type))))
68 (name "Enlightenment")
69 (snippet '((service enlightenment-desktop-service-type))))
72 (packages '((specification->package "openbox"))))
75 (packages '((specification->package "awesome"))))
78 (packages (map (lambda (package)
79 `(specification->package ,package))
80 '("i3-wm" "i3status" "dmenu" "st"))))
83 (packages '((specification->package "ratpoison")
84 (specification->package "xterm"))))
88 (name (G_ "OpenSSH secure shell daemon (sshd)"))
90 (snippet '((service openssh-service-type))))
92 (name (G_ "Tor anonymous network router"))
94 (snippet '((service tor-service-type))))
96 (name (G_ "Mozilla NSS certificates, for HTTPS access"))
98 (packages '((specification->package "nss-certs")))
101 ;; Network connectivity management.
103 (name (G_ "NetworkManager network connection manager"))
104 (type 'network-management)
105 (snippet '((service network-manager-service-type)
106 (service wpa-supplicant-service-type))))
108 (name (G_ "Connman network connection manager"))
109 (type 'network-management)
110 (snippet '((service connman-service-type)
111 (service wpa-supplicant-service-type))))
113 (name (G_ "DHCP client (dynamic IP address assignment)"))
114 (type 'network-management)
115 (snippet '((service dhcp-client-service-type)))))))
117 (define (desktop-system-service? service)
118 "Return true if SERVICE is a desktop environment service."
119 (eq? 'desktop (system-service-type service)))
121 (define (networking-system-service? service)
122 "Return true if SERVICE is a desktop environment service."
123 (eq? 'networking (system-service-type service)))
125 (define (system-services->configuration services)
126 "Return the configuration field for SERVICES."
127 (let* ((snippets (append-map system-service-snippet services))
128 (packages (append-map system-service-packages services))
129 (desktop? (find desktop-system-service? services))
134 `(,@(if (null? packages)
136 `((packages (append (list ,@packages)
139 `(,@(if (null? packages)
141 `((packages (append (list ,@packages)
143 (services (append (list ,@snippets
146 ;; XXX: Assume 'keyboard-layout' is in
148 '((set-xorg-configuration
150 (keyboard-layout keyboard-layout))))