diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 26abf34620b..c78bc0933e2 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -177,6 +177,54 @@ genericBuild
+Attributes
+
+
+ Variables affecting stdenv
+ initialisation
+
+
+ NIX_DEBUG
+ If set, stdenv will print some
+ debug information during the build. In particular, the
+ gcc and ld wrapper scripts
+ will print out the complete command line passed to the wrapped
+ tools.
+
+
+
+ buildInputs
+ A list of dependencies used by
+ stdenv to set up the environment for the build.
+ For each dependency dir, the directory
+ dir/bin, if it
+ exists, is added to the PATH environment variable.
+ Other environment variables are also set up via a pluggable
+ mechanism. For instance, if buildInputs
+ contains Perl, then the lib/site_perl
+ subdirectory of each input is added to the PERL5LIB
+ environment variable. See for
+ details.
+
+
+
+ propagatedBuildInputs
+ Like buildInputs, but these
+ dependencies are propagated: that is, the
+ dependencies listed here are added to the
+ buildInputs of any package that uses
+ this package as a dependency. So if package
+ Y has propagatedBuildInputs = [X], and package
+ Z has buildInputs = [Y], then package X will
+ appear in Z’s build environment automatically.
+
+
+
+
+
+
+
+
Phases
The generic builder has a number of phases.
@@ -873,16 +921,86 @@ the doDist is not set.
-
-
-
Package setup hooks
-
+The following packages provide a setup hook:
+
+
+
+
+ GCC wrapper
+ Adds the include subdirectory
+ of each build input to the NIX_CFLAGS_COMPILE
+ environment variable, and the lib and
+ lib64 subdirectories to
+ NIX_LDFLAGS.
+
+
+
+ Perl
+ Adds the lib/site_perl subdirectory
+ of each build input to the PERL5LIB
+ environment variable.
+
+
+
+ Python
+ Adds the
+ lib/python2.5/site-packages subdirectory of
+ each build input to the PYTHONPATH environment
+ variable.
+
+ This should be generalised: the Python version
+ shouldn’t be hard-coded.
+
+
+
+ pkg-config
+ Adds the lib/pkgconfig and
+ share/pkgconfig subdirectories of each
+ build input to the PKG_CONFIG_PATH environment
+ variable.
+
+
+
+ Automake
+ Adds the share/aclocal
+ subdirectory of each build input to the ACLOCAL_PATH
+ environment variable.
+
+
+
+ libxml2
+ Adds every file named
+ catalog.xml found under the
+ xml/dtd and xml/xsl
+ subdirectories of each build input to the
+ XML_CATALOG_FILES environment
+ variable.
+
+
+
+ teTeX / TeX Live
+ Adds the share/texmf-nix
+ subdirectory of each build input to the TEXINPUTS
+ environment variable.
+
+
+
+ Qt
+ Sets the QTDIR environment variable
+ to Qt’s path.
+
+
+
+ GHC
+ Creates a temporary package database and registers
+ every Haskell build input in it (TODO: how?).
+
+
+
+
+