Subject: Re: bug#31956: guix environment: add option to download and unpack source

From: Björn Höfling <[email-masked]>
Date: Sun, 24 Jun 2018 21:20:13 +0200

On Sun, 24 Jun 2018 12:06:17 -0700
Vagrant Cascadian <[email-masked]> wrote:

> I've a minor feature request.
> 
> When working on new package definitions, it's often useful to debug
> build failures with guix environment.
> 
> The current implementation, as I understand it, requires manually
> downloading the source, and merely drops you into whatever working
> directory you happen to be it.
> 
> It would be great if there were an option you could pass that
> downloads and unpacks the source somewhere and drops you into the
> newly unpacked source directory.
> 
> Not sure what to call it exactly, but something like:
> 
>   guix environment --with-source hello
> 
> Should drop you into an unpacked source directory with the inputs and
> such for building "hello".

Hi Vagrant,

if you need this in the case of build failures, use the "-K" option:

https://www.gnu.org/software/guix/manual/guix.html#Common-Build-Options

--keep-failed
-K

    Keep the build tree of failed builds. Thus, if a build fails, its
build tree is kept under /tmp, in a directory whose name is shown at
the end of the build log. This is useful when debugging build issues.
See Debugging Build Failures, for tips and tricks on how to debug build
issues.

See also

https://www.gnu.org/software/guix/manual/guix.html#Debugging-Build-Failures

For the case that the built went through OK, there is no such option.
You could raise an exception at the end of your package
definition/build phases.

Also there is the -S option to build:

guix build -S <package-name>

builds the source of your package. This will download the package,
verifies the checkum applies patches and applies snippets (i.e. rules
to remove for example binaries or other non-free-licensed parts).

Björn