[Nix-dev] Defining env vars for user .nix-profile ?
Eelco Dolstra
eelco at cs.uu.nl
Wed Jul 18 14:22:59 CEST 2007
Hi,
Marc Weber wrote:
> How is this done?
>
> Gentoo has /etc/env.d/ which looks like this
>
> /etc/env.d/
> /etc/env.d/gcc
> [...]
>
> each is a sh file defining/appending values to env variables.
>
> I'm asking because I'm using one ghc pkg database file for each library.
> They all have to be put in a ':' or ';' (Win) separated list
> $GHC_PACKAGE_PATH to be
> accsible.
>
> How is this handled in nix?
> a) automatically? (thus using something like the gentoo system)
> b) requires user action (eg sourcing a script in his .bashrc ) ?
There is nothing yet for building a list of environment variables. It wouldn't
be too hard to do:
- Packages would have to declare environment variables in some standard
location, say $out/nix-support/env.
- The user environment builder script (nix/corepkgs/buildenv/builder.pl) would
concatenate all nix-support/env files together into one file, say $out/env.
- Then you could stick "source ~/.nix-profile/env" in your .bashrc.
However, if possible, requiring environment variables to be set should be
avoided (for example by using a wrapper script if practical), since changes to
the global environment don't take effect in existing processes, so users have to
logout/login etc.
That's not to say that I don't want this feature, because there are a bunch of
environment variables that I have to set everywhere (like ACLOCAL_PATH or
NIX_CFLAGS_COMPILE).
--
Eelco Dolstra | http://www.cs.uu.nl/~eelco
More information about the nix-dev
mailing list