all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fis Trivial <ybbs.daans@hotmail.com>
To: guix-devel <guix-devel@gnu.org>
Subject: Export environment variables only in `guix environment`.
Date: Mon, 29 Jan 2018 22:29:09 +0000	[thread overview]
Message-ID: <MWHPR16MB006322CA6E6EE234DD91291792E50@MWHPR16MB0063.namprd16.prod.outlook.com> (raw)


* 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"

             reply	other threads:[~2018-01-29 22:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 22:29 Fis Trivial [this message]
2018-01-31 23:40 ` Export environment variables only in `guix environment` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR16MB006322CA6E6EE234DD91291792E50@MWHPR16MB0063.namprd16.prod.outlook.com \
    --to=ybbs.daans@hotmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.