parameters.scm 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (gnu installer newt parameters)
  19. #:use-module (gnu installer proxy)
  20. #:use-module (gnu installer steps)
  21. #:use-module (gnu installer newt page)
  22. #:use-module (guix build syscalls)
  23. #:use-module (guix i18n)
  24. #:use-module (ice-9 match)
  25. #:use-module (newt)
  26. #:export (run-parameters-page))
  27. (define (run-proxy-page)
  28. (define proxy
  29. (run-input-page (G_ "Please enter the HTTP proxy URL. If you enter an \
  30. empty string, proxy usage will be disabled.")
  31. (G_ "HTTP proxy configuration")
  32. #:allow-empty-input? #t))
  33. (if (string=? proxy "")
  34. (clear-http-proxy)
  35. (set-http-proxy proxy)))
  36. (define (run-parameters-page keyboard-layout-selection)
  37. "Run a parameters page allowing to change the keyboard layout"
  38. (let* ((items
  39. (list
  40. (cons (G_ "Change keyboard layout") keyboard-layout-selection)
  41. (cons (G_ "Configure HTTP proxy") run-proxy-page)
  42. (cons (G_ "Reboot") reboot)))
  43. (result
  44. (run-listbox-selection-page
  45. #:info-text (G_ "Please choose one of the following parameters or \
  46. press ‘Back’ to go back to the installation process.")
  47. #:title (G_ "Installation parameters")
  48. #:listbox-items items
  49. #:listbox-item->text car
  50. #:sort-listbox-items? #f
  51. #:listbox-height 6
  52. #:button-text (G_ "Back"))))
  53. (match result
  54. ((_ . proc)
  55. (proc))
  56. (_ #f))))