gnu: rust-strum-macros-0.18: Do not skip build.
[jackhill/guix/guix.git] / gnu / installer / newt.scm
CommitLineData
d0f3a672 1;;; GNU Guix --- Functional package management for GNU
786c9c39 2;;; Copyright © 2018, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
d0f3a672
MO
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu installer newt)
a49d633c 20 #:use-module (gnu installer record)
133c401f 21 #:use-module (gnu installer utils)
a49d633c 22 #:use-module (gnu installer newt ethernet)
dc5f3275 23 #:use-module (gnu installer newt final)
07a53bd5 24 #:use-module (gnu installer newt parameters)
a49d633c
MO
25 #:use-module (gnu installer newt hostname)
26 #:use-module (gnu installer newt keymap)
27 #:use-module (gnu installer newt locale)
28 #:use-module (gnu installer newt menu)
29 #:use-module (gnu installer newt network)
133c401f 30 #:use-module (gnu installer newt page)
69a934f2 31 #:use-module (gnu installer newt partition)
b51bde71 32 #:use-module (gnu installer newt services)
a49d633c
MO
33 #:use-module (gnu installer newt timezone)
34 #:use-module (gnu installer newt user)
35 #:use-module (gnu installer newt utils)
36 #:use-module (gnu installer newt welcome)
37 #:use-module (gnu installer newt wifi)
133c401f 38 #:use-module (guix config)
d0f3a672 39 #:use-module (guix discovery)
a49d633c
MO
40 #:use-module (guix i18n)
41 #:use-module (srfi srfi-26)
42 #:use-module (newt)
d0f3a672
MO
43 #:export (newt-installer))
44
a49d633c
MO
45(define (init)
46 (newt-init)
47 (clear-screen)
786c9c39 48 (set-screen-size!)
8338d414 49 (syslog "Display is ~ax~a.~%" (screen-columns) (screen-rows))
786c9c39 50 (push-help-line
07a53bd5 51 (format #f (G_ "Press <F1> for installation parameters."))))
d0f3a672 52
a49d633c 53(define (exit)
df3664f1
MO
54 (newt-finish)
55 (clear-screen))
d0f3a672 56
133c401f
MO
57(define (exit-error file key args)
58 (newt-set-color COLORSET-ROOT "white" "red")
59 (let ((width (nearest-exact-integer
60 (* (screen-columns) 0.8)))
61 (height (nearest-exact-integer
62 (* (screen-rows) 0.7))))
63 (run-file-textbox-page
64 #:info-text (format #f (G_ "The installer has encountered an unexpected \
65problem. The backtrace is displayed below. Please report it by email to \
66<~a>.") %guix-bug-report-address)
67 #:title (G_ "Unexpected problem")
68 #:file file
69 #:exit-button? #f
70 #:info-textbox-width width
71 #:file-textbox-width width
72 #:file-textbox-height height))
73 (newt-set-color COLORSET-ROOT "white" "blue")
df3664f1
MO
74 (newt-finish)
75 (clear-screen))
d0f3a672 76
dc5f3275
MO
77(define (final-page result prev-steps)
78 (run-final-page result prev-steps))
79
a49d633c
MO
80(define* (locale-page #:key
81 supported-locales
82 iso639-languages
83 iso3166-territories)
84 (run-locale-page
85 #:supported-locales supported-locales
86 #:iso639-languages iso639-languages
87 #:iso3166-territories iso3166-territories))
d0f3a672 88
a49d633c
MO
89(define (timezone-page zonetab)
90 (run-timezone-page zonetab))
d0f3a672 91
a49d633c
MO
92(define (welcome-page logo)
93 (run-welcome-page logo))
d0f3a672 94
a49d633c
MO
95(define (menu-page steps)
96 (run-menu-page steps))
d0f3a672 97
786c9c39
MO
98(define* (keymap-page layouts context)
99 (run-keymap-page layouts #:context context))
d0f3a672 100
a49d633c
MO
101(define (network-page)
102 (run-network-page))
d0f3a672 103
a49d633c
MO
104(define (hostname-page)
105 (run-hostname-page))
d0f3a672 106
a49d633c
MO
107(define (user-page)
108 (run-user-page))
d0f3a672 109
69a934f2 110(define (partition-page)
5e17ae7f 111 (run-partitioning-page))
69a934f2 112
b51bde71
MO
113(define (services-page)
114 (run-services-page))
115
07a53bd5 116(define (parameters-menu menu-proc)
786c9c39
MO
117 (newt-set-help-callback menu-proc))
118
07a53bd5
MO
119(define (parameters-page keyboard-layout-selection)
120 (run-parameters-page keyboard-layout-selection))
786c9c39 121
d0f3a672
MO
122(define newt-installer
123 (installer
124 (name 'newt)
d0f3a672
MO
125 (init init)
126 (exit exit)
127 (exit-error exit-error)
dc5f3275 128 (final-page final-page)
d0f3a672
MO
129 (keymap-page keymap-page)
130 (locale-page locale-page)
131 (menu-page menu-page)
132 (network-page network-page)
133 (timezone-page timezone-page)
134 (hostname-page hostname-page)
135 (user-page user-page)
69a934f2 136 (partition-page partition-page)
b51bde71 137 (services-page services-page)
786c9c39 138 (welcome-page welcome-page)
07a53bd5
MO
139 (parameters-menu parameters-menu)
140 (parameters-page parameters-page)))