summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-06-30 17:42:35 +0200
committerLudovic Courtès <ludo@gnu.org>2015-07-01 23:29:49 +0200
commitce367ef3a9031e3211d616630ff01c8a6128db96 (patch)
treebdb7af923ad304395a701faf5b38adc49f8dd755
parent6b6298ae39bfe185ce1ab18bb3d641ddfad17c8f (diff)
environment: Add --system.
* guix/scripts/environment.scm (show-help, %options): Add -s/--system. (%default-options): Add 'system' pair. (guix-environment): Pass 'system' value from OPTS to 'lower-inputs'. * doc/guix.texi (Invoking guix environment): Document it.
-rw-r--r--doc/guix.texi4
-rw-r--r--guix/scripts/environment.scm9
2 files changed, 12 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index ccccf7b347a..71167dfdc74 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4219,6 +4219,10 @@ only contain package inputs.
4219@item --search-paths 4219@item --search-paths
4220Display the environment variable definitions that make up the 4220Display the environment variable definitions that make up the
4221environment. 4221environment.
4222
4223@item --system=@var{system}
4224@itemx -s @var{system}
4225Attempt to build for @var{system}---e.g., @code{i686-linux}.
4222@end table 4226@end table
4223 4227
4224It also supports all of the common build options that @command{guix 4228It also supports all of the common build options that @command{guix
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index e2ac086f6d1..7a7664a1eac 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -115,6 +115,8 @@ shell command in that environment.\n"))
115 --pure unset existing environment variables")) 115 --pure unset existing environment variables"))
116 (display (_ " 116 (display (_ "
117 --search-paths display needed environment variable definitions")) 117 --search-paths display needed environment variable definitions"))
118 (display (_ "
119 -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
118 (newline) 120 (newline)
119 (show-build-options-help) 121 (show-build-options-help)
120 (newline) 122 (newline)
@@ -128,6 +130,7 @@ shell command in that environment.\n"))
128(define %default-options 130(define %default-options
129 ;; Default to opening a new shell. 131 ;; Default to opening a new shell.
130 `((exec . ,(or (getenv "SHELL") "/bin/sh")) 132 `((exec . ,(or (getenv "SHELL") "/bin/sh"))
133 (system . ,(%current-system))
131 (substitutes? . #t) 134 (substitutes? . #t)
132 (max-silent-time . 3600) 135 (max-silent-time . 3600)
133 (verbosity . 0))) 136 (verbosity . 0)))
@@ -162,6 +165,10 @@ shell command in that environment.\n"))
162 (option '(#\n "dry-run") #f #f 165 (option '(#\n "dry-run") #f #f
163 (lambda (opt name arg result) 166 (lambda (opt name arg result)
164 (alist-cons 'dry-run? #t result))) 167 (alist-cons 'dry-run? #t result)))
168 (option '(#\s "system") #t #f
169 (lambda (opt name arg result)
170 (alist-cons 'system arg
171 (alist-delete 'system result eq?))))
165 %standard-build-options)) 172 %standard-build-options))
166 173
167(define (pick-all alist key) 174(define (pick-all alist key)
@@ -243,7 +250,7 @@ OUTPUT) tuples, using the build options in OPTS."
243 ((label item output) 250 ((label item output)
244 (list item output))) 251 (list item output)))
245 inputs) 252 inputs)
246 #:system (%current-system)))) 253 #:system (assoc-ref opts 'system))))
247 (mbegin %store-monad 254 (mbegin %store-monad
248 ;; First build INPUTS. This is necessary even for 255 ;; First build INPUTS. This is necessary even for
249 ;; --search-paths. 256 ;; --search-paths.