Subject: Re: [bug#30572] [PATCH 4/7] docker: Allow the use of a custom temporary directory.

From: Chris Marusich <[email-masked]>
Date: Wed, 07 Mar 2018 07:24:30 +0100

[email-masked] (Ludovic Courtès) writes:

> Chris Marusich <[email-masked]> skribis:
>
>> +TMPDIR is the name of the temporary working directory to use.  This can be
>> +useful if you need to use a specific temporary directory, for example because
>> +the default temporary directory lies on a file system with insufficient
>> +space."
>
> Usually this code is used in a derivation, where it doesn’t really
> matter which directory is used, no?

I added this because I thought I needed it in order to implement "guix
system docker-image".  I build the Docker image in a VM, and the VM's
file system is too small to hold all the transient files that are
created by build-docker-image (in guix/docker.scm).  Without this
change, the derivation fails due to lack of space within the VM.  I work
around this limitation by using the /xchg directory as the temporary
directory in the VM, which does have enough space to hold all the
transient files.

However, thinking about this now, maybe the right thing to do is to
adjust the heuristics for guessing the right disk size in
expression->derivation-in-linux-vm (in gnu/system/vm.scm).  Or maybe I
can just provide my own estimate via the #:disk-image-size argument.
Maybe if I adjust that, I will be able to build the Docker image without
specifying a custom temporary directory.  That would be nice; I'll try
to do it and let you know how it goes.

Another option here would be to build the Docker image without using a
VM in the first place.  Perhaps we can use namespaces, but I haven't
tried that yet, since the VM approach worked.  I tried without a VM
first, and I quickly found that I couldn't do many things in a normal
derivation that I needed to do in order to build the image (e.g., create
device files).  I don't know if I can do all those necessary things
without using a VM.  But I think we can iterate on that after this patch
series gets committed.

What do you think?

-- 
Chris