gnu: java-modello-core: Don't use unstable tarball.
[jackhill/guix/guix.git] / gnu / installer / newt.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
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)
20 #:use-module (gnu installer record)
21 #:use-module (gnu installer utils)
22 #:use-module (gnu installer newt ethernet)
23 #:use-module (gnu installer newt final)
24 #:use-module (gnu installer newt hostname)
25 #:use-module (gnu installer newt keymap)
26 #:use-module (gnu installer newt locale)
27 #:use-module (gnu installer newt menu)
28 #:use-module (gnu installer newt network)
29 #:use-module (gnu installer newt page)
30 #:use-module (gnu installer newt partition)
31 #:use-module (gnu installer newt services)
32 #:use-module (gnu installer newt timezone)
33 #:use-module (gnu installer newt user)
34 #:use-module (gnu installer newt utils)
35 #:use-module (gnu installer newt welcome)
36 #:use-module (gnu installer newt wifi)
37 #:use-module (guix config)
38 #:use-module (guix discovery)
39 #:use-module (guix i18n)
40 #:use-module (srfi srfi-26)
41 #:use-module (newt)
42 #:export (newt-installer))
43
44 (define (init)
45 (newt-init)
46 (clear-screen)
47 (set-screen-size!))
48
49 (define (exit)
50 (newt-finish)
51 (clear-screen))
52
53 (define (exit-error file key args)
54 (newt-set-color COLORSET-ROOT "white" "red")
55 (let ((width (nearest-exact-integer
56 (* (screen-columns) 0.8)))
57 (height (nearest-exact-integer
58 (* (screen-rows) 0.7))))
59 (run-file-textbox-page
60 #:info-text (format #f (G_ "The installer has encountered an unexpected \
61 problem. The backtrace is displayed below. Please report it by email to \
62 <~a>.") %guix-bug-report-address)
63 #:title (G_ "Unexpected problem")
64 #:file file
65 #:exit-button? #f
66 #:info-textbox-width width
67 #:file-textbox-width width
68 #:file-textbox-height height))
69 (newt-set-color COLORSET-ROOT "white" "blue")
70 (newt-finish)
71 (clear-screen))
72
73 (define (final-page result prev-steps)
74 (run-final-page result prev-steps))
75
76 (define* (locale-page #:key
77 supported-locales
78 iso639-languages
79 iso3166-territories)
80 (run-locale-page
81 #:supported-locales supported-locales
82 #:iso639-languages iso639-languages
83 #:iso3166-territories iso3166-territories))
84
85 (define (timezone-page zonetab)
86 (run-timezone-page zonetab))
87
88 (define (welcome-page logo)
89 (run-welcome-page logo))
90
91 (define (menu-page steps)
92 (run-menu-page steps))
93
94 (define* (keymap-page layouts)
95 (run-keymap-page layouts))
96
97 (define (network-page)
98 (run-network-page))
99
100 (define (hostname-page)
101 (run-hostname-page))
102
103 (define (user-page)
104 (run-user-page))
105
106 (define (partition-page)
107 (run-partioning-page))
108
109 (define (services-page)
110 (run-services-page))
111
112 (define newt-installer
113 (installer
114 (name 'newt)
115 (init init)
116 (exit exit)
117 (exit-error exit-error)
118 (final-page final-page)
119 (keymap-page keymap-page)
120 (locale-page locale-page)
121 (menu-page menu-page)
122 (network-page network-page)
123 (timezone-page timezone-page)
124 (hostname-page hostname-page)
125 (user-page user-page)
126 (partition-page partition-page)
127 (services-page services-page)
128 (welcome-page welcome-page)))