install.scm 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
  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 (guix scripts install)
  19. #:use-module (guix ui)
  20. #:use-module (guix scripts package)
  21. #:use-module (guix scripts build)
  22. #:use-module (guix transformations)
  23. #:use-module (guix scripts)
  24. #:use-module (srfi srfi-1)
  25. #:use-module (srfi srfi-26)
  26. #:use-module (srfi srfi-37)
  27. #:export (guix-install))
  28. (define (show-help)
  29. (display (G_ "Usage: guix install [OPTION] PACKAGES...
  30. Install the given PACKAGES.
  31. This is an alias for 'guix package -i'.\n"))
  32. (display (G_ "
  33. -p, --profile=PROFILE use PROFILE instead of the user's default profile"))
  34. ;; '--bootstrap' not shown here.
  35. (display (G_ "
  36. -v, --verbosity=LEVEL use the given verbosity LEVEL"))
  37. (newline)
  38. (show-build-options-help)
  39. (newline)
  40. (show-transformation-options-help)
  41. (newline)
  42. (display (G_ "
  43. -h, --help display this help and exit"))
  44. (display (G_ "
  45. -V, --version display version information and exit"))
  46. (newline)
  47. (show-bug-report-information))
  48. (define %options
  49. ;; Specification of the command-line options.
  50. (cons* (option '(#\h "help") #f #f
  51. (lambda args
  52. (show-help)
  53. (exit 0)))
  54. (option '(#\V "version") #f #f
  55. (lambda args
  56. (show-version-and-exit "guix install")))
  57. ;; Preserve some of the 'guix package' options.
  58. (append (filter (lambda (option)
  59. (any (cut member <> (option-names option))
  60. '("profile" "dry-run" "verbosity" "bootstrap")))
  61. %package-options)
  62. %transformation-options
  63. %standard-build-options)))
  64. (define-command (guix-install . args)
  65. (synopsis "install packages")
  66. (define (handle-argument arg result arg-handler)
  67. ;; Treat all non-option arguments as package specs.
  68. (values (alist-cons 'install arg result)
  69. arg-handler))
  70. (define opts
  71. (parse-command-line args %options
  72. (list %package-default-options #f)
  73. #:argument-handler handle-argument))
  74. (guix-package* opts))