services.scm 4.0 KB

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