about summary refs log tree commit diff
path: root/doc/coding-conventions.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/coding-conventions.xml')
-rw-r--r--doc/coding-conventions.xml306
1 files changed, 70 insertions, 236 deletions
diff --git a/doc/coding-conventions.xml b/doc/coding-conventions.xml
index 48356247a49e..799f1479467a 100644
--- a/doc/coding-conventions.xml
+++ b/doc/coding-conventions.xml
@@ -8,24 +8,17 @@
   <itemizedlist>
    <listitem>
     <para>
-     Use 2 spaces of indentation per indentation level in Nix expressions, 4
-     spaces in shell scripts.
+     Use 2 spaces of indentation per indentation level in Nix expressions, 4 spaces in shell scripts.
     </para>
    </listitem>
    <listitem>
     <para>
-     Do not use tab characters, i.e. configure your editor to use soft tabs.
-     For instance, use <literal>(setq-default indent-tabs-mode nil)</literal>
-     in Emacs. Everybody has different tab settings so it’s asking for
-     trouble.
+     Do not use tab characters, i.e. configure your editor to use soft tabs. For instance, use <literal>(setq-default indent-tabs-mode nil)</literal> in Emacs. Everybody has different tab settings so it’s asking for trouble.
     </para>
    </listitem>
    <listitem>
     <para>
-     Use <literal>lowerCamelCase</literal> for variable names, not
-     <literal>UpperCamelCase</literal>. Note, this rule does not apply to
-     package attribute names, which instead follow the rules in
-     <xref linkend="sec-package-naming"/>.
+     Use <literal>lowerCamelCase</literal> for variable names, not <literal>UpperCamelCase</literal>. Note, this rule does not apply to package attribute names, which instead follow the rules in <xref linkend="sec-package-naming"/>.
     </para>
    </listitem>
    <listitem>
@@ -52,8 +45,7 @@ foo { arg = ...; }
    </listitem>
    <listitem>
     <para>
