2018-12-05 06:41:48 +01:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
|
2019-04-07 17:15:06 +02:00
|
|
|
;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
|
2018-12-05 06:41:48 +01:00
|
|
|
;;;
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (gnu installer services)
|
|
|
|
#:use-module (guix records)
|
2019-04-07 17:15:06 +02:00
|
|
|
#:use-module (srfi srfi-1)
|
|
|
|
#:export (system-service?
|
|
|
|
system-service-name
|
|
|
|
system-service-type
|
2019-04-28 21:45:16 +02:00
|
|
|
system-service-recommended?
|
2019-04-07 17:15:06 +02:00
|
|
|
system-service-snippet
|
2019-04-28 21:45:16 +02:00
|
|
|
system-service-packages
|
2018-12-05 06:41:48 +01:00
|
|
|
|
2019-04-07 17:15:06 +02:00
|
|
|
desktop-system-service?
|
2019-04-07 18:02:39 +02:00
|
|
|
networking-system-service?
|
2018-12-05 06:41:48 +01:00
|
|
|
|
2019-04-07 17:15:06 +02:00
|
|
|
%system-services
|
|
|
|
system-services->configuration))
|
|
|
|
|
|
|
|
(define-record-type* <system-service>
|
|
|
|
system-service make-system-service
|
|
|
|
system-service?
|
|
|
|
(name system-service-name) ;string
|
2019-04-07 18:02:39 +02:00
|
|
|
(type system-service-type) ;'desktop | 'networking
|
2019-04-28 21:45:16 +02:00
|
|
|
(recommended? system-service-recommended? ;Boolean
|
|
|
|
(default #f))
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet system-service-snippet ;list of sexps
|
|
|
|
(default '()))
|
|
|
|
(packages system-service-packages ;list of sexps
|
|
|
|
(default '())))
|
2018-12-05 06:41:48 +01:00
|
|
|
|
|
|
|
;; This is the list of desktop environments supported as services.
|
2019-04-07 17:15:06 +02:00
|
|
|
(define %system-services
|
|
|
|
(let-syntax ((desktop-environment (syntax-rules ()
|
|
|
|
((_ fields ...)
|
|
|
|
(system-service
|
|
|
|
(type 'desktop)
|
2019-04-07 21:41:51 +02:00
|
|
|
fields ...))))
|
|
|
|
(G_ (syntax-rules () ;for xgettext
|
|
|
|
((_ str) str))))
|
2019-04-07 17:15:06 +02:00
|
|
|
(list
|
|
|
|
(desktop-environment
|
|
|
|
(name "GNOME")
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet '((service gnome-desktop-service-type))))
|
2019-04-07 17:15:06 +02:00
|
|
|
(desktop-environment
|
|
|
|
(name "Xfce")
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet '((service xfce-desktop-service-type))))
|
2019-04-07 17:15:06 +02:00
|
|
|
(desktop-environment
|
|
|
|
(name "MATE")
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet '((service mate-desktop-service-type))))
|
2019-04-07 17:15:06 +02:00
|
|
|
(desktop-environment
|
|
|
|
(name "Enlightenment")
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet '((service enlightenment-desktop-service-type))))
|
|
|
|
(desktop-environment
|
|
|
|
(name "Openbox")
|
|
|
|
(packages '((specification->package "openbox"))))
|
|
|
|
(desktop-environment
|
|
|
|
(name "awesome")
|
|
|
|
(packages '((specification->package "awesome"))))
|
|
|
|
(desktop-environment
|
|
|
|
(name "i3")
|
|
|
|
(packages '((specification->package "i3-wm"))))
|
|
|
|
(desktop-environment
|
|
|
|
(name "ratpoison")
|
|
|
|
(packages '((specification->package "ratpoison"))))
|
2019-04-07 18:02:39 +02:00
|
|
|
|
|
|
|
;; Networking.
|
|
|
|
(system-service
|
2019-04-07 21:41:51 +02:00
|
|
|
(name (G_ "OpenSSH secure shell daemon (sshd)"))
|
2019-04-07 18:02:39 +02:00
|
|
|
(type 'networking)
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet '((service openssh-service-type))))
|
2019-04-07 18:02:39 +02:00
|
|
|
(system-service
|
2019-04-07 21:41:51 +02:00
|
|
|
(name (G_ "Tor anonymous network router"))
|
2019-04-07 18:02:39 +02:00
|
|
|
(type 'networking)
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet '((service tor-service-type))))
|
2019-04-28 21:46:44 +02:00
|
|
|
(system-service
|
|
|
|
(name (G_ "Mozilla NSS certificates, for HTTPS access"))
|
|
|
|
(type 'networking)
|
|
|
|
(packages '((specification->package "nss-certs")))
|
|
|
|
(recommended? #t))
|
2019-04-07 21:20:10 +02:00
|
|
|
|
|
|
|
;; Network connectivity management.
|
|
|
|
(system-service
|
2019-04-07 21:41:51 +02:00
|
|
|
(name (G_ "NetworkManager network connection manager"))
|
2019-04-07 21:20:10 +02:00
|
|
|
(type 'network-management)
|
2019-04-12 23:19:41 +02:00
|
|
|
(snippet '((service network-manager-service-type)
|
|
|
|
(service wpa-supplicant-service-type))))
|
2019-04-07 21:20:10 +02:00
|
|
|
(system-service
|
2019-04-07 21:41:51 +02:00
|
|
|
(name (G_ "Connman network connection manager"))
|
2019-04-07 21:20:10 +02:00
|
|
|
(type 'network-management)
|
2019-04-12 23:19:41 +02:00
|
|
|
(snippet '((service connman-service-type)
|
|
|
|
(service wpa-supplicant-service-type))))
|
2019-04-07 21:20:10 +02:00
|
|
|
(system-service
|
2019-04-07 21:41:51 +02:00
|
|
|
(name (G_ "DHCP client (dynamic IP address assignment)"))
|
2019-04-07 21:20:10 +02:00
|
|
|
(type 'network-management)
|
2019-04-17 00:27:04 +02:00
|
|
|
(snippet '((service dhcp-client-service-type)))))))
|
2019-04-07 17:15:06 +02:00
|
|
|
|
|
|
|
(define (desktop-system-service? service)
|
|
|
|
"Return true if SERVICE is a desktop environment service."
|
|
|
|
(eq? 'desktop (system-service-type service)))
|
2018-12-05 06:41:48 +01:00
|
|
|
|
2019-04-07 18:02:39 +02:00
|
|
|
(define (networking-system-service? service)
|
|
|
|
"Return true if SERVICE is a desktop environment service."
|
|
|
|
(eq? 'networking (system-service-type service)))
|
|
|
|
|
2019-04-07 17:15:06 +02:00
|
|
|
(define (system-services->configuration services)
|
|
|
|
"Return the configuration field for SERVICES."
|
2019-04-17 00:27:04 +02:00
|
|
|
(let* ((snippets (append-map system-service-snippet services))
|
|
|
|
(packages (append-map system-service-packages services))
|
2019-04-07 17:15:06 +02:00
|
|
|
(desktop? (find desktop-system-service? services))
|
|
|
|
(base (if desktop?
|
|
|
|
'%desktop-services
|
|
|
|
'%base-services)))
|
|
|
|
(if (null? snippets)
|
2019-04-17 00:27:04 +02:00
|
|
|
`(,@(if (null? packages)
|
|
|
|
'()
|
|
|
|
`((packages (list ,@packages))))
|
|
|
|
(services ,base))
|
|
|
|
`(,@(if (null? packages)
|
|
|
|
'()
|
|
|
|
`((packages (list ,@packages))))
|
|
|
|
(services (append (list ,@snippets
|
2019-04-08 10:36:37 +02:00
|
|
|
|
2019-04-08 10:42:10 +02:00
|
|
|
,@(if desktop?
|
|
|
|
;; XXX: Assume 'keyboard-layout' is in
|
|
|
|
;; scope.
|
|
|
|
'((set-xorg-configuration
|
|
|
|
(xorg-configuration
|
|
|
|
(keyboard-layout keyboard-layout))))
|
|
|
|
'()))
|
2019-04-08 10:36:37 +02:00
|
|
|
,base))))))
|