From: ludo@gnu.org (Ludovic Courtès)
To: "Thompson, David" <dthompson2@worcester.edu>
Cc: guix-devel <guix-devel@gnu.org>, David Thompson <davet@gnu.org>
Subject: Re: [PATCH 14/15] scripts: environment: Add --container option.
Date: Fri, 11 Sep 2015 14:39:11 +0200 [thread overview]
Message-ID: <87oah93zbk.fsf@gnu.org> (raw)
In-Reply-To: <CAJ=RwfZneE5REVTPULLKoh2V2yYNYnFa=gDSwiN=3CLN1eRLhw@mail.gmail.com> (David Thompson's message of "Sat, 5 Sep 2015 19:45:38 -0400")
"Thompson, David" <dthompson2@worcester.edu> skribis:
> On Tue, Jul 7, 2015 at 10:35 AM, Ludovic Courtès <ludo@gnu.org> wrote:
[...]
> I have a shiny new patch that adds --network, --share, and --expose
> options.
Neat!
> Also, rather than bind-mounting the entire store, I figured out how to
> bind-mount only the union of the closures of the inputs like build
> daemon containers.
How does it perform compared to doing a single bind mount? It is
noticeably slower or OK?
> And finally, the original patch didn't setup /bin/sh, which is of
> course terrible and broke tons of things so I've fixed that, too.
Right. :-)
> Now I can do things like build Guix from source inside a container, or
> better replicate the build daemon's environment when debugging with
> failed builds. I hope that soon everyone will be able to enjoy this.
> :)
Sounds cool!
> From 8e2d0fca75feeaacaf6a401a3c13d614f9c3720b Mon Sep 17 00:00:00 2001
> From: David Thompson <davet@gnu.org>
> Date: Fri, 19 Jun 2015 08:57:44 -0400
> Subject: [PATCH] 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.
> (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.
[...]
> +The example below spawns a Guile REPL in a container in which the user's
> +home directory is accessible read-only via the @file{/exchange}
> +directory:
> +
> +@example
> +guix environment --container --expose=$HOME=/exchange guile -E guile
> +@end example
\o/
> + -C, --container run command within an isolated container"))
s/within/in/ ? (You know better than me...)
> +(define (inputs->requisites inputs)
> + "Convert INPUTS, a list of derivations, into a set of requisite store items i.e.
s/derivations/input tuples/ since it’s a list of (LABEL DRV) or
(LABEL DRV OUTPUT).
> + ;; When in Rome, do as Nix build.cc does: Automagically
> + ;; map common network configuration files.
> + (if network?
> + (filter-map (lambda (file)
> + (and (file-exists? file)
> + (file-system-mapping
> + (source file)
> + (target file)
> + (writable? #f))))
> + '("/etc/resolv.conf"
> + "/etc/nsswitch.conf"
> + "/etc/services"
> + "/etc/hosts"))
Could you make this list a global variable for clarity?
[...]
> +(define (specification->file-system-mapping spec writable?)
> + "Read the SPEC and return the corresponding <file-system-mapping>."
Now that this is public, could you add an example of what SPEC looks
like in the docstring?
Last, could you add (maybe in a separate patch?)
tests/guix-environment-container.sh mimicking tests/guix-environment.sh?
It only needs to use -E to run a tiny script that checks that we really
get an environment with only the right file system mappings?
Thanks!
Ludo’.
next prev parent reply other threads:[~2015-09-11 12:39 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-06 13:16 [PATCH 01/15] build: syscalls: Add additional mount flags David Thompson
2015-07-06 13:16 ` [PATCH 02/15] build: syscalls: Add unmount flags David Thompson
2015-07-07 14:50 ` Ludovic Courtès
2015-07-07 22:44 ` Thompson, David
2015-07-06 13:16 ` [PATCH 03/15] build: syscalls: Add mkdtemp! David Thompson
2015-07-07 13:15 ` Ludovic Courtès
2015-07-07 22:52 ` Thompson, David
2015-07-06 13:16 ` [PATCH 04/15] utils: Add call-with-temporary-directory David Thompson
2015-07-07 13:15 ` Ludovic Courtès
2015-07-07 22:54 ` Thompson, David
2015-07-06 13:16 ` [PATCH 05/15] build: syscalls: Add clone syscall wrapper David Thompson
2015-07-07 13:23 ` Ludovic Courtès
2015-07-08 0:28 ` Thompson, David
2015-07-11 10:18 ` Ludovic Courtès
2015-07-06 13:16 ` [PATCH 06/15] build: syscalls: Add setns " David Thompson
2015-07-07 13:28 ` Ludovic Courtès
2015-07-08 0:57 ` Thompson, David
2015-07-06 13:16 ` [PATCH 07/15] build: syscalls: Add pivot-root David Thompson
2015-07-07 13:35 ` Ludovic Courtès
2015-07-08 1:18 ` Thompson, David
2015-07-08 12:47 ` Ludovic Courtès
2015-07-06 13:16 ` [PATCH 08/15] gnu: build: Add Linux container module David Thompson
2015-07-07 13:51 ` Ludovic Courtès
2015-07-08 12:38 ` Thompson, David
2015-07-08 21:57 ` Ludovic Courtès
2015-07-09 12:56 ` Thompson, David
2015-07-06 13:16 ` [PATCH 09/15] gnu: system: Move <file-system-mapping> into (gnu system file-systems) David Thompson
2015-07-07 13:51 ` Ludovic Courtès
2015-07-08 1:21 ` Thompson, David
2015-07-06 13:16 ` [PATCH 10/15] gnu: system: Move file-system->spec to " David Thompson
2015-07-07 13:51 ` Ludovic Courtès
2015-07-08 1:22 ` Thompson, David
2015-07-06 13:16 ` [PATCH 11/15] gnu: system: Add Linux container module David Thompson
2015-07-07 13:55 ` Ludovic Courtès
2015-07-09 13:00 ` Thompson, David
2015-07-10 17:57 ` Ludovic Courtès
2015-07-06 13:16 ` [PATCH 12/15] gnu: system: Add Linux container file systems David Thompson
2015-07-07 13:56 ` Ludovic Courtès
2015-07-09 12:56 ` Thompson, David
2015-07-06 13:16 ` [PATCH 13/15] scripts: system: Add 'container' action David Thompson
2015-07-07 14:05 ` Ludovic Courtès
2015-10-27 0:24 ` Thompson, David
2015-10-27 17:41 ` Ludovic Courtès
2015-10-30 17:28 ` Thompson, David
2015-07-06 13:16 ` [PATCH 14/15] scripts: environment: Add --container option David Thompson
2015-07-07 14:35 ` Ludovic Courtès
2015-07-09 13:16 ` Thompson, David
2015-07-10 18:03 ` Ludovic Courtès
2015-09-05 23:45 ` Thompson, David
2015-09-11 12:39 ` Ludovic Courtès [this message]
2015-10-10 21:11 ` Thompson, David
2015-10-11 19:34 ` Ludovic Courtès
2015-10-17 10:05 ` Ludovic Courtès
2015-10-22 1:23 ` Thompson, David
2015-10-25 21:38 ` Ludovic Courtès
2015-10-26 0:35 ` Thompson, David
2015-10-27 10:13 ` Ludovic Courtès
2015-10-31 1:25 ` Thompson, David
2015-10-31 10:28 ` Ludovic Courtès
2015-07-06 13:16 ` [PATCH 15/15] scripts: Add 'container' subcommand David Thompson
2015-07-07 14:50 ` Ludovic Courtès
2015-10-27 0:31 ` Thompson, David
2015-10-27 17:46 ` Ludovic Courtès
2015-07-07 13:14 ` [PATCH 01/15] build: syscalls: Add additional mount flags Ludovic Courtès
2015-07-07 22:42 ` Thompson, David
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87oah93zbk.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=davet@gnu.org \
--cc=dthompson2@worcester.edu \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).