Commit | Line | Data |
---|---|---|
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 MO |
48 | (set-screen-size!) |
49 | (push-help-line | |
07a53bd5 | 50 | (format #f (G_ "Press <F1> for installation parameters.")))) |
d0f3a672 | 51 | |
a49d633c | 52 | (define (exit) |
df3664f1 MO |
53 | (newt-finish) |
54 | (clear-screen)) | |
d0f3a672 | 55 | |
133c401f MO |
56 | (define (exit-error file key args) |
57 | (newt-set-color COLORSET-ROOT "white" "red") | |
58 | (let ((width (nearest-exact-integer | |
59 | (* (screen-columns) 0.8))) | |
60 | (height (nearest-exact-integer | |
61 | (* (screen-rows) 0.7)))) | |
62 | (run-file-textbox-page | |
63 | #:info-text (format #f (G_ "The installer has encountered an unexpected \ | |
64 | problem. The backtrace is displayed below. Please report it by email to \ | |
65 | <~a>.") %guix-bug-report-address) | |
66 | #:title (G_ "Unexpected problem") | |
67 | #:file file | |
68 | #:exit-button? #f | |
69 | #:info-textbox-width width | |
70 | #:file-textbox-width width | |
71 | #:file-textbox-height height)) | |
72 | (newt-set-color COLORSET-ROOT "white" "blue") | |
df3664f1 MO |
73 | (newt-finish) |
74 | (clear-screen)) | |
d0f3a672 | 75 | |
dc5f3275 MO |
76 | (define (final-page result prev-steps) |
77 | (run-final-page result prev-steps)) | |
78 | ||
a49d633c MO |
79 | (define* (locale-page #:key |
80 | supported-locales | |
81 | iso639-languages | |
82 | iso3166-territories) | |
83 | (run-locale-page | |
84 | #:supported-locales supported-locales | |
85 | #:iso639-languages iso639-languages | |
86 | #:iso3166-territories iso3166-territories)) | |
d0f3a672 | 87 | |
a49d633c MO |
88 | (define (timezone-page zonetab) |
89 | (run-timezone-page zonetab)) | |
d0f3a672 | 90 | |
a49d633c MO |
91 | (define (welcome-page logo) |
92 | (run-welcome-page logo)) | |
d0f3a672 | 93 | |
a49d633c MO |
94 | (define (menu-page steps) |
95 | (run-menu-page steps)) | |
d0f3a672 | 96 | |
786c9c39 MO |
97 | (define* (keymap-page layouts context) |
98 | (run-keymap-page layouts #:context context)) | |
d0f3a672 | 99 | |
a49d633c MO |
100 | (define (network-page) |
101 | (run-network-page)) | |
d0f3a672 | 102 | |
a49d633c MO |
103 | (define (hostname-page) |
104 | (run-hostname-page)) | |
d0f3a672 | 105 | |
a49d633c MO |
106 | (define (user-page) |
107 | (run-user-page)) | |
d0f3a672 | 108 | |
69a934f2 | 109 | (define (partition-page) |
5e17ae7f | 110 | (run-partitioning-page)) |
69a934f2 | 111 | |
b51bde71 MO |
112 | (define (services-page) |
113 | (run-services-page)) | |
114 | ||
07a53bd5 | 115 | (define (parameters-menu menu-proc) |
786c9c39 MO |
116 | (newt-set-help-callback menu-proc)) |
117 | ||
07a53bd5 MO |
118 | (define (parameters-page keyboard-layout-selection) |
119 | (run-parameters-page keyboard-layout-selection)) | |
786c9c39 | 120 | |
d0f3a672 MO |
121 | (define newt-installer |
122 | (installer | |
123 | (name 'newt) | |
d0f3a672 MO |
124 | (init init) |
125 | (exit exit) | |
126 | (exit-error exit-error) | |
dc5f3275 | 127 | (final-page final-page) |
d0f3a672 MO |
128 | (keymap-page keymap-page) |
129 | (locale-page locale-page) | |
130 | (menu-page menu-page) | |
131 | (network-page network-page) | |
132 | (timezone-page timezone-page) | |
133 | (hostname-page hostname-page) | |
134 | (user-page user-page) | |
69a934f2 | 135 | (partition-page partition-page) |
b51bde71 | 136 | (services-page services-page) |
786c9c39 | 137 | (welcome-page welcome-page) |
07a53bd5 MO |
138 | (parameters-menu parameters-menu) |
139 | (parameters-page parameters-page))) |