-     In attribute sets or lists that span multiple lines, the attribute names
-     or list elements should be aligned:
+     In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned:
 <programlisting>
 # A long list.
 list = [
@@ -97,8 +89,7 @@ attrs = { x = 1280; y = 1024; };
    </listitem>
    <listitem>
     <para>
-     Breaking in the middle of a function argument can give hard-to-read code,
-     like
+     Breaking in the middle of a function argument can give hard-to-read code, like
 <programlisting>
 someFunction { x = 1280;
   y = 1024; } otherArg
@@ -123,8 +114,7 @@ in someFunction res otherArg yetAnotherArg
    </listitem>
    <listitem>
     <para>
-     The bodies of functions, asserts, and withs are not indented to prevent a
-     lot of superfluous indentation levels, i.e.
+     The bodies of functions, asserts, and withs are not indented to prevent a lot of superfluous indentation levels, i.e.
 <programlisting>
 { arg1, arg2 }:
 assert system == "i686-linux";
@@ -156,8 +146,7 @@ stdenv.mkDerivation { ...
    </listitem>
    <listitem>
     <para>
-     Functions should list their expected arguments as precisely as possible.
-     That is, write
+     Functions should list their expected arguments as precisely as possible. That is, write
 <programlisting>
 { stdenv, fetchurl, perl }: <replaceable>...</replaceable>
 </programlisting>
@@ -171,9 +160,7 @@ args: with args; <replaceable>...</replaceable>
 </programlisting>
     </para>
     <para>
-     For functions that are truly generic in the number of arguments (such as
-     wrappers around <varname>mkDerivation</varname>) that have some required
-     arguments, you should write them using an <literal>@</literal>-pattern:
+     For functions that are truly generic in the number of arguments (such as wrappers around <varname>mkDerivation</varname>) that have some required arguments, you should write them using an <literal>@</literal>-pattern:
 <programlisting>
 { stdenv, doCoverageAnalysis ? false, ... } @ args:
 
@@ -197,35 +184,20 @@ args.stdenv.mkDerivation (args // {
   <title>Package naming</title>
 
   <para>
-   The key words <emphasis>must</emphasis>, <emphasis>must not</emphasis>,
-   <emphasis>required</emphasis>, <emphasis>shall</emphasis>, <emphasis>shall
-   not</emphasis>, <emphasis>should</emphasis>, <emphasis>should
-   not</emphasis>, <emphasis>recommended</emphasis>, <emphasis>may</emphasis>,
-   and <emphasis>optional</emphasis> in this section are to be interpreted as
-   described in <link xlink:href="https://tools.ietf.org/html/rfc2119">RFC
-   2119</link>. Only <emphasis>emphasized</emphasis> words are to be
-   interpreted in this way.
+   The key words <emphasis>must</emphasis>, <emphasis>must not</emphasis>, <emphasis>required</emphasis>, <emphasis>shall</emphasis>, <emphasis>shall not</emphasis>, <emphasis>should</emphasis>, <emphasis>should not</emphasis>, <emphasis>recommended</emphasis>, <emphasis>may</emphasis>, and <emphasis>optional</emphasis> in this section are to be interpreted as described in <link xlink:href="https://tools.ietf.org/html/rfc2119">RFC 2119</link>. Only <emphasis>emphasized</emphasis> words are to be interpreted in this way.
   </para>
 
   <para>
-   In Nixpkgs, there are generally three different names associated with a
-   package:
+   In Nixpkgs, there are generally three different names associated with a package:
    <itemizedlist>
     <listitem>
      <para>
-      The <varname>name</varname> attribute of the derivation (excluding the
-      version part). This is what most users see, in particular when using
-      <command>nix-env</command>.
+      The <varname>name</varname> attribute of the derivation (excluding the version part). This is what most users see, in particular when using <command>nix-env</command>.
      </para>
     </listitem>
     <listitem>
      <para>
-      The variable name used for the instantiated package in
-      <filename>all-packages.nix</filename>, and when passing it as a
-      dependency to other functions. Typically this is called the
-      <emphasis>package attribute name</emphasis>. This is what Nix expression
-      authors see. It can also be used when installing using <command>nix-env
-      -iA</command>.
+      The variable name used for the instantiated package in <filename>all-packages.nix</filename>, and when passing it as a dependency to other functions. Typically this is called the <emphasis>package attribute name</emphasis>. This is what Nix expression authors see. It can also be used when installing using <command>nix-env -iA</command>.
      </para>
     </listitem>
     <listitem>
@@ -234,12 +206,7 @@ args.stdenv.mkDerivation (args // {
      </para>
     </listitem>
    </itemizedlist>
-   Most of the time, these are the same. For instance, the package
-   <literal>e2fsprogs</literal> has a <varname>name</varname> attribute
-   <literal>"e2fsprogs-<replaceable>version</replaceable>"</literal>, is bound
-   to the variable name <varname>e2fsprogs</varname> in
-   <filename>all-packages.nix</filename>, and the Nix expression is in
-   <filename>pkgs/os-specific/linux/e2fsprogs/default.nix</filename>.
+   Most of the time, these are the same. For instance, the package <literal>e2fsprogs</literal> has a <varname>name</varname> attribute <literal>"e2fsprogs-<replaceable>version</replaceable>"</literal>, is bound to the variable name <varname>e2fsprogs</varname> in <filename>all-packages.nix</filename>, and the Nix expression is in <filename>pkgs/os-specific/linux/e2fsprogs/default.nix</filename>.
   </para>
 
   <para>
@@ -247,51 +214,32 @@ args.stdenv.mkDerivation (args // {
    <itemizedlist>
     <listitem>
      <para>
-      The <literal>name</literal> attribute <emphasis>should</emphasis> be
-      identical to the upstream package name.
+      The <literal>name</literal> attribute <emphasis>should</emphasis> be identical to the upstream package name.
      </para>
     </listitem>
     <listitem>
      <para>
-      The <literal>name</literal> attribute <emphasis>must not</emphasis>
-      contain uppercase letters — e.g., <literal>"mplayer-1.0rc2"</literal>
-      instead of <literal>"MPlayer-1.0rc2"</literal>.
+      The <literal>name</literal> attribute <emphasis>must not</emphasis> contain uppercase letters — e.g., <literal>"mplayer-1.0rc2"</literal> instead of <literal>"MPlayer-1.0rc2"</literal>.
      </para>
     </listitem>
     <listitem>
      <para>
-      The version part of the <literal>name</literal> attribute
-      <emphasis>must</emphasis> start with a digit (following a dash) — e.g.,
-      <literal>"hello-0.3.1rc2"</literal>.
+      The version part of the <literal>name</literal> attribute <emphasis>must</emphasis> start with a digit (following a dash) — e.g., <literal>"hello-0.3.1rc2"</literal>.
      </para>
     </listitem>
     <listitem>
      <para>
-      If a package is not a release but a commit from a repository, then the
-      version part of the name <emphasis>must</emphasis> be the date of that
-      (fetched) commit. The date <emphasis>must</emphasis> be in
-      <literal>"YYYY-MM-DD"</literal> format. Also append
-      <literal>"unstable"</literal> to the name - e.g.,
-      <literal>"pkgname-unstable-2014-09-23"</literal>.
+      If a package is not a release but a commit from a repository, then the version part of the name <emphasis>must</emphasis> be the date of that (fetched) commit. The date <emphasis>must</emphasis> be in <literal>"YYYY-MM-DD"</literal> format. Also append <literal>"unstable"</literal> to the name - e.g., <literal>"pkgname-unstable-2014-09-23"</literal>.
      </para>
     </listitem>
     <listitem>
      <para>
-      Dashes in the package name <emphasis>should</emphasis> be preserved in
-      new variable names, rather than converted to underscores or camel cased
-      — e.g., <varname>http-parser</varname> instead of
-      <varname>http_parser</varname> or <varname>httpParser</varname>. The
-      hyphenated style is preferred in all three package names.
+      Dashes in the package name <emphasis>should</emphasis> be preserved in new variable names, rather than converted to underscores or camel cased — e.g., <varname>http-parser</varname> instead of <varname>http_parser</varname> or <varname>httpParser</varname>. The hyphenated style is preferred in all three package names.
      </para>
     </listitem>
     <listitem>
      <para>
-      If there are multiple versions of a package, this
-      <emphasis>should</emphasis> be reflected in the variable names in
-      <filename>all-packages.nix</filename>, e.g. <varname>json-c-0-9</varname>
-      and <varname>json-c-0-11</varname>. If there is an obvious “default”
-      version, make an attribute like <literal>json-c = json-c-0-9;</literal>.
-      See also <xref linkend="sec-versioning" />
+      If there are multiple versions of a package, this <emphasis>should</emphasis> be reflected in the variable names in <filename>all-packages.nix</filename>, e.g. <varname>json-c-0-9</varname> and <varname>json-c-0-11</varname>. If there is an obvious “default” version, make an attribute like <literal>json-c = json-c-0-9;</literal>. See also <xref linkend="sec-versioning" />
      </para>
     </listitem>
    </itemizedlist>
@@ -301,31 +249,18 @@ args.stdenv.mkDerivation (args // {
   <title>File naming and organisation</title>
 
   <para>
-   Names of files and directories should be in lowercase, with dashes between
-   words — not in camel case. For instance, it should be
-   <filename>all-packages.nix</filename>, not
-   <filename>allPackages.nix</filename> or
-   <filename>AllPackages.nix</filename>.
+   Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be <filename>all-packages.nix</filename>, not <filename>allPackages.nix</filename> or <filename>AllPackages.nix</filename>.
   </para>
 
   <section xml:id="sec-hierarchy">
    <title>Hierarchy</title>
 
    <para>
-    Each package should be stored in its own directory somewhere in the
-    <filename>pkgs/</filename> tree, i.e. in
-    <filename>pkgs/<replaceable>category</replaceable>/<replaceable>subcategory</replaceable>/<replaceable>...</replaceable>/<replaceable>pkgname</replaceable></filename>.
-    Below are some rules for picking the right category for a package. Many
-    packages fall under several categories; what matters is the
-    <emphasis>primary</emphasis> purpose of a package. For example, the
-    <literal>libxml2</literal> package builds both a library and some tools;
-    but it’s a library foremost, so it goes under
-    <filename>pkgs/development/libraries</filename>.
+    Each package should be stored in its own directory somewhere in the <filename>pkgs/</filename> tree, i.e. in <filename>pkgs/<replaceable>category</replaceable>/<replaceable>subcategory</replaceable>/<replaceable>...</replaceable>/<replaceable>pkgname</replaceable></filename>. Below are some rules for picking the right category for a package. Many packages fall under several categories; what matters is the <emphasis>primary</emphasis> purpose of a package. For example, the <literal>libxml2</literal> package builds both a library and some tools; but it’s a library foremost, so it goes under <filename>pkgs/development/libraries</filename>.
    </para>
 
    <para>
-    When in doubt, consider refactoring the <filename>pkgs/</filename> tree,
-    e.g. creating new categories or splitting up an existing category.
+    When in doubt, consider refactoring the <filename>pkgs/</filename> tree, e.g. creating new categories or splitting up an existing category.
    </para>
 
    <variablelist>
@@ -341,8 +276,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>development/libraries</filename> (e.g.
-          <filename>libxml2</filename>)
+          <filename>development/libraries</filename> (e.g. <filename>libxml2</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -352,8 +286,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>development/compilers</filename> (e.g.
-          <filename>gcc</filename>)
+          <filename>development/compilers</filename> (e.g. <filename>gcc</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -363,8 +296,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>development/interpreters</filename> (e.g.
-          <filename>guile</filename>)
+          <filename>development/interpreters</filename> (e.g. <filename>guile</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -380,8 +312,7 @@ args.stdenv.mkDerivation (args // {
            </term>
            <listitem>
             <para>
-             <filename>development/tools/parsing</filename> (e.g.
-             <filename>bison</filename>, <filename>flex</filename>)
+             <filename>development/tools/parsing</filename> (e.g. <filename>bison</filename>, <filename>flex</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -391,8 +322,7 @@ args.stdenv.mkDerivation (args // {
            </term>
            <listitem>
             <para>
-             <filename>development/tools/build-managers</filename> (e.g.
-             <filename>gnumake</filename>)
+             <filename>development/tools/build-managers</filename> (e.g. <filename>gnumake</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -402,8 +332,7 @@ args.stdenv.mkDerivation (args // {
            </term>
            <listitem>
             <para>
-             <filename>development/tools/misc</filename> (e.g.
-             <filename>binutils</filename>)
+             <filename>development/tools/misc</filename> (e.g. <filename>binutils</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -429,8 +358,7 @@ args.stdenv.mkDerivation (args // {
      </term>
      <listitem>
       <para>
-       (A tool is a relatively small program, especially one intended to be
-       used non-interactively.)
+       (A tool is a relatively small program, especially one intended to be used non-interactively.)
       </para>
       <variablelist>
        <varlistentry>
@@ -439,8 +367,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>tools/networking</filename> (e.g.
-          <filename>wget</filename>)
+          <filename>tools/networking</filename> (e.g. <filename>wget</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -470,8 +397,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>tools/archivers</filename> (e.g. <filename>zip</filename>,
-          <filename>tar</filename>)
+          <filename>tools/archivers</filename> (e.g. <filename>zip</filename>, <filename>tar</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -481,8 +407,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>tools/compression</filename> (e.g.
-          <filename>gzip</filename>, <filename>bzip2</filename>)
+          <filename>tools/compression</filename> (e.g. <filename>gzip</filename>, <filename>bzip2</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -492,8 +417,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>tools/security</filename> (e.g. <filename>nmap</filename>,
-          <filename>gnupg</filename>)
+          <filename>tools/security</filename> (e.g. <filename>nmap</filename>, <filename>gnupg</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -532,8 +456,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>servers/http</filename> (e.g.
-          <filename>apache-httpd</filename>)
+          <filename>servers/http</filename> (e.g. <filename>apache-httpd</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -543,8 +466,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>servers/x11</filename> (e.g. <filename>xorg</filename> —
-          this includes the client libraries and programs)
+          <filename>servers/x11</filename> (e.g. <filename>xorg</filename> — this includes the client libraries and programs)
          </para>
         </listitem>
        </varlistentry>
@@ -567,8 +489,7 @@ args.stdenv.mkDerivation (args // {
      </term>
      <listitem>
       <para>
-       <filename>desktops</filename> (e.g. <filename>kde</filename>,
-       <filename>gnome</filename>, <filename>enlightenment</filename>)
+       <filename>desktops</filename> (e.g. <filename>kde</filename>, <filename>gnome</filename>, <filename>enlightenment</filename>)
       </para>
      </listitem>
     </varlistentry>
@@ -578,8 +499,7 @@ args.stdenv.mkDerivation (args // {
      </term>
      <listitem>
       <para>
-       <filename>applications/window-managers</filename> (e.g.
-       <filename>awesome</filename>, <filename>stumpwm</filename>)
+       <filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>stumpwm</filename>)
       </para>
      </listitem>
     </varlistentry>
@@ -589,8 +509,7 @@ args.stdenv.mkDerivation (args // {
      </term>
      <listitem>
       <para>
-       A (typically large) program with a distinct user interface, primarily
-       used interactively.
+       A (typically large) program with a distinct user interface, primarily used interactively.
       </para>
       <variablelist>
        <varlistentry>
@@ -599,8 +518,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>applications/version-management</filename> (e.g.
-          <filename>subversion</filename>)
+          <filename>applications/version-management</filename> (e.g. <filename>subversion</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -610,8 +528,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>applications/video</filename> (e.g.
-          <filename>vlc</filename>)
+          <filename>applications/video</filename> (e.g. <filename>vlc</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -621,8 +538,7 @@ args.stdenv.mkDerivation (args // {
         </term>
         <listitem>
          <para>
-          <filename>applications/graphics</filename> (e.g.
-          <filename>gimp</filename>)
+          <filename>applications/graphics</filename> (e.g. <filename>gimp</filename>)
          </para>
         </listitem>
        </varlistentry>
@@ -638,8 +554,7 @@ args.stdenv.mkDerivation (args // {
            </term>
            <listitem>
             <para>
-             <filename>applications/networking/mailreaders</filename> (e.g.
-             <filename>thunderbird</filename>)
+             <filename>applications/networking/mailreaders</filename> (e.g. <filename>thunderbird</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -649,8 +564,7 @@ args.stdenv.mkDerivation (args // {
            </term>
            <listitem>
             <para>
-             <filename>applications/networking/newsreaders</filename> (e.g.
-             <filename>pan</filename>)
+             <filename>applications/networking/newsreaders</filename> (e.g. <filename>pan</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -660,8 +574,7 @@ args.stdenv.mkDerivation (args // {
            </term>
            <listitem>
             <para>
-             <filename>applications/networking/browsers</filename> (e.g.
-             <filename>firefox</filename>)
+             <filename>applications/networking/browsers</filename> (e.g. <filename>firefox</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -719,8 +632,7 @@ args.stdenv.mkDerivation (args // {
            </term>
            <listitem>
             <para>
-             <filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g.
-             <filename>docbook</filename>)
+             <filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g. <filename>docbook</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -733,8 +645,7 @@ args.stdenv.mkDerivation (args // {
              (Okay, these are executable...)
             </para>
             <para>
-             <filename>data/sgml+xml/stylesheets/xslt</filename> (e.g.
-             <filename>docbook-xsl</filename>)
+             <filename>data/sgml+xml/stylesheets/xslt</filename> (e.g. <filename>docbook-xsl</filename>)
             </para>
            </listitem>
           </varlistentry>
@@ -771,36 +682,15 @@ args.stdenv.mkDerivation (args // {
    <title>Versioning</title>
 
    <para>
-    Because every version of a package in Nixpkgs creates a potential
-    maintenance burden, old versions of a package should not be kept unless
-    there is a good reason to do so. For instance, Nixpkgs contains several
-    versions of GCC because other packages don’t build with the latest
-    version of GCC. Other examples are having both the latest stable and latest
-    pre-release version of a package, or to keep several major releases of an
-    application that differ significantly in functionality.
+    Because every version of a package in Nixpkgs creates a potential maintenance burden, old versions of a package should not be kept unless there is a good reason to do so. For instance, Nixpkgs contains several versions of GCC because other packages don’t build with the latest version of GCC. Other examples are having both the latest stable and latest pre-release version of a package, or to keep several major releases of an application that differ significantly in functionality.
    </para>
 
    <para>
-    If there is only one version of a package, its Nix expression should be
-    named <filename>e2fsprogs/default.nix</filename>. If there are multiple
-    versions, this should be reflected in the filename, e.g.
-    <filename>e2fsprogs/1.41.8.nix</filename> and
-    <filename>e2fsprogs/1.41.9.nix</filename>. The version in the filename
-    should leave out unnecessary detail. For instance, if we keep the latest
-    Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named
-    <filename>firefox/2.0.nix</filename> and
-    <filename>firefox/3.5.nix</filename>, respectively (which, at a given
-    point, might contain versions <literal>2.0.0.20</literal> and
-    <literal>3.5.4</literal>). If a version requires many auxiliary files, you
-    can use a subdirectory for each version, e.g.
-    <filename>firefox/2.0/default.nix</filename> and
-    <filename>firefox/3.5/default.nix</filename>.
+    If there is only one version of a package, its Nix expression should be named <filename>e2fsprogs/default.nix</filename>. If there are multiple versions, this should be reflected in the filename, e.g. <filename>e2fsprogs/1.41.8.nix</filename> and <filename>e2fsprogs/1.41.9.nix</filename>. The version in the filename should leave out unnecessary detail. For instance, if we keep the latest Firefox 2.0.x and 3.5.x versions in Nixpkgs, they should be named <filename>firefox/2.0.nix</filename> and <filename>firefox/3.5.nix</filename>, respectively (which, at a given point, might contain versions <literal>2.0.0.20</literal> and <literal>3.5.4</literal>). If a version requires many auxiliary files, you can use a subdirectory for each version, e.g. <filename>firefox/2.0/default.nix</filename> and <filename>firefox/3.5/default.nix</filename>.
    </para>
 
    <para>
-    All versions of a package <emphasis>must</emphasis> be included in
-    <filename>all-packages.nix</filename> to make sure that they evaluate
-    correctly.
+    All versions of a package <emphasis>must</emphasis> be included in <filename>all-packages.nix</filename> to make sure that they evaluate correctly.
    </para>
   </section>
  </section>
@@ -808,25 +698,15 @@ args.stdenv.mkDerivation (args // {
   <title>Fetching Sources</title>
 
   <para>
-   There are multiple ways to fetch a package source in nixpkgs. The general
-   guideline is that you should package reproducible sources with a high degree
-   of availability. Right now there is only one fetcher which has mirroring
-   support and that is <literal>fetchurl</literal>. Note that you should also
-   prefer protocols which have a corresponding proxy environment variable.
+   There are multiple ways to fetch a package source in nixpkgs. The general guideline is that you should package reproducible sources with a high degree of availability. Right now there is only one fetcher which has mirroring support and that is <literal>fetchurl</literal>. Note that you should also prefer protocols which have a corresponding proxy environment variable.
   </para>
 
   <para>
-   You can find many source fetch helpers in
-   <literal>pkgs/build-support/fetch*</literal>.
+   You can find many source fetch helpers in <literal>pkgs/build-support/fetch*</literal>.
   </para>
 
   <para>
-   In the file <literal>pkgs/top-level/all-packages.nix</literal> you can find
-   fetch helpers, these have names on the form <literal>fetchFrom*</literal>.
-   The intention of these are to provide snapshot fetches but using the same
-   api as some of the version controlled fetchers from
-   <literal>pkgs/build-support/</literal>. As an example going from bad to
-   good:
+   In the file <literal>pkgs/top-level/all-packages.nix</literal> you can find fetch helpers, these have names on the form <literal>fetchFrom*</literal>. The intention of these are to provide snapshot fetches but using the same api as some of the version controlled fetchers from <literal>pkgs/build-support/</literal>. As an example going from bad to good:
    <itemizedlist>
     <listitem>
      <para>
@@ -863,11 +743,7 @@ src = fetchFromGitHub {
   sha256 = "1i2yxndxb6yc9l6c99pypbd92lfq5aac4klq7y2v93c9qvx2cgpc";
 }
 </programlisting>
-      Find the value to put as <literal>sha256</literal> by running
-      <literal>nix run -f '&lt;nixpkgs&gt;' nix-prefetch-github -c
-      nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS
-      nix</literal> or <literal>nix-prefetch-url --unpack
-      https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz</literal>.
+      Find the value to put as <literal>sha256</literal> by running <literal>nix run -f '&lt;nixpkgs&gt;' nix-prefetch-github -c nix-prefetch-github --rev 1f795f9f44607cc5bec70d1300150bfefcef2aae NixOS nix</literal> or <literal>nix-prefetch-url --unpack https://github.com/NixOS/nix/archive/1f795f9f44607cc5bec70d1300150bfefcef2aae.tar.gz</literal>.
      </para>
     </listitem>
    </itemizedlist>
@@ -883,40 +759,23 @@ src = fetchFromGitHub {
   <orderedlist>
    <listitem>
     <para>
-     Prefetch URL (with <literal>nix-prefetch-<replaceable>XXX</replaceable>
-     <replaceable>URL</replaceable></literal>, where
-     <replaceable>XXX</replaceable> is one of <literal>url</literal>,
-     <literal>git</literal>, <literal>hg</literal>, <literal>cvs</literal>,
-     <literal>bzr</literal>, <literal>svn</literal>). Hash is printed to
-     stdout.
+     Prefetch URL (with <literal>nix-prefetch-<replaceable>XXX</replaceable> <replaceable>URL</replaceable></literal>, where <replaceable>XXX</replaceable> is one of <literal>url</literal>, <literal>git</literal>, <literal>hg</literal>, <literal>cvs</literal>, <literal>bzr</literal>, <literal>svn</literal>). Hash is printed to stdout.
     </para>
    </listitem>
    <listitem>
     <para>
-     Prefetch by package source (with <literal>nix-prefetch-url
-     '&lt;nixpkgs&gt;' -A <replaceable>PACKAGE</replaceable>.src</literal>,
-     where <replaceable>PACKAGE</replaceable> is package attribute name). Hash
-     is printed to stdout.
+     Prefetch by package source (with <literal>nix-prefetch-url '&lt;nixpkgs&gt;' -A <replaceable>PACKAGE</replaceable>.src</literal>, where <replaceable>PACKAGE</replaceable> is package attribute name). Hash is printed to stdout.
     </para>
     <para>
-     This works well when you've upgraded existing package version and want to
-     find out new hash, but is useless if package can't be accessed by
-     attribute or package has multiple sources (<literal>.srcs</literal>,
-     architecture-dependent sources, etc).
+     This works well when you've upgraded existing package version and want to find out new hash, but is useless if package can't be accessed by attribute or package has multiple sources (<literal>.srcs</literal>, architecture-dependent sources, etc).
     </para>
    </listitem>
    <listitem>
     <para>
-     Upstream provided hash: use it when upstream provides
-     <literal>sha256</literal> or <literal>sha512</literal> (when upstream
-     provides <literal>md5</literal>, don't use it, compute
-     <literal>sha256</literal> instead).
+     Upstream provided hash: use it when upstream provides <literal>sha256</literal> or <literal>sha512</literal> (when upstream provides <literal>md5</literal>, don't use it, compute <literal>sha256</literal> instead).
     </para>
     <para>
-     A little nuance is that <literal>nix-prefetch-*</literal> tools produce
-     hash encoded with <literal>base32</literal>, but upstream usually provides
-     hexadecimal (<literal>base16</literal>) encoding. Fetchers understand both
-     formats. Nixpkgs does not standardize on any one format.
+     A little nuance is that <literal>nix-prefetch-*</literal> tools produce hash encoded with <literal>base32</literal>, but upstream usually provides hexadecimal (<literal>base16</literal>) encoding. Fetchers understand both formats. Nixpkgs does not standardize on any one format.
     </para>
     <para>
      You can convert between formats with nix-hash, for example:
@@ -927,28 +786,18 @@ src = fetchFromGitHub {
    </listitem>
    <listitem>
     <para>
-     Extracting hash from local source tarball can be done with
-     <literal>sha256sum</literal>. Use <literal>nix-prefetch-url
-     file:///path/to/tarball </literal> if you want base32 hash.
+     Extracting hash from local source tarball can be done with <literal>sha256sum</literal>. Use <literal>nix-prefetch-url file:///path/to/tarball </literal> if you want base32 hash.
     </para>
    </listitem>
    <listitem>
     <para>
-     Fake hash: set fake hash in package expression, perform build and extract
-     correct hash from error Nix prints.
+     Fake hash: set fake hash in package expression, perform build and extract correct hash from error Nix prints.
     </para>
     <para>
-     For package updates it is enough to change one symbol to make hash fake.
-     For new packages, you can use <literal>lib.fakeSha256</literal>,
-     <literal>lib.fakeSha512</literal> or any other fake hash.
+     For package updates it is enough to change one symbol to make hash fake. For new packages, you can use <literal>lib.fakeSha256</literal>, <literal>lib.fakeSha512</literal> or any other fake hash.
     </para>
     <para>
-     This is last resort method when reconstructing source URL is non-trivial
-     and <literal>nix-prefetch-url -A</literal> isn't applicable (for example,
-     <link xlink:href="https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73">
-     one of <literal>kodi</literal> dependencies</link>). The easiest way then
-     would be replace hash with a fake one and rebuild. Nix build will fail and
-     error message will contain desired hash.
+     This is last resort method when reconstructing source URL is non-trivial and <literal>nix-prefetch-url -A</literal> isn't applicable (for example, <link xlink:href="https://github.com/NixOS/nixpkgs/blob/d2ab091dd308b99e4912b805a5eb088dd536adb9/pkgs/applications/video/kodi/default.nix#L73"> one of <literal>kodi</literal> dependencies</link>). The easiest way then would be replace hash with a fake one and rebuild. Nix build will fail and error message will contain desired hash.
     </para>
     <warning>
      <para>
@@ -962,9 +811,7 @@ src = fetchFromGitHub {
    <title>Obtaining hashes securely</title>
 
    <para>
-    Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead
-    of fetching source you can fetch malware, and instead of source hash you
-    get hash of malware. Here are security considerations for this scenario:
+    Let's say Man-in-the-Middle (MITM) sits close to your network. Then instead of fetching source you can fetch malware, and instead of source hash you get hash of malware. Here are security considerations for this scenario:
    </para>
 
    <itemizedlist>
@@ -975,8 +822,7 @@ src = fetchFromGitHub {
     </listitem>
     <listitem>
      <para>
-      hashes from upstream (in method 3) should be obtained via secure
-      protocol;
+      hashes from upstream (in method 3) should be obtained via secure protocol;
      </para>
     </listitem>
     <listitem>
@@ -986,12 +832,7 @@ src = fetchFromGitHub {
     </listitem>
     <listitem>
      <para>
-      <literal>https://</literal> URLs are not secure in method 5. When
-      obtaining hashes with fake hash method, TLS checks are disabled. So
-      refetch source hash from several different networks to exclude MITM
-      scenario. Alternatively, use fake hash method to make Nix error, but
-      instead of extracting hash from error, extract
-      <literal>https://</literal> URL and prefetch it with method 1.
+      <literal>https://</literal> URLs are not secure in method 5. When obtaining hashes with fake hash method, TLS checks are disabled. So refetch source hash from several different networks to exclude MITM scenario. Alternatively, use fake hash method to make Nix error, but instead of extracting hash from error, extract <literal>https://</literal> URL and prefetch it with method 1.
      </para>
     </listitem>
    </itemizedlist>
@@ -1001,8 +842,7 @@ src = fetchFromGitHub {
   <title>Patches</title>
 
   <para>
-   Patches available online should be retrieved using
-   <literal>fetchpatch</literal>.
+   Patches available online should be retrieved using <literal>fetchpatch</literal>.
   </para>
 
   <para>
@@ -1018,10 +858,7 @@ patches = [
   </para>
 
   <para>
-   Otherwise, you can add a <literal>.patch</literal> file to the
-   <literal>nixpkgs</literal> repository. In the interest of keeping our
-   maintenance burden to a minimum, only patches that are unique to
-   <literal>nixpkgs</literal> should be added in this way.
+   Otherwise, you can add a <literal>.patch</literal> file to the <literal>nixpkgs</literal> repository. In the interest of keeping our maintenance burden to a minimum, only patches that are unique to <literal>nixpkgs</literal> should be added in this way.
   </para>
 
   <para>
@@ -1031,8 +868,7 @@ patches = [ ./0001-changes.patch ];
   </para>
 
   <para>
-   If you do need to do create this sort of patch file, one way to do so is
-   with git:
+   If you do need to do create this sort of patch file, one way to do so is with git:
    <orderedlist>
     <listitem>
      <para>
@@ -1043,8 +879,7 @@ patches = [ ./0001-changes.patch ];
     </listitem>
     <listitem>
      <para>
-      If a git repository is not already present, create one and stage all of
-      the source files.
+      If a git repository is not already present, create one and stage all of the source files.
 <screen>
 <prompt>$ </prompt>git init
 <prompt>$ </prompt>git add .</screen>
@@ -1052,8 +887,7 @@ patches = [ ./0001-changes.patch ];
     </listitem>
     <listitem>
      <para>
-      Edit some files to make whatever changes need to be included in the
-      patch.
+      Edit some files to make whatever changes need to be included in the patch.
      </para>
     </listitem>
     <listitem>