services.scm 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Mathieu Othacehe <m.othacehe@gmail.com>
  3. ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
  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. (define-module (gnu installer newt services)
  20. #:use-module (gnu installer services)
  21. #:use-module (gnu installer steps)
  22. #:use-module (gnu installer newt page)
  23. #:use-module (gnu installer newt utils)
  24. #:use-module (guix i18n)
  25. #:use-module (srfi srfi-34)
  26. #:use-module (srfi srfi-35)
  27. #:use-module (newt)
  28. #:export (run-services-page))
  29. (define (run-desktop-environments-cbt-page)
  30. "Run a page allowing the user to choose between various desktop
  31. environments."
  32. (let ((items (filter desktop-system-service? %system-services)))
  33. (run-checkbox-tree-page
  34. #:info-text (G_ "Please select the desktop(s) environment(s) you wish to \
  35. install. If you select multiple desktops environments, you will be able to \
  36. choose the one to use on the log-in screen.")
  37. #:title (G_ "Desktop environment")
  38. #:items items
  39. #:selection (map system-service-recommended? items)
  40. #:item->text system-service-name ;no i18n for DE names
  41. #:checkbox-tree-height 8
  42. #:exit-button-callback-procedure
  43. (lambda ()
  44. (raise
  45. (condition
  46. (&installer-step-abort)))))))
  47. (define (run-networking-cbt-page)
  48. "Run a page allowing the user to select networking services."
  49. (let ((items (filter (lambda (service)
  50. (eq? 'networking (system-service-type service)))
  51. %system-services)))
  52. (run-checkbox-tree-page
  53. #:info-text (G_ "You can now select networking services to run on your \
  54. system.")
  55. #:title (G_ "Network service")
  56. #:items items
  57. #:selection (map system-service-recommended? items)
  58. #:item->text (compose G_ system-service-name)
  59. #:checkbox-tree-height 5
  60. #:exit-button-callback-procedure
  61. (lambda ()
  62. (raise
  63. (condition
  64. (&installer-step-abort)))))))
  65. (define (run-network-management-page)
  66. "Run a page to select among several network management methods."
  67. (let ((title (G_ "Network management")))
  68. (run-listbox-selection-page
  69. #:title title
  70. #:info-text (G_ "Choose the method to manage network connections.
  71. We recommend NetworkManager or Connman for a WiFi-capable laptop; the DHCP \
  72. client may be enough for a server.")
  73. #:info-textbox-width 70
  74. #:listbox-items (filter (lambda (service)
  75. (eq? 'network-management
  76. (system-service-type service)))
  77. %system-services)
  78. #:listbox-item->text (compose G_ system-service-name)
  79. #:sort-listbox-items? #f
  80. #:button-text (G_ "Exit")
  81. #:button-callback-procedure
  82. (lambda _
  83. (raise
  84. (condition
  85. (&installer-step-abort)))))))
  86. (define (run-services-page)
  87. (let ((desktop (run-desktop-environments-cbt-page)))
  88. ;; When the user did not select any desktop services, and thus didn't get
  89. ;; '%desktop-services', offer network management services.
  90. (append desktop
  91. (run-networking-cbt-page)
  92. (if (null? desktop)
  93. (list (run-network-management-page))
  94. '()))))