@@ -194,33 +194,52 @@ genericBuild
194194 tools.</para></listitem>
195195 </varlistentry>
196196
197+</variablelist>
198+
199+<variablelist>
200+ <title>Variables specifying dependencies</title>
201+
202+ <varlistentry>
203+ <term><varname>nativeBuildInputs</varname></term>
204+ <listitem><para>
205+ A list of dependencies used by the new derivation at <emphasis>build</emphasis>-time.
206+ I.e. these dependencies should not make it into the package's runtime-closure, though this is currently not checked.
207+ For each dependency <replaceable>dir</replaceable>, the directory <filename><replaceable>dir</replaceable>/bin</filename>, if it exists, is added to the <envar>PATH</envar> environment variable.
208+ Other environment variables are also set up via a pluggable mechanism.
209+ For instance, if <varname>buildInputs</varname> contains Perl, then the <filename>lib/site_perl</filename> subdirectory of each input is added to the <envar>PERL5LIB</envar> environment variable.
210+ See <xref linkend="ssec-setup-hooks"/> for details.
211+ </para></listitem>
212+ </varlistentry>
213+
197214 <varlistentry>
198215 <term><varname>buildInputs</varname></term>
199− <listitem><para>A list of dependencies used by
200− <literal>stdenv</literal> to set up the environment for the build.
201− For each dependency <replaceable>dir</replaceable>, the directory
202− <filename><replaceable>dir</replaceable>/bin</filename>, if it
203− exists, is added to the <envar>PATH</envar> environment variable.
204− Other environment variables are also set up via a pluggable
205− mechanism. For instance, if <varname>buildInputs</varname>
206− contains Perl, then the <filename>lib/site_perl</filename>
207− subdirectory of each input is added to the <envar>PERL5LIB</envar>
208− environment variable. See <xref linkend="ssec-setup-hooks"/> for
209− details.</para></listitem>
210− </varlistentry>
211−
216+ <listitem><para>
217+ A list of dependencies used by the new derivation at <emphasis>run</emphasis>-time.
218+ Currently, the build-time environment is modified in the exact same way as with <varname>nativeBuildInputs</varname>.
219+ This is problematic in that when cross-compiling, foreign executables can clobber native ones on the <envar>PATH</envar>.
220+ Even more confusing is static-linking.
221+ A statically-linked library should be listed here because ultimately that generated machine code will be used at run-time, even though a derivation containing the object files or static archives will only be used at build-time.
222+ A less confusing solution to this would be nice.
223+ </para></listitem>
224+ </varlistentry>
225+
226+
227+ <varlistentry>
228+ <term><varname>propagatedNativeBuildInputs</varname></term>
229+ <listitem><para>
230+ Like <varname>nativeBuildInputs</varname>, but these dependencies are <emphasis>propagated</emphasis>:
231+ that is, the dependencies listed here are added to the <varname>nativeBuildInputs</varname> of any package that uses <emphasis>this</emphasis> package as a dependency.
232+ So if package Y has <literal>propagatedBuildInputs = [X]</literal>, and package Z has <literal>buildInputs = [Y]</literal>, then package X will appear in Z’s build environment automatically.
233+ </para></listitem>
234+ </varlistentry>
235+
212236 <varlistentry>
213237 <term><varname>propagatedBuildInputs</varname></term>
214− <listitem><para>Like <varname>buildInputs</varname>, but these
215− dependencies are <emphasis>propagated</emphasis>: that is, the
216− dependencies listed here are added to the
217− <varname>buildInputs</varname> of any package that uses
218− <emphasis>this</emphasis> package as a dependency. So if package
219− Y has <literal>propagatedBuildInputs = [X]</literal>, and package
220− Z has <literal>buildInputs = [Y]</literal>, then package X will
221− appear in Z’s build environment automatically.</para></listitem>
238+ <listitem><para>
239+ Like <varname>buildInputs</varname>, but propagated just like <varname>propagatedNativeBuildInputs</varname>.
240+ This inherits <varname>buildInputs</varname>'s flaws of clobbering native executables when cross-compiling and being confusing for static linking.
241+ </para></listitem>
222242 </varlistentry>
223−
224243
225244</variablelist>
226245
@@ -322,7 +341,7 @@ executed and in what order:
322341 $preInstallPhases installPhase fixupPhase $preDistPhases
323342 distPhase $postPhases</literal>.
324343 </para>
325−
344+
326345 <para>Usually, if you just want to add a few phases, it’s more
327346 convenient to set one of the variables below (such as
328347 <varname>preInstallPhases</varname>), as you then don’t specify
@@ -706,7 +725,7 @@ makeFlagsArray=(CFLAGS="-O0 -g" LDFLAGS="-lfoo -lbar")
706725</variablelist>
707726
708727
709−<para>
728+<para>
710729You can set flags for <command>make</command> through the
711730<varname>makeFlags</varname> variable.</para>
712731
@@ -773,7 +792,7 @@ doCheck = true;</programlisting>
773792
774793</variablelist>
775794
776−
795+
777796</section>
778797
779798
@@ -840,12 +859,12 @@ install phase. The default <function>fixupPhase</function> does the
840859following:
841860
842861<itemizedlist>
843−
862+
844863 <listitem><para>It moves the <filename>man/</filename>,
845864 <filename>doc/</filename> and <filename>info/</filename>
846865 subdirectories of <envar>$out</envar> to
847866 <filename>share/</filename>.</para></listitem>
848−
867+
849868 <listitem><para>It strips libraries and executables of debug
850869 information.</para></listitem>
851870
@@ -1091,13 +1110,13 @@ functions.</para>
10911110
10921111<variablelist>
10931112
1094−
1113+
10951114 <varlistentry xml:id='fun-substitute'>
10961115 <term><function>substitute</function>
10971116 <replaceable>infile</replaceable>
10981117 <replaceable>outfile</replaceable>
10991118 <replaceable>subs</replaceable></term>
1100−
1119+
11011120 <listitem>
11021121 <para>Performs string substitution on the contents of
11031122 <replaceable>infile</replaceable>, writing the result to
@@ -1125,7 +1144,7 @@ functions.</para>
11251144 <literal>@<replaceable>...</replaceable>@</literal> in the
11261145 template as placeholders.</para></listitem>
11271146 </varlistentry>
1128−
1147+
11291148 <varlistentry>
11301149 <term><option>--subst-var-by</option>
11311150 <replaceable>varName</replaceable>
@@ -1134,7 +1153,7 @@ functions.</para>
11341153 <literal>@<replaceable>varName</replaceable>@</literal> by
11351154 the string <replaceable>s</replaceable>.</para></listitem>
11361155 </varlistentry>
1137−
1156+
11381157 </variablelist>
11391158
11401159 </para>
@@ -1162,7 +1181,7 @@ substitute ./foo.in ./foo.out \
11621181
11631182 </listitem>
11641183 </varlistentry>
1165−
1184+
11661185
11671186 <varlistentry xml:id='fun-substituteInPlace'>
11681187 <term><function>substituteInPlace</function>
@@ -1173,7 +1192,7 @@ substitute ./foo.in ./foo.out \
11731192 <replaceable>file</replaceable>.</para></listitem>
11741193 </varlistentry>
11751194
1176−
1195+
11771196 <varlistentry xml:id='fun-substituteAll'>
11781197 <term><function>substituteAll</function>
11791198 <replaceable>infile</replaceable>
@@ -1233,7 +1252,7 @@ echo @foo@
12331252 <listitem><para>Strips the directory and hash part of a store
12341253 path, outputting the name part to <literal>stdout</literal>.
12351254 For example:
1236−
1255+
12371256<programlisting>
12381257# prints coreutils-8.24
12391258stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
@@ -1241,7 +1260,7 @@ stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
12411260
12421261 If you wish to store the result in another variable, then the
12431262 following idiom may be useful:
1244−
1263+
12451264<programlisting>
12461265name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
12471266someVar=$(stripHash $name)
@@ -1250,7 +1269,7 @@ someVar=$(stripHash $name)
12501269 </para></listitem>
12511270 </varlistentry>
12521271
1253−
1272+
12541273</variablelist>
12551274
12561275</section>
@@ -1607,4 +1626,3 @@ Arch Wiki</link>.
16071626</section>
16081627
16091628</chapter>
1610−