doc: add "prefer lib over stdenv.lib" convention

I think we should have something in the manual people can point to
about this, to avoid rehashing it over and over in PRs.  "stdenv.lib"
makes it look like lib is part of stdenv, which it isn't, and makes it
even more confusing as a newcomer to figure out what stdenv is (and
isn't).
This commit is contained in:
Alyssa Ross 2021-01-09 07:04:48 +00:00 committed by Profpatsch
parent f7c4e825aa
commit c06b2b3d67

View File

@ -178,6 +178,15 @@ args.stdenv.mkDerivation (args // {
</programlisting>
</para>
</listitem>
<listitem>
<para>
Prefer using the top-level <varname>lib</varname> over its alias
<literal>stdenv.lib</literal>. <varname>lib</varname> is unrelated to
<varname>stdenv</varname>, and so <literal>stdenv.lib</literal> should only
be used as a convenience alias when developing to avoid having to modify
the function inputs just to test something out.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-package-naming">