summary refs log tree commit diff
path: root/doc/contributing
diff options
context:
space:
mode:
authorV <v@anomalous.eu>2021-01-21 01:07:16 +0100
committerGitHub <noreply@github.com>2021-01-20 19:07:16 -0500
commit7616206b7747f12db15d32a7ab16b0ceaa3d7331 (patch)
treeb7cc1797a713439c41209f3e744a336420d6657d /doc/contributing
parent77403c1c19f9e9c5f8ba9bb24f83c07eace126b2 (diff)
downloadnixpkgs-7616206b7747f12db15d32a7ab16b0ceaa3d7331.tar
nixpkgs-7616206b7747f12db15d32a7ab16b0ceaa3d7331.tar.gz
nixpkgs-7616206b7747f12db15d32a7ab16b0ceaa3d7331.tar.bz2
nixpkgs-7616206b7747f12db15d32a7ab16b0ceaa3d7331.tar.lz
nixpkgs-7616206b7747f12db15d32a7ab16b0ceaa3d7331.tar.xz
nixpkgs-7616206b7747f12db15d32a7ab16b0ceaa3d7331.tar.zst
nixpkgs-7616206b7747f12db15d32a7ab16b0ceaa3d7331.zip
doc: add function argument order convention (#110060)
* doc: add function argument order convention

Ordering by usage is the de facto ordering given to arguments. It's
logical, and makes finding argument usage easier. Putting lib first is
common in NixOS modules, so it's reasonable to mirror this in nixpkgs
proper. Additionally, it's not a package as such, has zero dependencies,
and can be found used anywhere in a derivation.

* doc: clean up usage of lib
Diffstat (limited to 'doc/contributing')
-rw-r--r--doc/contributing/coding-conventions.xml6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/contributing/coding-conventions.xml b/doc/contributing/coding-conventions.xml
index cb6d60c2c13..9005a9ebafd 100644
--- a/doc/contributing/coding-conventions.xml
+++ b/doc/contributing/coding-conventions.xml
@@ -180,6 +180,12 @@ args.stdenv.mkDerivation (args // {
    </listitem>
    <listitem>
     <para>
+     Arguments should be listed in the order they are used, with the
+     exception of <varname>lib</varname>, which always goes first.
+    </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