all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ‘guix pack’ automatic environment for Docker format
@ 2018-02-14 23:19 Mathieu Lirzin
  2018-02-15 14:57 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Lirzin @ 2018-02-14 23:19 UTC (permalink / raw)
  To: help-guix

Hello,

I am trying to use ‘guix pack’ to provide my colleagues an easy to use
compilation environment to run with Docker.  My command to create the
container image is the following

  $ guix pack -f docker -S /bin=bin gcc-toolchain bash cmake make pkg-config python@2 coreutils eigen jsoncpp googletest

Then I run that image like this:

  $ IMAGE=`docker load -i docker-pack.tar.gz | cut -d' ' -f3` 
  $ docker run -it $IMAGE  /bin/bash

in order for the compilation environment to be fully ready I need to
source the /gnu/store...-profile/etc/profile for things like
CMAKE_PREFIX_PATH, LIBRARY_PATH, ...

While one obvious available solution is to add an extra symlink ‘-S
/etc/profile=etc/profile’ and then source it manually.  I was thinking
that maybe 'guix pack -f docker' could set the ‘Env’ part in the
‘config.json’ [1] with the appriopriate environment variables
automatically.

I would like to know if it would be a good idea, and if it is easily
doable?

Thanks.

[1] https://github.com/moby/moby/blob/master/image/spec/v1.2.md#image-json-description

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ‘guix pack’ automatic environment for Docker format
  2018-02-14 23:19 ‘guix pack’ automatic environment for Docker format Mathieu Lirzin
@ 2018-02-15 14:57 ` Ludovic Courtès
  2018-02-15 20:17   ` Mathieu Lirzin
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2018-02-15 14:57 UTC (permalink / raw)
  To: Mathieu Lirzin; +Cc: help-guix

Hi,

Mathieu Lirzin <mthl@gnu.org> skribis:

> in order for the compilation environment to be fully ready I need to
> source the /gnu/store...-profile/etc/profile for things like
> CMAKE_PREFIX_PATH, LIBRARY_PATH, ...
>
> While one obvious available solution is to add an extra symlink ‘-S
> /etc/profile=etc/profile’ and then source it manually.

Actually, if you also do ‘-S /bin/bash=bin/bash’ and then run /bin/bash
in the environment, Bash will source /etc/profile.  That should be a
good short-term solution.

> I was thinking that maybe 'guix pack -f docker' could set the ‘Env’
> part in the ‘config.json’ [1] with the appriopriate environment
> variables automatically.
>
> I would like to know if it would be a good idea, and if it is easily
> doable?

It’s definitely a good idea, and I think it wouldn’t be hard to do.
Essentially, you’d have to follow the same approach as the one used for
etc/profile creation in (guix profiles).  See ‘profile-derivation’ as
well as ‘build-etc/profile’ in (guix build profiles).

HTH!

Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ‘guix pack’ automatic environment for Docker format
  2018-02-15 14:57 ` Ludovic Courtès
@ 2018-02-15 20:17   ` Mathieu Lirzin
  0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Lirzin @ 2018-02-15 20:17 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

Hello,

ludo@gnu.org (Ludovic Courtès) writes:

> Mathieu Lirzin <mthl@gnu.org> skribis:
>
>> in order for the compilation environment to be fully ready I need to
>> source the /gnu/store...-profile/etc/profile for things like
>> CMAKE_PREFIX_PATH, LIBRARY_PATH, ...
>>
>> While one obvious available solution is to add an extra symlink ‘-S
>> /etc/profile=etc/profile’ and then source it manually.
>
> Actually, if you also do ‘-S /bin/bash=bin/bash’ and then run /bin/bash
> in the environment, Bash will source /etc/profile.  That should be a
> good short-term solution.

Yes it works fine when you add the ‘--login’ option when calling bash

   $ docker run -it IMAGE_ID /bin/bash --login

>> I was thinking that maybe 'guix pack -f docker' could set the ‘Env’
>> part in the ‘config.json’ [1] with the appriopriate environment
>> variables automatically.
>>
>> I would like to know if it would be a good idea, and if it is easily
>> doable?
>
> It’s definitely a good idea, and I think it wouldn’t be hard to do.
> Essentially, you’d have to follow the same approach as the one used for
> etc/profile creation in (guix profiles).  See ‘profile-derivation’ as
> well as ‘build-etc/profile’ in (guix build profiles).

Great, I will see if I can do something.

Thanks for the feedback.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-15 20:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 23:19 ‘guix pack’ automatic environment for Docker format Mathieu Lirzin
2018-02-15 14:57 ` Ludovic Courtès
2018-02-15 20:17   ` Mathieu Lirzin

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.