mbox series

[bug#50960,v3,00/10] Adding 'guix shell': last call!

Message ID 20211018195219.13898-1-ludo@gnu.org
Headers show
Series Adding 'guix shell': last call! | expand

Message

Ludovic Courtès Oct. 18, 2021, 7:52 p.m. UTC
Hi!

This is v3 of the ‘guix shell’ patch set.  Changes since v2:

  • Merged as a single commit the one that adds support for implicit
    ‘guix.scm’/‘manifest.scm’ and then one that adds authorization
    checks;

  • Fixed ‘package-development-inputs’ bug/typo reported by zimoun;

  • Fixed doc typos reported by Florian.

If there are no objections, I’ll go ahead with this patch series
in a few days.  I’ll also add a news entry, and I guess a blog post
introducing it would be welcome.

WDYT?

Ludo’.

Ludovic Courtès (10):
  packages: Add 'package-development-inputs'.
  profiles: Add 'package->development-manifest'.
  Add 'guix shell'.
  shell: By default load the local 'guix.scm' or 'manifest.scm' file.
  environment: Add tests for '--profile'.
  environment: Skip derivation computation when '--profile' is used.
  environment: Do not connect to the daemon when '--profile' is used.
  environment: Autoload some modules.
  cache: Gracefully handle non-existent cache.
  shell: Maintain a profile cache.

 Makefile.am                         |   2 +
 doc/contributing.texi               |   8 +-
 doc/guix.texi                       | 443 ++++++++++++++++++++++++++--
 guix/cache.scm                      |  10 +-
 guix/packages.scm                   |  10 +
 guix/profiles.scm                   |  19 ++
 guix/scripts/environment.scm        | 260 ++++++++--------
 guix/scripts/shell.scm              | 355 ++++++++++++++++++++++
 po/guix/POTFILES.in                 |   1 +
 tests/guix-environment-container.sh |   8 +
 tests/guix-environment.sh           |   7 +
 tests/guix-shell.sh                 | 100 +++++++
 tests/packages.scm                  |  14 +
 tests/profiles.scm                  |   7 +
 14 files changed, 1098 insertions(+), 146 deletions(-)
 create mode 100644 guix/scripts/shell.scm
 create mode 100644 tests/guix-shell.sh


base-commit: 9cda21cf20a5c9bdf97e3a6d6c8f901fc3e4307d

Comments

Simon Tournier Oct. 19, 2021, 8:43 a.m. UTC | #1
Hi,

On Mon, 18 Oct 2021 at 21:52, Ludovic Courtès <ludo@gnu.org> wrote:

> Ludovic Courtès (10):
>   packages: Add 'package-development-inputs'.
>   profiles: Add 'package->development-manifest'.

LGTM.  I have not checked the others. :-)

>   Add 'guix shell'.
>   shell: By default load the local 'guix.scm' or 'manifest.scm' file.
>   environment: Add tests for '--profile'.
>   environment: Skip derivation computation when '--profile' is used.
>   environment: Do not connect to the daemon when '--profile' is used.
>   environment: Autoload some modules.
>   cache: Gracefully handle non-existent cache.
>   shell: Maintain a profile cache.


Cheers,
simon
Simon Tournier Oct. 25, 2021, 1:41 p.m. UTC | #2
Hi Ludo,

I have not reviewed all in detail, only applied the series and run some
checks based on my "workflow".  All looks good to me.


The environment variable named GUIX_ENVIRONMENT remains unchanged.  I
have no opinion if it is misleading or not for newcomers.


