mbox series

[bug#54377,0/3] Add 'guix home container'

Message ID 20220313215259.9394-1-ludo@gnu.org
Headers show
Series Add 'guix home container' | expand

Message

Ludovic Courtès March 13, 2022, 9:52 p.m. UTC
Hello Guix!

This patch series adds a ‘guix home container’ command.  You can run:

  guix home container config.scm

and you get an interactive shell, started as a login shell, where you
can check the effect of your configuration.  Handy!

The code is a bit redundant with that of ‘guix environment’, but
slightly different, so no obvious way to factorize it came to mind.

Feedback welcome!

Ludo’.

Ludovic Courtès (3):
  linux-container: 'eval/container' honors #:namespaces.
  linux-container: Add #:guest-uid and #:guest-gid to 'eval/container'.
  guix home: Add 'container' command.

 doc/guix.texi                  |  58 +++++++
 gnu/system/linux-container.scm |  15 +-
 guix/scripts/home.scm          | 271 ++++++++++++++++++++++++++++++---
 tests/guix-home.sh             |  58 +++++--
 4 files changed, 359 insertions(+), 43 deletions(-)


base-commit: d41c82b481fd0f5c7d45d6e2629fdf9d2085205b

Comments

Frank Pursel March 17, 2022, 3:01 p.m. UTC | #1
Ludo,

This is a very exciting idea.  Entry into guix home has some wrinkles in
it that are scary.  I know it required several iterations over
home-configuration.scm and 'guix home reconfigure' before I was able to
make peace with my guix home.  I see in irc that others are also
experiencing challenges getting the environments where they want them to
be.  This patch allows more control over the adoption of guix home while
also cleverly leveraging improvements to guix containers.  Very cool, I
want it!

I ran this patch against my current, working home configuration to see
what happened and I ran into a problem.  My home-configuration.scm sets
the GUIX_PACKAGE_PATH (using simple-service
'local-environment-variables) and then references packages that are in
that path (in my case a package called emacs-ix).  When I executed 'guix
home container <my-config.scm>' I received the following errors:

guix home: error: emacs-ix: unknown package
guix home: error: failed to load '/home/fpp/src/guix-home-config/home-configuration.scm':
gnu/packages.scm:544:4: In procedure specification->package+output:

IDK if this is the desired behavior.  Can the environment set in
config.scm be set before loading the packages that may modify the
environment?

Regards,
Frank Pursel
acrow#guix
Ludovic Courtès March 19, 2022, 10:32 a.m. UTC | #2
Hi Frank,

Frank Pursel <frank.pursel@gmail.com> skribis:

> This is a very exciting idea.  Entry into guix home has some wrinkles in
> it that are scary.  I know it required several iterations over
> home-configuration.scm and 'guix home reconfigure' before I was able to
> make peace with my guix home.  I see in irc that others are also
> experiencing challenges getting the environments where they want them to
> be.  This patch allows more control over the adoption of guix home while
> also cleverly leveraging improvements to guix containers.  Very cool, I
> want it!

I agree, that very well summarizes my motivation for adding it!

> I ran this patch against my current, working home configuration to see
> what happened and I ran into a problem.  My home-configuration.scm sets
> the GUIX_PACKAGE_PATH (using simple-service
> 'local-environment-variables) and then references packages that are in
> that path (in my case a package called emacs-ix).  When I executed 'guix
> home container <my-config.scm>' I received the following errors:
>
> guix home: error: emacs-ix: unknown package
> guix home: error: failed to load '/home/fpp/src/guix-home-config/home-configuration.scm':
> gnu/packages.scm:544:4: In procedure specification->package+output:
>
> IDK if this is the desired behavior.  Can the environment set in
> config.scm be set before loading the packages that may modify the
> environment?

If you want ‘home-configuration.scm’ to refer to files in that path,
then GUIX_PACKAGE_PATH needs to be set in the environment of where ‘guix
home’ itself is running.  Like so:

  export GUIX_PACKAGE_PATH=/path/to/your/packages
  guix home container …

Alternatively, you can run:

  guix home container -L /path/to/your/packages …

HTH!

Ludo’.
Frank Pursel March 23, 2022, 3:06 a.m. UTC | #3
Yes, of course, export or -L were needed to get my GUIX_PACKAGE_PATH
recognized.  and so it was helpful.  After catching a configuration error
the GUIX_PACKAGE_PATH I had added to an instance of
home-environment-service-type works; so that, I no longer need to do this.

I'm in the process of finding out how helpful the new guix home container
is in rooting out problems in guix home configurations.

Thank you,
Frank


On Sat, Mar 19, 2022 at 10:32 AM Ludovic Courtès <ludo@gnu.org> wrote:

> Hi Frank,
>
> Frank Pursel <frank.pursel@gmail.com> skribis:
>
> > This is a very exciting idea.  Entry into guix home has some wrinkles in
> > it that are scary.  I know it required several iterations over
> > home-configuration.scm and 'guix home reconfigure' before I was able to
> > make peace with my guix home.  I see in irc that others are also
> > experiencing challenges getting the environments where they want them to
> > be.  This patch allows more control over the adoption of guix home while
> > also cleverly leveraging improvements to guix containers.  Very cool, I
> > want it!
>
> I agree, that very well summarizes my motivation for adding it!
>
> > I ran this patch against my current, working home configuration to see
> > what happened and I ran into a problem.  My home-configuration.scm sets
> > the GUIX_PACKAGE_PATH (using simple-service
> > 'local-environment-variables) and then references packages that are in
> > that path (in my case a package called emacs-ix).  When I executed 'guix
> > home container <my-config.scm>' I received the following errors:
> >
> > guix home: error: emacs-ix: unknown package
> > guix home: error: failed to load
> '/home/fpp/src/guix-home-config/home-configuration.scm':
> > gnu/packages.scm:544:4: In procedure specification->package+output:
> >
> > IDK if this is the desired behavior.  Can the environment set in
> > config.scm be set before loading the packages that may modify the
> > environment?
>
> If you want ‘home-configuration.scm’ to refer to files in that path,
> then GUIX_PACKAGE_PATH needs to be set in the environment of where ‘guix
> home’ itself is running.  Like so:
>
>   export GUIX_PACKAGE_PATH=/path/to/your/packages
>   guix home container …
>
> Alternatively, you can run:
>
>   guix home container -L /path/to/your/packages …
>
> HTH!
>
> Ludo’.
>