services.scm 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
  3. ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  5. ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
  6. ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (gnu installer newt services)
  23. #:use-module (gnu installer services)
  24. #:use-module (gnu installer steps)
  25. #:use-module (gnu installer newt page)
  26. #:use-module (gnu installer newt utils)
  27. #:use-module (guix i18n)
  28. #:use-module (srfi srfi-34)
  29. #:use-module (srfi srfi-35)
  30. #:use-module (newt)
  31. #:export (run-services-page))
  32. (define (run-desktop-environments-cbt-page)
  33. "Run a page allowing the user to choose between various desktop
  34. environments."
  35. (let ((items (filter desktop-system-service? %system-services)))
  36. (run-checkbox-tree-page
  37. #:info-text (G_ "Please select the desktop environment(s) you wish to \
  38. install. If you select multiple desktop environments here, you will be able \
  39. to choose from them later when you log in.")
  40. #:title (G_ "Desktop environment")
  41. #:items items
  42. #:selection (map system-service-recommended? items)
  43. #:item->text system-service-name ;no i18n for DE names
  44. #:checkbox-tree-height 9
  45. #:exit-button-callback-procedure
  46. (lambda ()
  47. (abort-to-prompt 'installer-step 'abort)))))
  48. (define (run-networking-cbt-page)
  49. "Run a page allowing the user to select networking services."
  50. (let ((items (filter (lambda (service)
  51. (eq? 'networking (system-service-type service)))
  52. %system-services)))
  53. (run-checkbox-tree-page
  54. #:info-text (G_ "You can now select networking services to run on your \
  55. system.")
  56. #:title (G_ "Network service")
  57. #:items items
  58. #:selection (map system-service-recommended? items)
  59. #:item->text (compose G_ system-service-name)
  60. #:checkbox-tree-height 5
  61. #:exit-button-callback-procedure
  62. (lambda ()
  63. (abort-to-prompt 'installer-step 'abort)))))
  64. (define (run-printing-services-cbt-page)
  65. "Run a page allowing the user to select document services such as CUPS."
  66. (let ((items (filter (lambda (service)
  67. (eq? 'document
  68. (system-service-type service)))
  69. %system-services)))
  70. (run-checkbox-tree-page
  71. #:info-text (G_ "You can now select the CUPS printing service to run on your \
  72. system.")
  73. #:title (G_ "Printing and document services")
  74. #:items items
  75. #:selection (map system-service-recommended? items)
  76. #:item->text (compose G_ system-service-name)
  77. #:checkbox-tree-height 9
  78. #:exit-button-callback-procedure
  79. (lambda ()
  80. (abort-to-prompt 'installer-step 'abort)))))
  81. (define (run-console-services-cbt-page)
  82. "Run a page to select various system adminstration services for non-graphical
  83. systems."
  84. (let ((items (filter (lambda (service)
  85. (eq? 'administration
  86. (system-service-type service)))
  87. %system-services)))
  88. (run-checkbox-tree-page
  89. #:title (G_ "Console services")
  90. #:info-text (G_ "Select miscellaneous services to run on your \
  91. non-graphical system.")
  92. #:items items
  93. #:selection (map system-service-recommended? items)
  94. #:item->text (compose G_ system-service-name)
  95. #:checkbox-tree-height 5
  96. #:exit-button-callback-procedure
  97. (lambda _
  98. (abort-to-prompt 'installer-step 'abort)))))
  99. (define (run-network-management-page)
  100. "Run a page to select among several network management methods."
  101. (let ((title (G_ "Network management")))
  102. (run-listbox-selection-page
  103. #:title title
  104. #:info-text (G_ "Choose the method to manage network connections.
  105. We recommend NetworkManager or Connman for a WiFi-capable laptop; the DHCP \
  106. client may be enough for a server.")
  107. #:info-textbox-width 70
  108. #:listbox-height 7
  109. #:listbox-items (filter (lambda (service)
  110. (eq? 'network-management
  111. (system-service-type service)))
  112. %system-services)
  113. #:listbox-item->text (compose G_ system-service-name)
  114. #:sort-listbox-items? #f
  115. #:button-text (G_ "Exit")
  116. #:button-callback-procedure
  117. (lambda _
  118. (abort-to-prompt 'installer-step 'abort)))))
  119. (define (run-services-page)
  120. (let ((desktop (run-desktop-environments-cbt-page)))
  121. ;; When the user did not select any desktop services, and thus didn't get
  122. ;; '%desktop-services', offer network management services.
  123. (append desktop
  124. (run-networking-cbt-page)
  125. (if (null? desktop)
  126. (cons (run-network-management-page)
  127. (run-console-services-cbt-page))
  128. '())
  129. (run-printing-services-cbt-page))))