(I have not checked the behaviour about implicitly loading some files –
since I am not a big fan of implicit behaviour: «Explicit is better than
implicit.» and «In the face of ambiguity, refuse the temptation to
guess.», as a good Zen says – that’s not the consensus though.  The road
seems to go toward,

    guix time-machine -- shell

which appears to me handy in some cases but wrong on principles.  As I
explained here <http://issues.guix.gnu.org/50960#70>.)


About completion, “guix environment” is in zsh and fish, “guix shell” is
not yet.


Last, in the manual, this,

--8<---------------cut here---------------start------------->8---
Here, @command{guix environment -C} creates a container and spawns a new
shell in it (@pxref{Invoking guix shell}).  The @command{strace gdb}
part adds the @command{strace} and @command{gdb} commands to
the container, which you may find handy while debugging.  The
@option{--no-grafts} option makes sure we get the exact same
environment, with ungrafted packages (@pxref{Security Updates}, for more
info on grafts).
--8<---------------cut here---------------end--------------->8---

in the node «Debugging Build Failures» should be replaced.  Because the
example just above this snippet does not refer to “guix environment”.

Well, the section «Invoking guix environment» should be revamped.
Especially, all the examples.  Let do that by another commit (later).


Cheers,
simon
Ludovic Courtès Oct. 25, 2021, 6:19 p.m. UTC | #3
Hi!

zimoun <zimon.toutoune@gmail.com> skribis:

> The environment variable named GUIX_ENVIRONMENT remains unchanged.  I
> have no opinion if it is misleading or not for newcomers.

I think it’s fine.

[...]

> About completion, “guix environment” is in zsh and fish, “guix shell” is
> not yet.

Oops.  I updated “shell” support for Bash completion (see
80edb7df6586464aa40e84e103f0045452de95db).  Can someone proficient in
zsh or fish help with these two?

> Last, in the manual, this,
>
> Here, @command{guix environment -C} creates a container and spawns a new
> shell in it (@pxref{Invoking guix shell}).  The @command{strace gdb}
> part adds the @command{strace} and @command{gdb} commands to
> the container, which you may find handy while debugging.  The
> @option{--no-grafts} option makes sure we get the exact same
> environment, with ungrafted packages (@pxref{Security Updates}, for more
> info on grafts).
>
> in the node «Debugging Build Failures» should be replaced.  Because the
> example just above this snippet does not refer to “guix environment”.

Oops, fixed as well.

> Well, the section «Invoking guix environment» should be revamped.
> Especially, all the examples.  Let do that by another commit (later).

I don’t know.  I kept it as-is, in “frozen” state, on the grounds that
people will still be using it for some time and will want to see the
reference.  WDYT?

Thanks for these last-minute comments!

Ludo’.
Ludovic Courtès Oct. 25, 2021, 6:25 p.m. UTC | #4
Hi!

Ludovic Courtès <ludo@gnu.org> skribis:

> This is v3 of the ‘guix shell’ patch set.  Changes since v2:
>
>   • Merged as a single commit the one that adds support for implicit
>     ‘guix.scm’/‘manifest.scm’ and then one that adds authorization
>     checks;
>
>   • Fixed ‘package-development-inputs’ bug/typo reported by zimoun;
>
>   • Fixed doc typos reported by Florian.
>
> If there are no objections, I’ll go ahead with this patch series
> in a few days.  I’ll also add a news entry, and I guess a blog post
> introducing it would be welcome.

I went ahead and pushed it, woohoo!

  4aa41a37f0 news: Add entry about "guix shell".
  9730692d9f shell: Maintain a profile cache.
  2cb0b3709a cache: Gracefully handle non-existent cache.
  3c96158438 environment: Autoload some modules.
  99499a2037 environment: Do not connect to the daemon when '--profile' is used.
  648a6eb03f environment: Skip derivation computation when '--profile' is used.
  10208952ea environment: Add tests for '--profile'.
  746584e0ca shell: By default load the local 'manifest.scm' or 'guix.scm' file.
  80edb7df65 Add 'guix shell'.
  23f99f1a29 profiles: Add 'package->development-manifest'.
  fb368f4e76 packages: Add 'package-development-inputs'.

I made minor changes:

  • addressing the issues zimoun reported (Bash completion and updating
    the “Debugging Failed Builds” node);

  • changing the order in which ‘guix shell’ without arguments looks for
    files, ‘manifest.scm’ first (because it’s the most expressive) and
    ‘guix.scm’ second, in case both are present (this was suggested by
    singpolyma on IRC¹).

Please report any issues you find!

There’s a draft blog post that I intend to publish tomorrow:

  https://git.savannah.gnu.org/cgit/guix/guix-artwork.git/tree/website/drafts/guix-environment-to-shell.md

Thanks everyone! 🎉

Ludo’.

¹ https://logs.guix.gnu.org/guix/2021-10-25.log#183552
Simon Tournier Oct. 25, 2021, 7:45 p.m. UTC | #5
Hi Ludo,

On Mon, 25 Oct 2021 at 20:19, Ludovic Courtès <ludo@gnu.org> wrote:

>> Well, the section «Invoking guix environment» should be revamped.
>> Especially, all the examples.  Let do that by another commit (later).
>
> I don’t know.  I kept it as-is, in “frozen” state, on the grounds that
> people will still be using it for some time and will want to see the
> reference.  WDYT?

I agree with the messages I sent. :-)

<http://issues.guix.gnu.org/50960#33>
<http://issues.guix.gnu.org/50960#41>
<http://issues.guix.gnu.org/50960#43>

Other said, I would let the manual “frozen” until next release (or next
next release).  Then, I would remove the section and instead replace by
two points:

 1. the commit introducing “guix shell”, i.e.,
 4aa41a37f0819c9e1750bca0af47e632c2443d50 which is the last commit
 officially supporting “guix environment” somehow;

 2. if people want to run “guix environment” or read documentation, then
 they still can using “guix time-machine” with the mentioned commit.

Somehow, turn the current “guix environment” examples into “guix shell”,
remove “guix environment” section, and add an warning box to “guix
shell” section explaining the difference (--ad-hoc vs -D) and provide
the way to get the old manual.

Cheers,
simon