summary refs log tree commit diff
path: root/doc/contributing
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-09 07:04:48 +0000
committerProfpatsch <mail@profpatsch.de>2021-01-10 08:24:52 +0100
commitc06b2b3d671da4847f950e7e9041920b40eca0bf (patch)
treeb114202e02fe96b4a81f3898499380caaf61eb36 /doc/contributing
parentf7c4e825aa9d63da269ff767aebb6b2c3324d7f9 (diff)
downloadnixpkgs-c06b2b3d671da4847f950e7e9041920b40eca0bf.tar
nixpkgs-c06b2b3d671da4847f950e7e9041920b40eca0bf.tar.gz
nixpkgs-c06b2b3d671da4847f950e7e9041920b40eca0bf.tar.bz2
nixpkgs-c06b2b3d671da4847f950e7e9041920b40eca0bf.tar.lz
nixpkgs-c06b2b3d671da4847f950e7e9041920b40eca0bf.tar.xz
nixpkgs-c06b2b3d671da4847f950e7e9041920b40eca0bf.tar.zst
nixpkgs-c06b2b3d671da4847f950e7e9041920b40eca0bf.zip
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).
Diffstat (limited to 'doc/contributing')
-rw-r--r--doc/contributing/coding-conventions.xml9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/contributing/coding-conventions.xml b/doc/contributing/coding-conventions.xml
index e587275a638..cb6d60c2c13 100644
--- a/doc/contributing/coding-conventions.xml
+++ b/doc/contributing/coding-conventions.xml
@@ -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">