diff --git a/doc/coding-conventions.xml b/doc/coding-conventions.xml index 0776e70f14e1..ec81c968e4a4 100644 --- a/doc/coding-conventions.xml +++ b/doc/coding-conventions.xml @@ -18,9 +18,9 @@ tab settings so it’s asking for trouble. Use lowerCamelCase for variable - names, not UpperCamelCase. TODO: naming of - attributes in - all-packages.nix? + names, not UpperCamelCase. Note, this rule does + not apply to package attribute names, which instead follow the rules + in . Function calls with attribute set arguments are written as @@ -220,9 +220,10 @@ args.stdenv.mkDerivation (args // { The variable name used for the instantiated package in all-packages.nix, and when passing it as a - dependency to other functions. This is what Nix expression authors - see. It can also be used when installing using nix-env - -iA. + dependency to other functions. Typically this is called the + package attribute name. This is what Nix + expression authors see. It can also be used when installing using + nix-env -iA. The filename for (the directory containing) the Nix expression. @@ -259,12 +260,12 @@ bound to the variable name e2fsprogs in Also append "unstable" to the name - e.g., "pkgname-unstable-2014-09-23". - 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. + Dashes in the package name should be preserved in + new variable names, rather than converted to underscores or camel + cased — e.g., http-parser instead of + http_parser or httpParser. The + hyphenated style is preferred in all three package + names. If there are multiple versions of a package, this should be reflected in the variable names in diff --git a/nixos/doc/manual/development/option-declarations.xml b/nixos/doc/manual/development/option-declarations.xml index be793152f9ef..ed718c89eb77 100644 --- a/nixos/doc/manual/development/option-declarations.xml +++ b/nixos/doc/manual/development/option-declarations.xml @@ -22,6 +22,15 @@ options = { }; +The attribute names within the name +attribute path must be camel cased in general but should, as an +exception, match the + +package attribute name when referencing a Nixpkgs package. For +example, the option services.nix-serve.bindAddress +references the nix-serve Nixpkgs package. + The function mkOption accepts the following arguments.