Commit | Line | Data |
---|---|---|
b51bde71 MO |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com> | |
7d1030a6 | 3 | ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> |
b51bde71 MO |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
8 | ;;; under the terms of the GNU General Public License as published by | |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | (define-module (gnu installer newt services) | |
21 | #:use-module (gnu installer services) | |
22 | #:use-module (gnu installer steps) | |
23 | #:use-module (gnu installer newt page) | |
24 | #:use-module (gnu installer newt utils) | |
25 | #:use-module (guix i18n) | |
26 | #:use-module (srfi srfi-34) | |
27 | #:use-module (srfi srfi-35) | |
28 | #:use-module (newt) | |
29 | #:export (run-services-page)) | |
30 | ||
31 | (define (run-desktop-environments-cbt-page) | |
32 | "Run a page allowing the user to choose between various desktop | |
33 | environments." | |
1d9fcdac LC |
34 | (let ((items (filter desktop-system-service? %system-services))) |
35 | (run-checkbox-tree-page | |
36 | #:info-text (G_ "Please select the desktop(s) environment(s) you wish to \ | |
75988317 | 37 | install. If you select multiple desktops environments, you will be able to \ |
e8aa4e95 | 38 | choose the one to use on the log-in screen.") |
1d9fcdac LC |
39 | #:title (G_ "Desktop environment") |
40 | #:items items | |
41 | #:selection (map system-service-recommended? items) | |
42 | #:item->text system-service-name ;no i18n for DE names | |
43 | #:checkbox-tree-height 8 | |
44 | #:exit-button-callback-procedure | |
45 | (lambda () | |
46 | (raise | |
47 | (condition | |
48 | (&installer-step-abort))))))) | |
b51bde71 | 49 | |
7cd38788 LC |
50 | (define (run-networking-cbt-page) |
51 | "Run a page allowing the user to select networking services." | |
1d9fcdac LC |
52 | (let ((items (filter (lambda (service) |
53 | (eq? 'networking (system-service-type service))) | |
54 | %system-services))) | |
55 | (run-checkbox-tree-page | |
56 | #:info-text (G_ "You can now select networking services to run on your \ | |
7d1030a6 | 57 | system.") |
1d9fcdac LC |
58 | #:title (G_ "Network service") |
59 | #:items items | |
60 | #:selection (map system-service-recommended? items) | |
61 | #:item->text (compose G_ system-service-name) | |
62 | #:checkbox-tree-height 5 | |
63 | #:exit-button-callback-procedure | |
64 | (lambda () | |
65 | (raise | |
66 | (condition | |
67 | (&installer-step-abort))))))) | |
7d1030a6 | 68 | |
7cd38788 LC |
69 | (define (run-network-management-page) |
70 | "Run a page to select among several network management methods." | |
71 | (let ((title (G_ "Network management"))) | |
72 | (run-listbox-selection-page | |
73 | #:title title | |
74 | #:info-text (G_ "Choose the method to manage network connections. | |
75 | ||
76 | We recommend NetworkManager or Connman for a WiFi-capable laptop; the DHCP \ | |
77 | client may be enough for a server.") | |
78 | #:info-textbox-width 70 | |
79 | #:listbox-items (filter (lambda (service) | |
80 | (eq? 'network-management | |
81 | (system-service-type service))) | |
82 | %system-services) | |
83 | #:listbox-item->text (compose G_ system-service-name) | |
84 | #:sort-listbox-items? #f | |
85 | #:button-text (G_ "Exit") | |
86 | #:button-callback-procedure | |
87 | (lambda _ | |
88 | (raise | |
89 | (condition | |
90 | (&installer-step-abort))))))) | |
91 | ||
b51bde71 | 92 | (define (run-services-page) |
2e55f37c LC |
93 | (let ((desktop (run-desktop-environments-cbt-page))) |
94 | ;; When the user did not select any desktop services, and thus didn't get | |
95 | ;; '%desktop-services', offer network management services. | |
96 | (append desktop | |
7cd38788 LC |
97 | (run-networking-cbt-page) |
98 | (if (null? desktop) | |
99 | (list (run-network-management-page)) | |
100 | '())))) |