installer: Add services page.

Add a page to select services, for now only desktop environments choice is
available.

* gnu/installer.scm (steps): Add services step.
* gnu/installer/newt.scm (newt-installer): Add services-page field.
* gnu/installer/newt/services.scm: New file.
* gnu/installer/record.scm (installer): Add services-page field.
* gnu/installer/services.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add new files.
* po/guix/POTFILES.in: Add new files.
This commit is contained in:
Mathieu Othacehe 2018-12-05 14:41:48 +09:00 committed by Ludovic Courtès
parent c088b2e47f
commit b51bde71a9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
7 changed files with 128 additions and 3 deletions

View file

@ -229,16 +229,22 @@ (define (installer-steps)
((installer-user-page current-installer)))) ((installer-user-page current-installer))))
(configuration-formatter users->configuration)) (configuration-formatter users->configuration))
;; Ask the user to choose one or many desktop environment(s).
(installer-step
(id 'services)
(description (G_ "Services"))
(compute (lambda _ (compute (lambda _
((installer-user-page current-installer))))) ((installer-services-page current-installer))))
(configuration-formatter
desktop-environments->configuration))
(installer-step (installer-step
(id 'final) (id 'final)
(description (G_ "Configuration file")) (description (G_ "Configuration file"))
(compute (compute
(lambda (result prev-steps) (lambda (result prev-steps)
((installer-final-page current-installer) ((installer-final-page current-installer)
result prev-steps))))))) result prev-steps))))))))
(define (installer-program) (define (installer-program)
"Return a file-like object that runs the given INSTALLER." "Return a file-like object that runs the given INSTALLER."

View file

@ -25,6 +25,7 @@ (define-module (gnu installer newt)
#:use-module (gnu installer newt locale) #:use-module (gnu installer newt locale)
#:use-module (gnu installer newt menu) #:use-module (gnu installer newt menu)
#:use-module (gnu installer newt network) #:use-module (gnu installer newt network)
#:use-module (gnu installer newt services)
#:use-module (gnu installer newt timezone) #:use-module (gnu installer newt timezone)
#:use-module (gnu installer newt user) #:use-module (gnu installer newt user)
#:use-module (gnu installer newt utils) #:use-module (gnu installer newt utils)
@ -80,6 +81,9 @@ (define (hostname-page)
(define (user-page) (define (user-page)
(run-user-page)) (run-user-page))
(define (services-page)
(run-services-page))
(define newt-installer (define newt-installer
(installer (installer
(name 'newt) (name 'newt)
@ -94,4 +98,5 @@ (define newt-installer
(timezone-page timezone-page) (timezone-page timezone-page)
(hostname-page hostname-page) (hostname-page hostname-page)
(user-page user-page) (user-page user-page)
(services-page services-page)
(welcome-page welcome-page))) (welcome-page welcome-page)))

View file

@ -0,0 +1,48 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; 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 newt services)
#:use-module (gnu installer services)
#:use-module (gnu installer steps)
#:use-module (gnu installer newt page)
#:use-module (gnu installer newt utils)
#:use-module (guix i18n)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (newt)
#:export (run-services-page))
(define (run-desktop-environments-cbt-page)
"Run a page allowing the user to choose between various desktop
environments."
(run-checkbox-tree-page
#:info-text (G_ "Please select the desktop(s) environment(s) you wish to \
install. If you select multiple desktops environments, we will be able to \
choose the one to use on the log-in screen with F1.")
#:title (G_ "Desktop environment")
#:items %desktop-environments
#:item->text desktop-environment-name
#:checkbox-tree-height 5
#:cancel-button-callback-procedure
(lambda ()
(raise
(condition
(&installer-step-abort))))))
(define (run-services-page)
(run-desktop-environments-cbt-page))

View file

@ -35,6 +35,7 @@ (define-module (gnu installer record)
installer-timezone-page installer-timezone-page
installer-hostname-page installer-hostname-page
installer-user-page installer-user-page
installer-services-page
installer-welcome-page)) installer-welcome-page))
@ -74,5 +75,7 @@ (define-record-type* <installer>
(hostname-page installer-hostname-page) (hostname-page installer-hostname-page)
;; procedure void -> void ;; procedure void -> void
(user-page installer-user-page) (user-page installer-user-page)
;; procedure void -> void
(services-page installer-services-page)
;; procedure (logo) -> void ;; procedure (logo) -> void
(welcome-page installer-welcome-page)) (welcome-page installer-welcome-page))

