summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDavid Thompson <davet@gnu.org>2015-06-19 08:57:44 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-10-25 20:27:19 -0400
commitf535dcbe198e7f88f3b0cd8aa4d7585191b31080 (patch)
treeecc716aed8764e046fd3ff4b0ccf297686d3df0e /doc
parent581176c00b424ea6ddbeec38ba5dfaea43b53bcc (diff)
scripts: environment: Add --container option.
* guix/scripts/system.scm (specification->file-system-mapping): Move from here... * guix/ui.scm (specification->file-system-mapping): ... to here. * guix/scripts/enviroment.scm (show-help): Show help for new options. (%options): Add --container --network, --expose, and --share options. (%network-configuration-files): New variable. (launch-environment, launch-environment/container, requisites*, inputs->requisites): New procedures. (guix-environment): Spawn new process in a container when requested. * doc/guix.texi (Invoking guix environment): Document it. * tests/guix-environment-container.sh: New file. * Makefile.am (SH_TESTS): Add it.
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi56
1 files changed, 56 insertions, 0 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 99c10d8dc74..7715b72818e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4681,6 +4681,18 @@ NumPy:
4681guix environment --ad-hoc python2-numpy python-2.7 -- python 4681guix environment --ad-hoc python2-numpy python-2.7 -- python
4682@end example 4682@end example
4683 4683
4684Sometimes it is desirable to isolate the environment as much as
4685possible, for maximal purity and reproducibility. In particular, when
4686using Guix on a host distro that is not GuixSD, it is desirable to
4687prevent access to @file{/usr/bin} and other system-wide resources from
4688the development environment. For example, the following command spawns
4689a Guile REPL in a ``container'' where only the store and the current
4690working directory are mounted:
4691
4692@example
4693guix environment --ad-hoc --container guile -- guile
4694@end example
4695
4684The available options are summarized below. 4696The available options are summarized below.
4685 4697
4686@table @code 4698@table @code
@@ -4741,6 +4753,49 @@ environment.
4741@item --system=@var{system} 4753@item --system=@var{system}
4742@itemx -s @var{system} 4754@itemx -s @var{system}
4743Attempt to build for @var{system}---e.g., @code{i686-linux}. 4755Attempt to build for @var{system}---e.g., @code{i686-linux}.
4756
4757@item --container
4758@itemx -C
4759@cindex container
4760Run @var{command} within an isolated container. The current working
4761directory outside the container is mapped to @file{/env} inside the
4762container. Additionally, the spawned process runs as the current user
4763outside the container, but has root privileges in the context of the
4764container.
4765
4766@item --network
4767@itemx -N
4768For containers, share the network namespace with the host system.
4769Containers created without this flag only have access to the loopback
4770device.
4771
4772@item --expose=@var{source}[=@var{target}]
4773For containers, expose the file system @var{source} from the host system
4774as the read-only file system @var{target} within the container. If
4775@var{target} is not specified, @var{source} is used as the target mount
4776point in the container.
4777
4778The example below spawns a Guile REPL in a container in which the user's
4779home directory is accessible read-only via the @file{/exchange}
4780directory:
4781
4782@example
4783guix environment --container --expose=$HOME=/exchange guile -- guile
4784@end example
4785
4786@item --share
4787For containers, share the file system @var{source} from the host system
4788as the writable file system @var{target} within the container. If
4789@var{target} is not specified, @var{source} is used as the target mount
4790point in the container.
4791
4792The example below spawns a Guile REPL in a container in which the user's
4793home directory is accessible for both reading and writing via the
4794@file{/exchange} directory:
4795
4796@example
4797guix environment --container --share=$HOME=/exchange guile -- guile
4798@end example
4744@end table 4799@end table
4745 4800
4746It also supports all of the common build options that @command{guix 4801It also supports all of the common build options that @command{guix
@@ -7064,6 +7119,7 @@ This command also installs GRUB on the device specified in
7064@item vm 7119@item vm
7065@cindex virtual machine 7120@cindex virtual machine
7066@cindex VM 7121@cindex VM
7122@anchor{guix system vm}
7067Build a virtual machine that contain the operating system declared in 7123Build a virtual machine that contain the operating system declared in
7068@var{file}, and return a script to run that virtual machine (VM). 7124@var{file}, and return a script to run that virtual machine (VM).
7069Arguments given to the script are passed as is to QEMU. 7125Arguments given to the script are passed as is to QEMU.