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>
4 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu installer services)
22 #:use-module (guix records)
23 #:use-module (srfi srfi-1)
24 #:export (system-service?
27 system-service-recommended?
28 system-service-snippet
29 system-service-packages
31 desktop-system-service?
32 networking-system-service?
35 system-services->configuration))
37 (define-record-type* <system-service>
38 system-service make-system-service
40 (name system-service-name) ;string
41 (type system-service-type) ;'desktop | 'networking
42 (recommended? system-service-recommended? ;Boolean
44 (snippet system-service-snippet ;list of sexps
46 (packages system-service-packages ;list of sexps
49 ;; This is the list of desktop environments supported as services.
50 (define %system-services
51 (let-syntax ((desktop-environment (syntax-rules ()
56 (G_ (syntax-rules () ;for xgettext
61 (snippet '((service gnome-desktop-service-type))))
64 (snippet '((service xfce-desktop-service-type))))
67 (snippet '((service mate-desktop-service-type))))
69 (name "Enlightenment")
70 (snippet '((service enlightenment-desktop-service-type))))
73 (packages '((specification->package "openbox"))))
76 (packages '((specification->package "awesome"))))
79 (packages (map (lambda (package)
80 `(specification->package ,package))
81 '("i3-wm" "i3status" "dmenu" "st"))))
84 (packages '((specification->package "ratpoison")
85 (specification->package "xterm"))))
88 (packages '((specification->package "emacs")
89 (specification->package "emacs-exwm")
90 (specification->package "emacs-desktop-environment"))))
94 (name (G_ "OpenSSH secure shell daemon (sshd)"))
96 (snippet '((service openssh-service-type))))
98 (name (G_ "Tor anonymous network router"))
100 (snippet '((service tor-service-type))))
102 (name (G_ "Mozilla NSS certificates, for HTTPS access"))
104 (packages '((specification->package "nss-certs")))
107 ;; Network connectivity management.
109 (name (G_ "NetworkManager network connection manager"))
110 (type 'network-management)
111 (snippet '((service network-manager-service-type)
112 (service wpa-supplicant-service-type))))
114 (name (G_ "Connman network connection manager"))
115 (type 'network-management)
116 (snippet '((service connman-service-type)
117 (service wpa-supplicant-service-type))))
119 (name (G_ "DHCP client (dynamic IP address assignment)"))
120 (type 'network-management)
121 (snippet '((service dhcp-client-service-type)))))))
123 (define (desktop-system-service? service)
124 "Return true if SERVICE is a desktop environment service."
125 (eq? 'desktop (system-service-type service)))
127 (define (networking-system-service? service)
128 "Return true if SERVICE is a desktop environment service."
129 (eq? 'networking (system-service-type service)))
131 (define (system-services->configuration services)
132 "Return the configuration field for SERVICES."
133 (let* ((snippets (append-map system-service-snippet services))
134 (packages (append-map system-service-packages services))
135 (desktop? (find desktop-system-service? services))
140 `(,@(if (null? packages)
142 `((packages (append (list ,@packages)
145 `(,@(if (null? packages)
147 `((packages (append (list ,@packages)
149 (services (append (list ,@snippets
152 ;; XXX: Assume 'keyboard-layout' is in
154 '((set-xorg-configuration
156 (keyboard-layout keyboard-layout))))