The Standard Environment
The standard environment is used by passing it as an input
called stdenv to the derivation, and then doing
source $stdenv/setup
at the top of the builder.
Apart from adding the aforementioned commands to the
PATH, setup also does the
following:
All input packages specified in the
buildInputs environment variable have their
/bin subdirectory added to PATH,
their /include subdirectory added to the C/C++
header file search path, and their /lib
subdirectory added to the linker search path. This can be extended.
For instance, when the pkgconfig package is
used, the subdirectory /lib/pkgconfig of each
input is added to the PKG_CONFIG_PATH environment
variable.
The environment variable
NIX_CFLAGS_STRIP is set so that the compiler strips
debug information from object files. This can be disabled by
setting NIX_STRIP_DEBUG to
0.
The setup script also exports a function
called genericBuild that knows how to build
typical Autoconf-style packages. It can be customised to perform
builds for any type of package. It is advisable to use
genericBuild since it provides facilities that
are almost always useful such as unpacking of sources, patching of
sources, nested logging, etc.
The definitive, up-to-date documentation of the generic builder
is the source itself, which resides in
pkgs/stdenv/generic/setup.sh.