guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

24/67: installer: Add services page.


From: guix-commits
Subject: 24/67: installer: Add services page.
Date: Wed, 16 Jan 2019 19:00:39 -0500 (EST)

civodul pushed a commit to branch wip-newt-installer
in repository guix.

commit 75cf0a639682566b5c4450bd5e321bd056123b75
Author: Mathieu Othacehe <address@hidden>
Date:   Wed Dec 5 14:41:48 2018 +0900

    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 ++
 po/guix/POTFILES.in             |  2 ++
 7 files changed, 128 insertions(+), 3 deletions(-)

diff --git a/gnu/installer.scm b/gnu/installer.scm
index 4a587eb..1b9aeaa 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 1f51b11..3192e55 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 0000000..80fac43
--- /dev/null
+++ b/gnu/installer/newt/services.scm
@@ -0,0 +1,48 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Mathieu Othacehe <address@hidden>
+;;;
+;;; 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))
diff --git a/gnu/installer/record.scm b/gnu/installer/record.scm
index ba7625e..3ef0a10 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 0000000..ed44b87
--- /dev/null
+++ b/gnu/installer/services.scm
@@ -0,0 +1,59 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Mathieu Othacehe <address@hidden>
+;;;
+;;; 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)))))))
diff --git a/gnu/local.mk b/gnu/local.mk
index d4acb8d..15a4340 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               \
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in
index 1378b33..16d9c9e 100644
--- a/po/guix/POTFILES.in
+++ b/po/guix/POTFILES.in
@@ -21,11 +21,13 @@ gnu/installer/newt/locale.scm
 gnu/installer/newt/menu.scm
 gnu/installer/newt/network.scm
 gnu/installer/newt/page.scm
+gnu/installer/newt/services.scm
 gnu/installer/newt/timezone.scm
 gnu/installer/newt/user.scm
 gnu/installer/newt/utils.scm
 gnu/installer/newt/welcome.scm
 gnu/installer/newt/wifi.scm
+gnu/installer/services.scm
 gnu/installer/steps.scm
 gnu/installer/timezone.scm
 gnu/installer/utils.scm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]