civodul pushed a commit to branch wip-environment
in repository guix.
commit ddb605a092a83e5062531bb41bb46f55b2d6d9d7
Author: Ludovic Courtès <[email protected]>
Date: Tue Jun 30 17:42:35 2015 +0200
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.
---
doc/guix.texi | 4 ++++
guix/scripts/environment.scm | 9 ++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index ccccf7b..71167df 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4219,6 +4219,10 @@ only contain package inputs.
@item --search-paths
Display the environment variable definitions that make up the
environment.
+
+@item --system=@var{system}
+@itemx -s @var{system}
+Attempt to build for @var{system}---e.g., @code{i686-linux}.
@end table
It also supports all of the common build options that @command{guix
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index e2ac086..7a7664a 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -115,6 +115,8 @@ shell command in that environment.\n"))
--pure unset existing environment variables"))
(display (_ "
--search-paths display needed environment variable definitions"))
+ (display (_ "
+ -s, --system=SYSTEM attempt to build for SYSTEM--e.g., \"i686-linux\""))
(newline)
(show-build-options-help)
(newline)
@@ -128,6 +130,7 @@ shell command in that environment.\n"))
(define %default-options
;; Default to opening a new shell.
`((exec . ,(or (getenv "SHELL") "/bin/sh"))
+ (system . ,(%current-system))
(substitutes? . #t)
(max-silent-time . 3600)
(verbosity . 0)))
@@ -162,6 +165,10 @@ shell command in that environment.\n"))
(option '(#\n "dry-run") #f #f
(lambda (opt name arg result)
(alist-cons 'dry-run? #t result)))
+ (option '(#\s "system") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'system arg
+ (alist-delete 'system result eq?))))
%standard-build-options))
(define (pick-all alist key)
@@ -243,7 +250,7 @@ OUTPUT) tuples, using the build options in OPTS."
((label item output)
(list item output)))
inputs)
- #:system (%current-system))))
+ #:system (assoc-ref opts 'system))))
(mbegin %store-monad
;; First build INPUTS. This is necessary even for
;; --search-paths.