From b51bde71a9385f4e81fbea258bfb9e8ff48be119 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Wed, 5 Dec 2018 14:41:48 +0900 Subject: 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. --- gnu/installer.scm | 12 ++++++--- gnu/installer/newt.scm | 5 ++++ gnu/installer/newt/services.scm | 48 +++++++++++++++++++++++++++++++++ gnu/installer/record.scm | 3 +++ gnu/installer/services.scm | 59 +++++++++++++++++++++++++++++++++++++++++ gnu/local.mk | 2 ++ 6 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 gnu/installer/newt/services.scm create mode 100644 gnu/installer/services.scm (limited to 'gnu') diff --git a/gnu/installer.scm b/gnu/installer.scm index 4a587eb35b..1b9aeaa217 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -229,16 +229,22 @@ selected keymap." ((installer-user-page current-installer)))) (configuration-formatter users->configuration)) + ;; Ask the user to choose one or many desktop environment(s). + (installer-step + (id 'services) + (description (G_ "Services")) (compute (lambda _ - ((installer-user-page current-installer))))) + ((installer-services-page current-installer)))) + (configuration-formatter + desktop-environments->configuration)) - (installer-step + (installer-step (id 'final) (description (G_ "Configuration file")) (compute (lambda (result prev-steps) ((installer-final-page current-installer) - result prev-steps))))))) + result prev-steps)))))))) (define (installer-program) "Return a file-like object that runs the given INSTALLER." diff --git a/gnu/installer/newt.scm b/gnu/installer/newt.scm index 1f51b111a8..3192e55b86 100644 --- a/gnu/installer/newt.scm +++ b/gnu/installer/newt.scm @@ -25,6 +25,7 @@ #:use-module (gnu installer newt locale) #:use-module (gnu installer newt menu) #:use-module (gnu installer newt network) + #:use-module (gnu installer newt services) #:use-module (gnu installer newt timezone) #:use-module (gnu installer newt user) #:use-module (gnu installer newt utils) @@ -80,6 +81,9 @@ (define (user-page) (run-user-page)) +(define (services-page) + (run-services-page)) + (define newt-installer (installer (name 'newt) @@ -94,4 +98,5 @@ (timezone-page timezone-page) (hostname-page hostname-page) (user-page user-page) + (services-page services-page) (welcome-page welcome-page))) diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.scm new file mode 100644 index 0000000000..80fac43dc8 --- /dev/null +++ b/gnu/installer/newt/services.scm @@ -0,0 +1,48 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2018 Mathieu Othacehe +;;; +;;; 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 . + +(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)) diff --git a/gnu/installer/record.scm b/gnu/installer/record.scm index ba7625e65a..3ef0a101d3 100644 --- a/gnu/installer/record.scm +++ b/gnu/installer/record.scm @@ -35,6 +35,7 @@ installer-timezone-page installer-hostname-page installer-user-page + installer-services-page installer-welcome-page)) @@ -74,5 +75,7 @@ (hostname-page installer-hostname-page) ;; procedure void -> void (user-page installer-user-page) + ;; procedure void -> void + (services-page installer-services-page) ;; procedure (logo) -> void (welcome-page installer-welcome-page)) diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm new file mode 100644 index 0000000000..ed44b87682 --- /dev/null +++ b/gnu/installer/services.scm @@ -0,0 +1,59 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2018 Mathieu Othacehe +;;; +;;; 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 . + +(define-module (gnu installer services) + #:use-module (guix records) + #:export ( + desktop-environment + make-desktop-environment + desktop-environment-name + desktop-environment-snippet + + %desktop-environments + desktop-environments->configuration)) + +(define-record-type* + 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))))))) diff --git a/gnu/local.mk b/gnu/local.mk index d4acb8d2ec..15a43406a4 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -573,6 +573,7 @@ GNU_SYSTEM_MODULES += \ %D%/installer/keymap.scm \ %D%/installer/locale.scm \ %D%/installer/newt.scm \ + %D%/installer/services.scm \ %D%/installer/steps.scm \ %D%/installer/timezone.scm \ %D%/installer/utils.scm \ @@ -585,6 +586,7 @@ GNU_SYSTEM_MODULES += \ %D%/installer/newt/menu.scm \ %D%/installer/newt/network.scm \ %D%/installer/newt/page.scm \ + %D%/installer/newt/services.scm \ %D%/installer/newt/timezone.scm \ %D%/installer/newt/utils.scm \ %D%/installer/newt/welcome.scm \ -- cgit v1.2.3