diff --git a/doc/coding-conventions.xml b/doc/coding-conventions.xml index e55f86ae3d31..61d373738f90 100644 --- a/doc/coding-conventions.xml +++ b/doc/coding-conventions.xml @@ -235,12 +235,7 @@ Most of the time, these are the same. For instance, the package bound to the variable name e2fsprogs in all-packages.nix, and the Nix expression is in pkgs/os-specific/linux/e2fsprogs/default.nix. -However, identifiers in the Nix language don’t allow certain -characters (e.g. dashes), so sometimes a different variable name -should be used. For instance, the -module-init-tools package is bound to the -module_init_tools variable in -all-packages.nix. + There are a few naming guidelines: @@ -261,17 +256,20 @@ should be used. For instance, the a package named hello-svn by nix-env. - Dashes in the package name should be changed to - underscores in variable names, rather than to camel case — e.g., - module_init_tools instead of - moduleInitTools. + Dashes in the package name should be preserved + in new variable names, rather than converted to underscores + (which was convention up to around 2013 and most names + still have underscores instead of dashes) — e.g., + http-parser instead of + http_parser. If there are multiple versions of a package, this should be reflected in the variable names in all-packages.nix, - e.g. hello_0_3 and hello_0_4. + e.g. json-c-0-9 and json-c-0-11. If there is an obvious “default” version, make an attribute like - hello = hello_0_4;. + json-c = json-c-0-9;. + See also @@ -288,7 +286,7 @@ dashes between words — not in camel case. For instance, it should be allPackages.nix or AllPackages.nix. -
Hierachy +
Hierarchy Each package should be stored in its own directory somewhere in the pkgs/ tree, i.e. in @@ -567,7 +565,7 @@ splitting up an existing category.
-
Versioning +
Versioning Because every version of a package in Nixpkgs creates a potential maintenance burden, old versions of a package should not be