services.scm 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  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. (define (run-desktop-environments-cbt-page)
  31. "Run a page allowing the user to choose between various desktop
  32. environments."
  33. (let ((items (filter desktop-system-service? %system-services)))
  34. (run-checkbox-tree-page
  35. #:info-text (G_ "Please select the desktop(s) environment(s) you wish to \
  36. install. If you select multiple desktops environments, you will be able to \
  37. choose the one to use on the log-in screen.")
  38. #:title (G_ "Desktop environment")
  39. #:items items
  40. #:selection (map system-service-recommended? items)
  41. #:item->text system-service-name ;no i18n for DE names
  42. #:checkbox-tree-height 9
  43. #:exit-button-callback-procedure
  44. (lambda ()
  45. (raise
  46. (condition
  47. (&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. (raise
  64. (condition
  65. (&installer-step-abort)))))))
  66. (define (run-network-management-page)
  67. "Run a page to select among several network management methods."
  68. (let ((title (G_ "Network management")))
  69. (run-listbox-selection-page
  70. #:title title
  71. #:info-text (G_ "Choose the method to manage network connections.
  72. We recommend NetworkManager or Connman for a WiFi-capable laptop; the DHCP \
  73. client may be enough for a server.")
  74. #:info-textbox-width 70
  75. #:listbox-height 7
  76. #:listbox-items (filter (lambda (service)
  77. (eq? 'network-management
  78. (system-service-type service)))
  79. %system-services)
  80. #:listbox-item->text (compose G_ system-service-name)
  81. #:sort-listbox-items? #f
  82. #:button-text (G_ "Exit")
  83. #:button-callback-procedure
  84. (lambda _
  85. (raise
  86. (condition
  87. (&installer-step-abort)))))))
  88. (define (run-services-page)
  89. (let ((desktop (run-desktop-environments-cbt-page)))
  90. ;; When the user did not select any desktop services, and thus didn't get
  91. ;; '%desktop-services', offer network management services.
  92. (append desktop
  93. (run-networking-cbt-page)
  94. (if (null? desktop)
  95. (list (run-network-management-page))
  96. '()))))