mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-20 12:08:17 +03:00
docs: clarify package and module option naming
This attempts to briefly clarify the current naming conventions of attribute names in `all-packages.nix` and module option names.
This commit is contained in:
parent
ea1724ba37
commit
91154416b6
@ -18,9 +18,9 @@
|
|||||||
tab settings so it’s asking for trouble.</para></listitem>
|
tab settings so it’s asking for trouble.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Use <literal>lowerCamelCase</literal> for variable
|
<listitem><para>Use <literal>lowerCamelCase</literal> for variable
|
||||||
names, not <literal>UpperCamelCase</literal>. TODO: naming of
|
names, not <literal>UpperCamelCase</literal>. Note, this rule does
|
||||||
attributes in
|
not apply to package attribute names, which instead follow the rules
|
||||||
<filename>all-packages.nix</filename>?</para></listitem>
|
in <xref linkend="sec-package-naming"/>.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Function calls with attribute set arguments are
|
<listitem><para>Function calls with attribute set arguments are
|
||||||
written as
|
written as
|
||||||
@ -220,9 +220,10 @@ args.stdenv.mkDerivation (args // {
|
|||||||
|
|
||||||
<listitem><para>The variable name used for the instantiated package
|
<listitem><para>The variable name used for the instantiated package
|
||||||
in <filename>all-packages.nix</filename>, and when passing it as a
|
in <filename>all-packages.nix</filename>, and when passing it as a
|
||||||
dependency to other functions. This is what Nix expression authors
|
dependency to other functions. Typically this is called the
|
||||||
see. It can also be used when installing using <command>nix-env
|
<emphasis>package attribute name</emphasis>. This is what Nix
|
||||||
-iA</command>.</para></listitem>
|
expression authors see. It can also be used when installing using
|
||||||
|
<command>nix-env -iA</command>.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>The filename for (the directory containing) the Nix
|
<listitem><para>The filename for (the directory containing) the Nix
|
||||||
expression.</para></listitem>
|
expression.</para></listitem>
|
||||||
@ -259,12 +260,12 @@ bound to the variable name <varname>e2fsprogs</varname> in
|
|||||||
Also append <literal>"unstable"</literal> to the name - e.g.,
|
Also append <literal>"unstable"</literal> to the name - e.g.,
|
||||||
<literal>"pkgname-unstable-2014-09-23"</literal>.</para></listitem>
|
<literal>"pkgname-unstable-2014-09-23"</literal>.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>Dashes in the package name should be preserved
|
<listitem><para>Dashes in the package name should be preserved in
|
||||||
in new variable names, rather than converted to underscores
|
new variable names, rather than converted to underscores or camel
|
||||||
(which was convention up to around 2013 and most names
|
cased — e.g., <varname>http-parser</varname> instead of
|
||||||
still have underscores instead of dashes) — e.g.,
|
<varname>http_parser</varname> or <varname>httpParser</varname>. The
|
||||||
<varname>http-parser</varname> instead of
|
hyphenated style is preferred in all three package
|
||||||
<varname>http_parser</varname>.</para></listitem>
|
names.</para></listitem>
|
||||||
|
|
||||||
<listitem><para>If there are multiple versions of a package, this
|
<listitem><para>If there are multiple versions of a package, this
|
||||||
should be reflected in the variable names in
|
should be reflected in the variable names in
|
||||||
|
@ -22,6 +22,15 @@ options = {
|
|||||||
};
|
};
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
|
The attribute names within the <replaceable>name</replaceable>
|
||||||
|
attribute path must be camel cased in general but should, as an
|
||||||
|
exception, match the
|
||||||
|
<link
|
||||||
|
xlink:href="https://nixos.org/nixpkgs/manual/#sec-package-naming">
|
||||||
|
package attribute name</link> when referencing a Nixpkgs package. For
|
||||||
|
example, the option <varname>services.nix-serve.bindAddress</varname>
|
||||||
|
references the <varname>nix-serve</varname> Nixpkgs package.
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>The function <varname>mkOption</varname> accepts the following arguments.
|
<para>The function <varname>mkOption</varname> accepts the following arguments.
|
||||||
|
Loading…
Reference in New Issue
Block a user