all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Export environment variables only in `guix environment`.
@ 2018-01-29 22:29 Fis Trivial
  2018-01-31 23:40 ` Ludovic Courtès
  2018-02-01 17:26 ` Chris Marusich
  0 siblings, 2 replies; 7+ messages in thread
From: Fis Trivial @ 2018-01-29 22:29 UTC (permalink / raw)
  To: guix-devel


* Problem
The exported environment variables can cause various problems in foreign
distribution(1)(2). And besides, The long list of environment variables(4)
injected into user's login shell makes the user's environment impure.
So, I believe that if I want to run guix safely on a foreign distributions, I
need to eliminate the need for exporting environment variables from guix to my
login shell.

* From nix
I tried nix and found that they actually don't export any library related
environment variable by default, the only non-prefixed env in their profile file
is $PATH, so the above mentioned problem cannot arise on the nix side. But the
simple solution isn't perfect either.  In short, one cannot access any library
installed by nix without launching `nix-shell`(much like `guix environment`).
Even worse, you need to specify all the needed libraries before launching it,
which is extremely inconvenient, especially when you use interpreters like
python shell. That's not good for Unix, where casual programming is a daily
practice.
Around the problem, they also have some discussions, for details, please refer
to(1).

So, I am thinking if we can come to a middle land, that we *ONLY* source those
exported environment variables when launching `guix environment` or
`guix container`, and let the behavior controllable by command arguments. For
example:
`guix environment --export-all-envs`
 or
`guix environment --export GI_TYPELIB_PATH`


[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30093
[2]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30229
[3]: https://github.com/NixOS/nixpkgs/issues/10597

[4]: The envs exported by guix on my system, copied from ~/.guix-profile/etc/profile

export PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/bin:${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/sbin${PATH:+:}$PATH"
export C_INCLUDE_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/include${C_INCLUDE_PATH:+:}$C_INCLUDE_PATH"
export CPLUS_INCLUDE_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/include${CPLUS_INCLUDE_PATH:+:}$CPLUS_INCLUDE_PATH"
export LIBRARY_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib:${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib64${LIBRARY_PATH:+:}$LIBRARY_PATH"
export XDG_DATA_DIRS="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/share${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"
export GIO_EXTRA_MODULES="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib/gio/modules${GIO_EXTRA_MODULES:+:}$GIO_EXTRA_MODULES"
export GI_TYPELIB_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib/girepository-1.0${GI_TYPELIB_PATH:+:}$GI_TYPELIB_PATH"
export PYTHONPATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib/python3.5/site-packages${PYTHONPATH:+:}$PYTHONPATH"
export GUIX_GTK3_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib/gtk-3.0${GUIX_GTK3_PATH:+:}$GUIX_GTK3_PATH"
export PERL5LIB="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib/perl5/site_perl${PERL5LIB:+:}$PERL5LIB"
export GUILE_LOAD_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/share/guile/site/2.2${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
export GUILE_LOAD_COMPILED_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/share/guile/site/2.2${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
export CMAKE_PREFIX_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/${CMAKE_PREFIX_PATH:+:}$CMAKE_PREFIX_PATH"
export PKG_CONFIG_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib/pkgconfig:${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/share/pkgconfig${PKG_CONFIG_PATH:+:}$PKG_CONFIG_PATH"
export CPATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/include${CPATH:+:}$CPATH"
export SSL_CERT_DIR="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/etc/ssl/certs${SSL_CERT_DIR:+:}$SSL_CERT_DIR"
export GHC_PACKAGE_PATH="${GUIX_PROFILE:-/gnu/store/5myb7fcfvlmcxb2yw1kra70603ma56fm-profile}/lib/ghc-8.0.2/package.conf.d${GHC_PACKAGE_PATH:+:}$GHC_PACKAGE_PATH"

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

end of thread, other threads:[~2018-02-02 14:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-29 22:29 Export environment variables only in `guix environment` Fis Trivial
2018-01-31 23:40 ` Ludovic Courtès
2018-02-01  5:22   ` Pjotr Prins
2018-02-01 15:15     ` Fis Trivial
2018-02-01 15:06   ` Fis Trivial
2018-02-01 17:26 ` Chris Marusich
2018-02-02  6:27   ` Pjotr Prins

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.