View file

@ -0,0 +1,59 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
;;;
;;; 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)
#:export (<desktop-environment>
desktop-environment
make-desktop-environment
desktop-environment-name
desktop-environment-snippet
%desktop-environments
desktop-environments->configuration))
(define-record-type* <desktop-environment>
desktop-environment make-desktop-environment
desktop-environment?
(name desktop-environment-name) ;string
(snippet desktop-environment-snippet)) ;symbol
;; This is the list of desktop environments supported as services.
(define %desktop-environments
(list
(desktop-environment
(name "GNOME")
(snippet '(gnome-desktop-service)))
(desktop-environment
(name "Xfce")
(snippet '(xfce-desktop-service)))
(desktop-environment
(name "MATE")
(snippet '(mate-desktop-service)))
(desktop-environment
(name "Enlightenment")
(snippet '(service enlightenment-desktop-service-type)))))
(define (desktop-environments->configuration desktop-environments)
"Return the configuration field for DESKTOP-ENVIRONMENTS."
(let ((snippets
(map desktop-environment-snippet desktop-environments)))
`(,@(if (null? snippets)
'()
`((services (cons* ,@snippets
%desktop-services)))))))

View file

@ -573,6 +573,7 @@ GNU_SYSTEM_MODULES += \
%D%/installer/keymap.scm \ %D%/installer/keymap.scm \
%D%/installer/locale.scm \ %D%/installer/locale.scm \
%D%/installer/newt.scm \ %D%/installer/newt.scm \
%D%/installer/services.scm \
%D%/installer/steps.scm \ %D%/installer/steps.scm \
%D%/installer/timezone.scm \ %D%/installer/timezone.scm \
%D%/installer/utils.scm \ %D%/installer/utils.scm \
@ -585,6 +586,7 @@ GNU_SYSTEM_MODULES += \
%D%/installer/newt/menu.scm \ %D%/installer/newt/menu.scm \
%D%/installer/newt/network.scm \ %D%/installer/newt/network.scm \
%D%/installer/newt/page.scm \ %D%/installer/newt/page.scm \
%D%/installer/newt/services.scm \
%D%/installer/newt/timezone.scm \ %D%/installer/newt/timezone.scm \
%D%/installer/newt/utils.scm \ %D%/installer/newt/utils.scm \
%D%/installer/newt/welcome.scm \ %D%/installer/newt/welcome.scm \

View file

@ -21,11 +21,13 @@ gnu/installer/newt/locale.scm
gnu/installer/newt/menu.scm gnu/installer/newt/menu.scm
gnu/installer/newt/network.scm gnu/installer/newt/network.scm
gnu/installer/newt/page.scm gnu/installer/newt/page.scm
gnu/installer/newt/services.scm
gnu/installer/newt/timezone.scm gnu/installer/newt/timezone.scm
gnu/installer/newt/user.scm gnu/installer/newt/user.scm
gnu/installer/newt/utils.scm gnu/installer/newt/utils.scm
gnu/installer/newt/welcome.scm gnu/installer/newt/welcome.scm
gnu/installer/newt/wifi.scm gnu/installer/newt/wifi.scm
gnu/installer/services.scm
gnu/installer/steps.scm gnu/installer/steps.scm
gnu/installer/timezone.scm gnu/installer/timezone.scm
gnu/installer/utils.scm gnu/installer/utils.scm