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