summary refs log tree commit diff
path: root/doc/contributing
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-10-30 10:27:47 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2019-10-30 11:17:14 +0100
commitddbf4c1bac20f6061d4b42a901545eaf345067df (patch)
tree2225c6b5eda9154f9eb54794585763938686ea31 /doc/contributing
parenta861855dfb858883f6b8ea297218fa393fc788da (diff)
downloadnixpkgs-ddbf4c1bac20f6061d4b42a901545eaf345067df.tar
nixpkgs-ddbf4c1bac20f6061d4b42a901545eaf345067df.tar.gz
nixpkgs-ddbf4c1bac20f6061d4b42a901545eaf345067df.tar.bz2
nixpkgs-ddbf4c1bac20f6061d4b42a901545eaf345067df.tar.lz
nixpkgs-ddbf4c1bac20f6061d4b42a901545eaf345067df.tar.xz
nixpkgs-ddbf4c1bac20f6061d4b42a901545eaf345067df.tar.zst
nixpkgs-ddbf4c1bac20f6061d4b42a901545eaf345067df.zip
nixpkgs manual: move contributing chapters into one folder
Diffstat (limited to 'doc/contributing')
-rw-r--r--doc/contributing/coding-conventions.xml903
-rw-r--r--doc/contributing/contributing-to-documentation.xml30
-rw-r--r--doc/contributing/quick-start.xml153
-rw-r--r--doc/contributing/reviewing-contributions.xml536
-rw-r--r--doc/contributing/submitting-changes.xml429
5 files changed, 2051 insertions, 0 deletions
diff --git a/doc/contributing/coding-conventions.xml b/doc/contributing/coding-conventions.xml
new file mode 100644
index 00000000000..799f1479467
--- /dev/null
+++ b/doc/contributing/coding-conventions.xml
@@ -0,0 +1,903 @@
+<chapter xmlns="http://docbook.org/ns/docbook"
+         xmlns:xlink="http://www.w3.org/1999/xlink"
+         xml:id="chap-conventions">
+ <title>Coding conventions</title>
+ <section xml:id="sec-syntax">
+  <title>Syntax</title>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     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.
+    </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"/>.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Function calls with attribute set arguments are written as
+<programlisting>
+foo {
+  arg = ...;
+}
+</programlisting>
+     not
+<programlisting>
+foo
+{
+  arg = ...;
+}
+</programlisting>
+     Also fine is
+<programlisting>
+foo { arg = ...; }
+</programlisting>
+     if it's a short call.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     In attribute sets or lists that span multiple lines, the attribute names or list elements should be aligned:
+<programlisting>
+# A long list.
+list = [
+  elem1
+  elem2
+  elem3
+];
+
+# A long attribute set.
+attrs = {
+  attr1 = short_expr;
+  attr2 =
+    if true then big_expr else big_expr;
+};
+
+# Combined
+listOfAttrs = [
+  {
+    attr1 = 3;
+    attr2 = "fff";
+  }
+  {
+    attr1 = 5;
+    attr2 = "ggg";
+  }
+];
+</programlisting>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Short lists or attribute sets can be written on one line:
+<programlisting>
+# A short list.
+list = [ elem1 elem2 elem3 ];
+
+# A short set.
+attrs = { x = 1280; y = 1024; };
+</programlisting>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Breaking in the middle of a function argument can give hard-to-read code, like
+<programlisting>
+someFunction { x = 1280;
+  y = 1024; } otherArg
+  yetAnotherArg
+</programlisting>
+     (especially if the argument is very large, spanning multiple lines).
+    </para>
+    <para>
+     Better:
+<programlisting>
+someFunction
+  { x = 1280; y = 1024; }
+  otherArg
+  yetAnotherArg
+</programlisting>
+     or
+<programlisting>
+let res = { x = 1280; y = 1024; };
+in someFunction res otherArg yetAnotherArg
+</programlisting>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     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";
+stdenv.mkDerivation { ...
+</programlisting>
+     not
+<programlisting>
+{ arg1, arg2 }:
+  assert system == "i686-linux";
+    stdenv.mkDerivation { ...
+</programlisting>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Function formal arguments are written as:
+<programlisting>
+{ arg1, arg2, arg3 }:
+</programlisting>
+     but if they don't fit on one line they're written as:
+<programlisting>
+{ arg1, arg2, arg3
+, arg4, ...
+, # Some comment...
+  argN
+}:
+</programlisting>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Functions should list their expected arguments as precisely as possible. That is, write
+<programlisting>
+{ stdenv, fetchurl, perl }: <replaceable>...</replaceable>
+</programlisting>
+     instead of
+<programlisting>
+args: with args; <replaceable>...</replaceable>
+</programlisting>
+     or
+<programlisting>
+{ stdenv, fetchurl, perl, ... }: <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:
+<programlisting>
+{ stdenv, doCoverageAnalysis ? false, ... } @ args:
+
+stdenv.mkDerivation (args // {
+  <replaceable>...</replaceable> if doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable>
+})
+</programlisting>
+     instead of
+<programlisting>
+args:
+
+args.stdenv.mkDerivation (args // {
+  <replaceable>...</replaceable> if args ? doCoverageAnalysis &amp;&amp; args.doCoverageAnalysis then "bla" else "" <replaceable>...</replaceable>
+})
+</programlisting>
+    </para>
+   </listitem>
+  </itemizedlist>
+ </section>
+ <section xml:id="sec-package-naming">
+  <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.
+  </para>
+
+  <para>
+   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>.
+     </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>.
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      The filename for (the directory containing) the Nix expression.
+     </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>.
+  </para>
+
+  <para>
+   There are a few naming guidelines:
+   <itemizedlist>
+    <listitem>
+     <para>
+      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>.
+     </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>.
+     </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>.
+     </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.
+     </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" />
+     </para>
+    </listitem>
+   </itemizedlist>
+  </para>
+ </section>
+ <section xml:id="sec-organisation">
+  <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>.
+  </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>.
+   </para>
+
+   <para>
+    When in doubt, consider refactoring the <filename>pkgs/</filename> tree, e.g. creating new categories or splitting up an existing category.
+   </para>
+
+   <variablelist>
+    <varlistentry>
+     <term>
+      If it’s used to support <emphasis>software development</emphasis>:
+     </term>
+     <listitem>
+      <variablelist>
+       <varlistentry>
+        <term>
+         If it’s a <emphasis>library</emphasis> used by other packages:
+        </term>
+        <listitem>
+         <para>
+          <filename>development/libraries</filename> (e.g. <filename>libxml2</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s a <emphasis>compiler</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>development/compilers</filename> (e.g. <filename>gcc</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s an <emphasis>interpreter</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>development/interpreters</filename> (e.g. <filename>guile</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s a (set of) development <emphasis>tool(s)</emphasis>:
+        </term>
+        <listitem>
+         <variablelist>
+          <varlistentry>
+           <term>
+            If it’s a <emphasis>parser generator</emphasis> (including lexers):
+           </term>
+           <listitem>
+            <para>
+             <filename>development/tools/parsing</filename> (e.g. <filename>bison</filename>, <filename>flex</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+          <varlistentry>
+           <term>
+            If it’s a <emphasis>build manager</emphasis>:
+           </term>
+           <listitem>
+            <para>
+             <filename>development/tools/build-managers</filename> (e.g. <filename>gnumake</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+          <varlistentry>
+           <term>
+            Else:
+           </term>
+           <listitem>
+            <para>
+             <filename>development/tools/misc</filename> (e.g. <filename>binutils</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+         </variablelist>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         Else:
+        </term>
+        <listitem>
+         <para>
+          <filename>development/misc</filename>
+         </para>
+        </listitem>
+       </varlistentry>
+      </variablelist>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s a (set of) <emphasis>tool(s)</emphasis>:
+     </term>
+     <listitem>
+      <para>
+       (A tool is a relatively small program, especially one intended to be used non-interactively.)
+      </para>
+      <variablelist>
+       <varlistentry>
+        <term>
+         If it’s for <emphasis>networking</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>tools/networking</filename> (e.g. <filename>wget</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s for <emphasis>text processing</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>tools/text</filename> (e.g. <filename>diffutils</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s a <emphasis>system utility</emphasis>, i.e., something related or essential to the operation of a system:
+        </term>
+        <listitem>
+         <para>
+          <filename>tools/system</filename> (e.g. <filename>cron</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s an <emphasis>archiver</emphasis> (which may include a compression function):
+        </term>
+        <listitem>
+         <para>
+          <filename>tools/archivers</filename> (e.g. <filename>zip</filename>, <filename>tar</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s a <emphasis>compression</emphasis> program:
+        </term>
+        <listitem>
+         <para>
+          <filename>tools/compression</filename> (e.g. <filename>gzip</filename>, <filename>bzip2</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s a <emphasis>security</emphasis>-related program:
+        </term>
+        <listitem>
+         <para>
+          <filename>tools/security</filename> (e.g. <filename>nmap</filename>, <filename>gnupg</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         Else:
+        </term>
+        <listitem>
+         <para>
+          <filename>tools/misc</filename>
+         </para>
+        </listitem>
+       </varlistentry>
+      </variablelist>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s a <emphasis>shell</emphasis>:
+     </term>
+     <listitem>
+      <para>
+       <filename>shells</filename> (e.g. <filename>bash</filename>)
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s a <emphasis>server</emphasis>:
+     </term>
+     <listitem>
+      <variablelist>
+       <varlistentry>
+        <term>
+         If it’s a web server:
+        </term>
+        <listitem>
+         <para>
+          <filename>servers/http</filename> (e.g. <filename>apache-httpd</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s an implementation of the X Windowing System:
+        </term>
+        <listitem>
+         <para>
+          <filename>servers/x11</filename> (e.g. <filename>xorg</filename> — this includes the client libraries and programs)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         Else:
+        </term>
+        <listitem>
+         <para>
+          <filename>servers/misc</filename>
+         </para>
+        </listitem>
+       </varlistentry>
+      </variablelist>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s a <emphasis>desktop environment</emphasis>:
+     </term>
+     <listitem>
+      <para>
+       <filename>desktops</filename> (e.g. <filename>kde</filename>, <filename>gnome</filename>, <filename>enlightenment</filename>)
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s a <emphasis>window manager</emphasis>:
+     </term>
+     <listitem>
+      <para>
+       <filename>applications/window-managers</filename> (e.g. <filename>awesome</filename>, <filename>stumpwm</filename>)
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s an <emphasis>application</emphasis>:
+     </term>
+     <listitem>
+      <para>
+       A (typically large) program with a distinct user interface, primarily used interactively.
+      </para>
+      <variablelist>
+       <varlistentry>
+        <term>
+         If it’s a <emphasis>version management system</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>applications/version-management</filename> (e.g. <filename>subversion</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s for <emphasis>video playback / editing</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>applications/video</filename> (e.g. <filename>vlc</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s for <emphasis>graphics viewing / editing</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>applications/graphics</filename> (e.g. <filename>gimp</filename>)
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s for <emphasis>networking</emphasis>:
+        </term>
+        <listitem>
+         <variablelist>
+          <varlistentry>
+           <term>
+            If it’s a <emphasis>mailreader</emphasis>:
+           </term>
+           <listitem>
+            <para>
+             <filename>applications/networking/mailreaders</filename> (e.g. <filename>thunderbird</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+          <varlistentry>
+           <term>
+            If it’s a <emphasis>newsreader</emphasis>:
+           </term>
+           <listitem>
+            <para>
+             <filename>applications/networking/newsreaders</filename> (e.g. <filename>pan</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+          <varlistentry>
+           <term>
+            If it’s a <emphasis>web browser</emphasis>:
+           </term>
+           <listitem>
+            <para>
+             <filename>applications/networking/browsers</filename> (e.g. <filename>firefox</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+          <varlistentry>
+           <term>
+            Else:
+           </term>
+           <listitem>
+            <para>
+             <filename>applications/networking/misc</filename>
+            </para>
+           </listitem>
+          </varlistentry>
+         </variablelist>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         Else:
+        </term>
+        <listitem>
+         <para>
+          <filename>applications/misc</filename>
+         </para>
+        </listitem>
+       </varlistentry>
+      </variablelist>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s <emphasis>data</emphasis> (i.e., does not have a straight-forward executable semantics):
+     </term>
+     <listitem>
+      <variablelist>
+       <varlistentry>
+        <term>
+         If it’s a <emphasis>font</emphasis>:
+        </term>
+        <listitem>
+         <para>
+          <filename>data/fonts</filename>
+         </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+        <term>
+         If it’s related to <emphasis>SGML/XML processing</emphasis>:
+        </term>
+        <listitem>
+         <variablelist>
+          <varlistentry>
+           <term>
+            If it’s an <emphasis>XML DTD</emphasis>:
+           </term>
+           <listitem>
+            <para>
+             <filename>data/sgml+xml/schemas/xml-dtd</filename> (e.g. <filename>docbook</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+          <varlistentry>
+           <term>
+            If it’s an <emphasis>XSLT stylesheet</emphasis>:
+           </term>
+           <listitem>
+            <para>
+             (Okay, these are executable...)
+            </para>
+            <para>
+             <filename>data/sgml+xml/stylesheets/xslt</filename> (e.g. <filename>docbook-xsl</filename>)
+            </para>
+           </listitem>
+          </varlistentry>
+         </variablelist>
+        </listitem>
+       </varlistentry>
+      </variablelist>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      If it’s a <emphasis>game</emphasis>:
+     </term>
+     <listitem>
+      <para>
+       <filename>games</filename>
+      </para>
+     </listitem>
+    </varlistentry>
+    <varlistentry>
+     <term>
+      Else:
+     </term>
+     <listitem>
+      <para>
+       <filename>misc</filename>
+      </para>
+     </listitem>
+    </varlistentry>
+   </variablelist>
+  </section>
+
+  <section xml:id="sec-versioning">
+   <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.
+   </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>.
+   </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.
+   </para>
+  </section>
+ </section>
+ <section xml:id="sec-sources">
+  <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.
+  </para>
+
+  <para>
+   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:
+   <itemizedlist>
+    <listitem>
+     <para>
+      Bad: Uses <literal>git://</literal> which won't be proxied.
+<programlisting>
+src = fetchgit {
+  url = "git://github.com/NixOS/nix.git";
+  rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
+  sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
+}
+</programlisting>
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      Better: This is ok, but an archive fetch will still be faster.
+<programlisting>
+src = fetchgit {
+  url = "https://github.com/NixOS/nix.git";
+  rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
+  sha256 = "1cw5fszffl5pkpa6s6wjnkiv6lm5k618s32sp60kvmvpy7a2v9kg";
+}
+</programlisting>
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      Best: Fetches a snapshot archive and you get the rev you want.
+<programlisting>
+src = fetchFromGitHub {
+  owner = "NixOS";
+  repo = "nix";
+  rev = "1f795f9f44607cc5bec70d1300150bfefcef2aae";
+  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>.
+     </para>
+    </listitem>
+   </itemizedlist>
+  </para>
+ </section>
+ <section xml:id="sec-source-hashes">
+  <title>Obtaining source hash</title>
+
+  <para>
+   Preferred source hash type is sha256. There are several ways to get it.
+  </para>
+
+  <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.
+    </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.
+    </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).
+    </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).
+    </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.
+    </para>
+    <para>
+     You can convert between formats with nix-hash, for example:
+<screen>
+<prompt>$ </prompt>nix-hash --type sha256 --to-base32 <replaceable>HASH</replaceable>
+</screen>
+    </para>
+   </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.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     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.
+    </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.
+    </para>
+    <warning>
+     <para>
+      This method has security problems. Check below for details.
+     </para>
+    </warning>
+   </listitem>
+  </orderedlist>
+
+  <section xml:id="sec-source-hashes-security">
+   <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:
+   </para>
+
+   <itemizedlist>
+    <listitem>
+     <para>
+      <literal>http://</literal> URLs are not secure to prefetch hash from;
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      hashes from upstream (in method 3) should be obtained via secure protocol;
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      <literal>https://</literal> URLs are secure in methods 1, 2, 3;
+     </para>
+    </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.
+     </para>
+    </listitem>
+   </itemizedlist>
+  </section>
+ </section>
+ <section xml:id="sec-patches">
+  <title>Patches</title>
+
+  <para>
+   Patches available online should be retrieved using <literal>fetchpatch</literal>.
+  </para>
+
+  <para>
+<programlisting>
+patches = [
+  (fetchpatch {
+    name = "fix-check-for-using-shared-freetype-lib.patch";
+    url = "http://git.ghostscript.com/?p=ghostpdl.git;a=patch;h=8f5d285";
+    sha256 = "1f0k043rng7f0rfl9hhb89qzvvksqmkrikmm38p61yfx51l325xr";
+  })
+];
+</programlisting>
+  </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.
+  </para>
+
+  <para>
+<programlisting>
+patches = [ ./0001-changes.patch ];
+</programlisting>
+  </para>
+
+  <para>
+   If you do need to do create this sort of patch file, one way to do so is with git:
+   <orderedlist>
+    <listitem>
+     <para>
+      Move to the root directory of the source code you're patching.
+<screen>
+<prompt>$ </prompt>cd the/program/source</screen>
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      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>
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      Edit some files to make whatever changes need to be included in the patch.
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      Use git to create a diff, and pipe the output to a patch file:
+<screen>
+<prompt>$ </prompt>git diff > nixpkgs/pkgs/the/package/0001-changes.patch</screen>
+     </para>
+    </listitem>
+   </orderedlist>
+  </para>
+ </section>
+</chapter>
diff --git a/doc/contributing/contributing-to-documentation.xml b/doc/contributing/contributing-to-documentation.xml
new file mode 100644
index 00000000000..b0266043775
--- /dev/null
+++ b/doc/contributing/contributing-to-documentation.xml
@@ -0,0 +1,30 @@
+<chapter xmlns="http://docbook.org/ns/docbook"
+         xmlns:xlink="http://www.w3.org/1999/xlink"
+         xml:id="chap-contributing">
+ <title>Contributing to this documentation</title>
+ <para>
+  The DocBook sources of the Nixpkgs manual are in the <filename
+xlink:href="https://github.com/NixOS/nixpkgs/tree/master/doc">doc</filename> subdirectory of the Nixpkgs repository.
+ </para>
+ <para>
+  You can quickly check your edits with <command>make</command>:
+ </para>
+<screen>
+<prompt>$ </prompt>cd /path/to/nixpkgs/doc
+<prompt>$ </prompt>nix-shell
+<prompt>[nix-shell]$ </prompt>make
+</screen>
+ <para>
+  If you experience problems, run <command>make debug</command> to help understand the docbook errors.
+ </para>
+ <para>
+  After making modifications to the manual, it's important to build it before committing. You can do that as follows:
+<screen>
+<prompt>$ </prompt>cd /path/to/nixpkgs/doc
+<prompt>$ </prompt>nix-shell
+<prompt>[nix-shell]$ </prompt>make clean
+<prompt>[nix-shell]$ </prompt>nix-build .
+</screen>
+  If the build succeeds, the manual will be in <filename>./result/share/doc/nixpkgs/manual.html</filename>.
+ </para>
+</chapter>
diff --git a/doc/contributing/quick-start.xml b/doc/contributing/quick-start.xml
new file mode 100644
index 00000000000..80514cba490
--- /dev/null
+++ b/doc/contributing/quick-start.xml
@@ -0,0 +1,153 @@
+<chapter xmlns="http://docbook.org/ns/docbook"
+         xmlns:xlink="http://www.w3.org/1999/xlink"
+         xml:id="chap-quick-start">
+ <title>Quick Start to Adding a Package</title>
+ <para>
+  To add a package to Nixpkgs:
+  <orderedlist>
+   <listitem>
+    <para>
+     Checkout the Nixpkgs source tree:
+<screen>
+<prompt>$ </prompt>git clone https://github.com/NixOS/nixpkgs
+<prompt>$ </prompt>cd nixpkgs</screen>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Find a good place in the Nixpkgs tree to add the Nix expression for your package. For instance, a library package typically goes into <filename>pkgs/development/libraries/<replaceable>pkgname</replaceable></filename>, while a web browser goes into <filename>pkgs/applications/networking/browsers/<replaceable>pkgname</replaceable></filename>. See <xref linkend="sec-organisation" /> for some hints on the tree organisation. Create a directory for your package, e.g.
+<screen>
+<prompt>$ </prompt>mkdir pkgs/development/libraries/libfoo</screen>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     In the package directory, create a Nix expression — a piece of code that describes how to build the package. In this case, it should be a <emphasis>function</emphasis> that is called with the package dependencies as arguments, and returns a build of the package in the Nix store. The expression should usually be called <filename>default.nix</filename>.
+<screen>
+<prompt>$ </prompt>emacs pkgs/development/libraries/libfoo/default.nix
+<prompt>$ </prompt>git add pkgs/development/libraries/libfoo/default.nix</screen>
+    </para>
+    <para>
+     You can have a look at the existing Nix expressions under <filename>pkgs/</filename> to see how it’s done. Here are some good ones:
+     <itemizedlist>
+      <listitem>
+       <para>
+        GNU Hello: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/hello/default.nix"><filename>pkgs/applications/misc/hello/default.nix</filename></link>. Trivial package, which specifies some <varname>meta</varname> attributes which is good practice.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        GNU cpio: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/archivers/cpio/default.nix"><filename>pkgs/tools/archivers/cpio/default.nix</filename></link>. Also a simple package. The generic builder in <varname>stdenv</varname> does everything for you. It has no dependencies beyond <varname>stdenv</varname>.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        GNU Multiple Precision arithmetic library (GMP): <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/gmp/5.1.x.nix"><filename>pkgs/development/libraries/gmp/5.1.x.nix</filename></link>. Also done by the generic builder, but has a dependency on <varname>m4</varname>.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Pan, a GTK-based newsreader: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/newsreaders/pan/default.nix"><filename>pkgs/applications/networking/newsreaders/pan/default.nix</filename></link>. Has an optional dependency on <varname>gtkspell</varname>, which is only built if <varname>spellCheck</varname> is <literal>true</literal>.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Apache HTTPD: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/http/apache-httpd/2.4.nix"><filename>pkgs/servers/http/apache-httpd/2.4.nix</filename></link>. A bunch of optional features, variable substitutions in the configure flags, a post-install hook, and miscellaneous hackery.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Thunderbird: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/networking/mailreaders/thunderbird/default.nix"><filename>pkgs/applications/networking/mailreaders/thunderbird/default.nix</filename></link>. Lots of dependencies.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        JDiskReport, a Java utility: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/default.nix"><filename>pkgs/tools/misc/jdiskreport/default.nix</filename></link> (and the <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/jdiskreport/builder.sh">builder</link>). Nixpkgs doesn’t have a decent <varname>stdenv</varname> for Java yet so this is pretty ad-hoc.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        XML::Simple, a Perl module: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix"><filename>pkgs/top-level/perl-packages.nix</filename></link> (search for the <varname>XMLSimple</varname> attribute). Most Perl modules are so simple to build that they are defined directly in <filename>perl-packages.nix</filename>; no need to make a separate file for them.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Adobe Reader: <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/default.nix"><filename>pkgs/applications/misc/adobe-reader/default.nix</filename></link>. Shows how binary-only packages can be supported. In particular the <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/adobe-reader/builder.sh">builder</link> uses <command>patchelf</command> to set the RUNPATH and ELF interpreter of the executables so that the right libraries are found at runtime.
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+    <para>
+     Some notes:
+     <itemizedlist>
+      <listitem>
+       <para>
+        All <varname linkend="chap-meta">meta</varname> attributes are optional, but it’s still a good idea to provide at least the <varname>description</varname>, <varname>homepage</varname> and <varname
+          linkend="sec-meta-license">license</varname>.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        You can use <command>nix-prefetch-url</command> <replaceable>url</replaceable> to get the SHA-256 hash of source distributions. There are similar commands as <command>nix-prefetch-git</command> and <command>nix-prefetch-hg</command> available in <literal>nix-prefetch-scripts</literal> package.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        A list of schemes for <literal>mirror://</literal> URLs can be found in <link
+          xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/mirrors.nix"><filename>pkgs/build-support/fetchurl/mirrors.nix</filename></link>.
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+    <para>
+     The exact syntax and semantics of the Nix expression language, including the built-in function, are described in the Nix manual in the <link
+    xlink:href="http://hydra.nixos.org/job/nix/trunk/tarball/latest/download-by-type/doc/manual/#chap-writing-nix-expressions">chapter on writing Nix expressions</link>.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Add a call to the function defined in the previous step to <link
+    xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix"><filename>pkgs/top-level/all-packages.nix</filename></link> with some descriptive name for the variable, e.g. <varname>libfoo</varname>.
+<screen>
+<prompt>$ </prompt>emacs pkgs/top-level/all-packages.nix</screen>
+    </para>
+    <para>
+     The attributes in that file are sorted by category (like “Development / Libraries”) that more-or-less correspond to the directory structure of Nixpkgs, and then by attribute name.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     To test whether the package builds, run the following command from the root of the nixpkgs source tree:
+<screen>
+<prompt>$ </prompt>nix-build -A libfoo</screen>
+     where <varname>libfoo</varname> should be the variable name defined in the previous step. You may want to add the flag <option>-K</option> to keep the temporary build directory in case something fails. If the build succeeds, a symlink <filename>./result</filename> to the package in the Nix store is created.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     If you want to install the package into your profile (optional), do
+<screen>
+<prompt>$ </prompt>nix-env -f . -iA libfoo</screen>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Optionally commit the new package and open a pull request <link
+     xlink:href="https://github.com/NixOS/nixpkgs/pulls">to nixpkgs</link>, or use <link
+     xlink:href="https://discourse.nixos.org/t/about-the-patches-category/477"> the Patches category</link> on Discourse for sending a patch without a GitHub account.
+    </para>
+   </listitem>
+  </orderedlist>
+ </para>
+</chapter>
diff --git a/doc/contributing/reviewing-contributions.xml b/doc/contributing/reviewing-contributions.xml
new file mode 100644
index 00000000000..ed8f379c460
--- /dev/null
+++ b/doc/contributing/reviewing-contributions.xml
@@ -0,0 +1,536 @@
+<chapter xmlns="http://docbook.org/ns/docbook"
+        xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:xi="http://www.w3.org/2001/XInclude"
+        version="5.0"
+        xml:id="chap-reviewing-contributions">
+ <title>Reviewing contributions</title>
+ <warning>
+  <para>
+   The following section is a draft, and the policy for reviewing is still being discussed in issues such as <link
+	   xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link
+	   xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>.
+  </para>
+ </warning>
+ <para>
+  The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project.
+ </para>
+ <para>
+  The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the <link
+  xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most recently</link> and the <link
+  xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least recently</link> updated pull requests. We highly encourage looking at <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone"> this list of ready to merge, unreviewed pull requests</link>.
+ </para>
+ <para>
+  When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work.
+ </para>
+ <para>
+  GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution.
+ </para>
+ <para>
+  pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review.
+ </para>
+ <para>
+  All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking.
+ </para>
+ <section xml:id="reviewing-contributions-package-updates">
+  <title>Package updates</title>
+
+  <para>
+   A package update is the most trivial and common type of pull request. These pull requests mainly consist of updating the version part of the package name and the source hash.
+  </para>
+
+  <para>
+   It can happen that non-trivial updates include patches or more complex changes.
+  </para>
+
+  <para>
+   Reviewing process:
+  </para>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Add labels to the pull request. (Requires commit rights)
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       <literal>8.has: package (update)</literal> and any topic label that fit the updated package.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the package versioning fits the guidelines.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the commit text fits the guidelines.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the package maintainers are notified.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the meta field information is correct.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       License can change with version updates, so it should be checked to match the upstream license.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the code contains no typos.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Building the package locally.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       pull requests are often targeted to the master or staging branch, and building the pull request locally when it is submitted can trigger many source builds.
+      </para>
+      <para>
+       It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone.
+<screen>
+<prompt>$ </prompt>git fetch origin nixos-unstable <co xml:id='reviewing-rebase-2' />
+<prompt>$ </prompt>git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
+<prompt>$ </prompt>git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
+  xml:id='reviewing-rebase-4' />
+</screen>
+       <calloutlist>
+        <callout arearefs='reviewing-rebase-2'>
+         <para>
+          Fetching the nixos-unstable branch.
+         </para>
+        </callout>
+        <callout arearefs='reviewing-rebase-3'>
+         <para>
+          Fetching the pull request changes, <varname>PRNUMBER</varname> is the number at the end of the pull request title and <varname>BASEBRANCH</varname> the base branch of the pull request.
+         </para>
+        </callout>
+        <callout arearefs='reviewing-rebase-4'>
+         <para>
+          Rebasing the pull request changes to the nixos-unstable branch.
+         </para>
+        </callout>
+       </calloutlist>
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       The <link xlink:href="https://github.com/Mic92/nix-review">nix-review</link> tool can be used to review a pull request content in a single command. <varname>PRNUMBER</varname> should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url.
+      </para>
+<screen>
+<prompt>$ </prompt>nix-shell -p nix-review --run "nix-review pr PRNUMBER"
+</screen>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Running every binary.
+    </para>
+   </listitem>
+  </itemizedlist>
+
+  <example xml:id="reviewing-contributions-sample-package-update">
+   <title>Sample template for a package update review</title>
+<screen>
+##### Reviewed points
+
+- [ ] package name fits guidelines
+- [ ] package version fits guidelines
+- [ ] package build on ARCHITECTURE
+- [ ] executables tested on ARCHITECTURE
+- [ ] all depending packages build
+
+##### Possible improvements
+
+##### Comments
+
+</screen>
+  </example>
+ </section>
+ <section xml:id="reviewing-contributions-new-packages">
+  <title>New packages</title>
+
+  <para>
+   New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
+  </para>
+
+  <para>
+   Reviewing process:
+  </para>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Add labels to the pull request. (Requires commit rights)
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       <literal>8.has: package (new)</literal> and any topic label that fit the new package.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the package versioning is fitting the guidelines.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the commit name is fitting the guidelines.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the meta field contains correct information.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       License must be checked to be fitting upstream license.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       Platforms should be set or the package will not get binary substitutes.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       A maintainer must be set. This can be the package submitter or a community member that accepts to take maintainership of the package.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the code contains no typos.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure the package source.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       Mirrors urls should be used when available.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       The most appropriate function should be used (e.g. packages from GitHub should use <literal>fetchFromGitHub</literal>).
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Building the package locally.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Running every binary.
+    </para>
+   </listitem>
+  </itemizedlist>
+
+  <example xml:id="reviewing-contributions-sample-new-package">
+   <title>Sample template for a new package review</title>
+<screen>
+##### Reviewed points
+
+- [ ] package path fits guidelines
+- [ ] package name fits guidelines
+- [ ] package version fits guidelines
+- [ ] package build on ARCHITECTURE
+- [ ] executables tested on ARCHITECTURE
+- [ ] `meta.description` is set and fits guidelines
+- [ ] `meta.license` fits upstream license
+- [ ] `meta.platforms` is set
+- [ ] `meta.maintainers` is set
+- [ ] build time only dependencies are declared in `nativeBuildInputs`
+- [ ] source is fetched using the appropriate function
+- [ ] phases are respected
+- [ ] patches that are remotely available are fetched with `fetchpatch`
+
+##### Possible improvements
+
+##### Comments
+
+</screen>
+  </example>
+ </section>
+ <section xml:id="reviewing-contributions-module-updates">
+  <title>Module updates</title>
+
+  <para>
+   Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
+  </para>
+
+  <para>
+   Reviewing process
+  </para>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Add labels to the pull request. (Requires commit rights)
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       <literal>8.has: module (update)</literal> and any topic label that fit the module.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the module maintainers are notified.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       <link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the module tests, if any, are succeeding.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the introduced options are correct.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       Description, default and example should be provided.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that option changes are backward compatible.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       <literal>mkRenamedOptionModule</literal> and <literal>mkAliasOptionModule</literal> functions provide way to make option changes backward compatible.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that removed options are declared with <literal>mkRemovedOptionModule</literal>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that changes that are not backward compatible are mentioned in release notes.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that documentations affected by the change is updated.
+    </para>
+   </listitem>
+  </itemizedlist>
+
+  <example xml:id="reviewing-contributions-sample-module-update">
+   <title>Sample template for a module update review</title>
+<screen>
+##### Reviewed points
+
+- [ ] changes are backward compatible
+- [ ] removed options are declared with `mkRemovedOptionModule`
+- [ ] changes that are not backward compatible are documented in release notes
+- [ ] module tests succeed on ARCHITECTURE
+- [ ] options types are appropriate
+- [ ] options description is set
+- [ ] options example is provided
+- [ ] documentation affected by the changes is updated
+
+##### Possible improvements
+
+##### Comments
+
+</screen>
+  </example>
+ </section>
+ <section xml:id="reviewing-contributions-new-modules">
+  <title>New modules</title>
+
+  <para>
+   New modules submissions introduce a new module to NixOS.
+  </para>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Add labels to the pull request. (Requires commit rights)
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       <literal>8.has: module (new)</literal> and any topic label that fit the module.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the module tests, if any, are succeeding.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the introduced options are correct.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       Description, default and example should be provided.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that module <literal>meta</literal> field is present
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       Maintainers should be declared in <literal>meta.maintainers</literal>.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       Module documentation should be declared with <literal>meta.doc</literal>.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Ensure that the module respect other modules functionality.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       For example, enabling a module should not open firewall ports by default.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+  </itemizedlist>
+
+  <example xml:id="reviewing-contributions-sample-new-module">
+   <title>Sample template for a new module review</title>
+<screen>
+##### Reviewed points
+
+- [ ] module path fits the guidelines
+- [ ] module tests succeed on ARCHITECTURE
+- [ ] options have appropriate types
+- [ ] options have default
+- [ ] options have example
+- [ ] options have descriptions
+- [ ] No unneeded package is added to environment.systemPackages
+- [ ] meta.maintainers is set
+- [ ] module documentation is declared in meta.doc
+
+##### Possible improvements
+
+##### Comments
+
+</screen>
+  </example>
+ </section>
+ <section xml:id="reviewing-contributions-other-submissions">
+  <title>Other submissions</title>
+
+  <para>
+   Other type of submissions requires different reviewing steps.
+  </para>
+
+  <para>
+   If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints.
+  </para>
+
+  <para>
+   Container system, boot system and library changes are some examples of the pull requests fitting this category.
+  </para>
+ </section>
+ <section xml:id="reviewing-contributions--merging-pull-requests">
+  <title>Merging pull requests</title>
+
+  <para>
+   It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
+  </para>
+
+  <para>
+   TODO: add the procedure to request merging rights.
+  </para>
+
+<!--
+The following paragraph about how to deal with unactive contributors is just a
+proposition and should be modified to what the community agrees to be the right
+policy.
+
+<para>Please note that contributors with commit rights unactive for more than
+  three months will have their commit rights revoked.</para>
+-->
+
+  <para>
+   In a case a contributor definitively leaves the Nix community, they should create an issue or post on <link
+   xlink:href="https://discourse.nixos.org">Discourse</link> with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
+  </para>
+ </section>
+</chapter>
diff --git a/doc/contributing/submitting-changes.xml b/doc/contributing/submitting-changes.xml
new file mode 100644
index 00000000000..2c7defb8174
--- /dev/null
+++ b/doc/contributing/submitting-changes.xml
@@ -0,0 +1,429 @@
+<chapter xmlns="http://docbook.org/ns/docbook"
+         xmlns:xlink="http://www.w3.org/1999/xlink"
+         xml:id="chap-submitting-changes">
+ <title>Submitting changes</title>
+ <section xml:id="submitting-changes-making-patches">
+  <title>Making patches</title>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Read <link xlink:href="https://nixos.org/nixpkgs/manual/">Manual (How to write packages for Nix)</link>.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Fork the repository on GitHub.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Create a branch for your future fix.
+     <itemizedlist>
+      <listitem>
+       <para>
+        You can make branch from a commit of your local <command>nixos-version</command>. That will help you to avoid additional local compilations. Because you will receive packages from binary cache.
+        <itemizedlist>
+         <listitem>
+          <para>
+           For example: <command>nixos-version</command> returns <command>15.05.git.0998212 (Dingo)</command>. So you can do:
+          </para>
+         </listitem>
+        </itemizedlist>
+<screen>
+<prompt>$ </prompt>git checkout 0998212
+<prompt>$ </prompt>git checkout -b 'fix/pkg-name-update'
+</screen>
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Please avoid working directly on the <command>master</command> branch.
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Make commits of logical units.
+     <itemizedlist>
+      <listitem>
+       <para>
+        If you removed pkgs, made some major NixOS changes etc., write about them in <command>nixos/doc/manual/release-notes/rl-unstable.xml</command>.
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Check for unnecessary whitespace with <command>git diff --check</command> before committing.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Format the commit in a following way:
+    </para>
+<programlisting>
+(pkg-name | nixos/&lt;module>): (from -> to | init at version | refactor | etc)
+Additional information.
+</programlisting>
+    <itemizedlist>
+     <listitem>
+      <para>
+       Examples:
+       <itemizedlist>
+        <listitem>
+         <para>
+          <command>nginx: init at 2.0.1</command>
+         </para>
+        </listitem>
+        <listitem>
+         <para>
+          <command>firefox: 54.0.1 -> 55.0</command>
+         </para>
+        </listitem>
+        <listitem>
+         <para>
+          <command>nixos/hydra: add bazBaz option</command>
+         </para>
+        </listitem>
+        <listitem>
+         <para>
+          <command>nixos/nginx: refactor config generation</command>
+         </para>
+        </listitem>
+       </itemizedlist>
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
+     Test your changes. If you work with
+     <itemizedlist>
+      <listitem>
+       <para>
+        nixpkgs:
+        <itemizedlist>
+         <listitem>
+          <para>
+           update pkg ->
+           <itemizedlist>
+            <listitem>
+             <para>
+              <command>nix-env -i pkg-name -f &lt;path to your local nixpkgs folder&gt;</command>
+             </para>
+            </listitem>
+           </itemizedlist>
+          </para>
+         </listitem>
+         <listitem>
+          <para>
+           add pkg ->
+           <itemizedlist>
+            <listitem>
+             <para>
+              Make sure it's in <command>pkgs/top-level/all-packages.nix</command>
+             </para>
+            </listitem>
+            <listitem>
+             <para>
+              <command>nix-env -i pkg-name -f &lt;path to your local nixpkgs folder&gt;</command>
+             </para>
+            </listitem>
+           </itemizedlist>
+          </para>
+         </listitem>
+         <listitem>
+          <para>
+           <emphasis>If you don't want to install pkg in you profile</emphasis>.
+           <itemizedlist>
+            <listitem>
+             <para>
+              <command>nix-build -A pkg-attribute-name &lt;path to your local nixpkgs folder&gt;/default.nix</command> and check results in the folder <command>result</command>. It will appear in the same directory where you did <command>nix-build</command>.
+             </para>
+            </listitem>
+           </itemizedlist>
+          </para>
+         </listitem>
+         <listitem>
+          <para>
+           If you did <command>nix-env -i pkg-name</command> you can do <command>nix-env -e pkg-name</command> to uninstall it from your system.
+          </para>
+         </listitem>
+        </itemizedlist>
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        NixOS and its modules:
+        <itemizedlist>
+         <listitem>
+          <para>
+           You can add new module to your NixOS configuration file (usually it's <command>/etc/nixos/configuration.nix</command>). And do <command>sudo nixos-rebuild test -I nixpkgs=&lt;path to your local nixpkgs folder&gt; --fast</command>.
+          </para>
+         </listitem>
+        </itemizedlist>
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     If you have commits <command>pkg-name: oh, forgot to insert whitespace</command>: squash commits in this case. Use <command>git rebase -i</command>.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Rebase you branch against current <command>master</command>.
+    </para>
+   </listitem>
+  </itemizedlist>
+ </section>
+ <section xml:id="submitting-changes-submitting-changes">
+  <title>Submitting changes</title>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Push your changes to your fork of nixpkgs.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Create pull request:
+     <itemizedlist>
+      <listitem>
+       <para>
+        Write the title in format <command>(pkg-name | nixos/&lt;module>): improvement</command>.
+        <itemizedlist>
+         <listitem>
+          <para>
+           If you update the pkg, write versions <command>from -> to</command>.
+          </para>
+         </listitem>
+        </itemizedlist>
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Write in comment if you have tested your patch. Do not rely much on <command>TravisCI</command>.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        If you make an improvement, write about your motivation.
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        Notify maintainers of the package. For example add to the message: <command>cc @jagajaga @domenkozar</command>.
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+   </listitem>
+  </itemizedlist>
+ </section>
+ <section xml:id="submitting-changes-pull-request-template">
+  <title>Pull Request Template</title>
+
+  <para>
+   The pull request template helps determine what steps have been made for a contribution so far, and will help guide maintainers on the status of a change. The motivation section of the PR should include any extra details the title does not address and link any existing issues related to the pull request.
+  </para>
+
+  <para>
+   When a PR is created, it will be pre-populated with some checkboxes detailed below:
+  </para>
+
+  <section xml:id="submitting-changes-tested-with-sandbox">
+   <title>Tested using sandboxing</title>
+
+   <para>
+    When sandbox builds are enabled, Nix will setup an isolated environment for each build process. It is used to remove further hidden dependencies set by the build environment to improve reproducibility. This includes access to the network during the build outside of <function>fetch*</function> functions and files outside the Nix store. Depending on the operating system access to other resources are blocked as well (ex. inter process communication is isolated on Linux); see <link
+      xlink:href="https://nixos.org/nix/manual/#conf-sandbox">sandbox</link> in Nix manual for details.
+   </para>
+
+   <para>
+    Sandboxing is not enabled by default in Nix due to a small performance hit on each build. In pull requests for <link
+        xlink:href="https://github.com/NixOS/nixpkgs/">nixpkgs</link> people are asked to test builds with sandboxing enabled (see <literal>Tested using sandboxing</literal> in the pull request template) because in<link
+        xlink:href="https://nixos.org/hydra/">https://nixos.org/hydra/</link> sandboxing is also used.
+   </para>
+
+   <para>
+    Depending if you use NixOS or other platforms you can use one of the following methods to enable sandboxing <emphasis role="bold">before</emphasis> building the package:
+    <itemizedlist>
+     <listitem>
+      <para>
+       <emphasis role="bold">Globally enable sandboxing on NixOS</emphasis>: add the following to <filename>configuration.nix</filename>
+<screen>nix.useSandbox = true;</screen>
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       <emphasis role="bold">Globally enable sandboxing on non-NixOS platforms</emphasis>: add the following to: <filename>/etc/nix/nix.conf</filename>
+<screen>sandbox = true</screen>
+      </para>
+     </listitem>
+    </itemizedlist>
+   </para>
+  </section>
+
+  <section xml:id="submitting-changes-platform-diversity">
+   <title>Built on platform(s)</title>
+
+   <para>
+    Many Nix packages are designed to run on multiple platforms. As such, it's important to let the maintainer know which platforms your changes have been tested on. It's not always practical to test a change on all platforms, and is not required for a pull request to be merged. Only check the systems you tested the build on in this section.
+   </para>
+  </section>
+
+  <section xml:id="submitting-changes-nixos-tests">
+   <title>Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)</title>
+
+   <para>
+    Packages with automated tests are much more likely to be merged in a timely fashion because it doesn't require as much manual testing by the maintainer to verify the functionality of the package. If there are existing tests for the package, they should be run to verify your changes do not break the tests. Tests only apply to packages with NixOS modules defined and can only be run on Linux. For more details on writing and running tests, see the <link
+        xlink:href="https://nixos.org/nixos/manual/index.html#sec-nixos-tests">section in the NixOS manual</link>.
+   </para>
+  </section>
+
+  <section xml:id="submitting-changes-tested-compilation">
+   <title>Tested compilation of all pkgs that depend on this change using <command>nix-review</command></title>
+
+   <para>
+    If you are updating a package's version, you can use nix-review to make sure all packages that depend on the updated package still compile correctly. The <command>nix-review</command> utility can look for and build all dependencies either based on uncommited changes with the <literal>wip</literal> option or specifying a github pull request number.
+   </para>
+
+   <para>
+    review changes from pull request number 12345:
+<screen>nix-shell -p nix-review --run "nix-review pr 12345"</screen>
+   </para>
+
+   <para>
+    review uncommitted changes:
+<screen>nix-shell -p nix-review --run "nix-review wip"</screen>
+   </para>
+  </section>
+
+  <section xml:id="submitting-changes-tested-execution">
+   <title>Tested execution of all binary files (usually in <filename>./result/bin/</filename>)</title>
+
+   <para>
+    It's important to test any executables generated by a build when you change or create a package in nixpkgs. This can be done by looking in <filename>./result/bin</filename> and running any files in there, or at a minimum, the main executable for the package. For example, if you make a change to <package>texlive</package>, you probably would only check the binaries associated with the change you made rather than testing all of them.
+   </para>
+  </section>
+
+  <section xml:id="submitting-changes-contribution-standards">
+   <title>Meets Nixpkgs contribution standards</title>
+
+   <para>
+    The last checkbox is fits <link
+        xlink:href="https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md">CONTRIBUTING.md</link>. The contributing document has detailed information on standards the Nix community has for commit messages, reviews, licensing of contributions you make to the project, etc... Everyone should read and understand the standards the community has for contributing before submitting a pull request.
+   </para>
+  </section>
+ </section>
+ <section xml:id="submitting-changes-hotfixing-pull-requests">
+  <title>Hotfixing pull requests</title>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Make the appropriate changes in you branch.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Don't create additional commits, do
+     <itemizedlist>
+      <listitem>
+       <para>
+        <command>git rebase -i</command>
+       </para>
+      </listitem>
+      <listitem>
+       <para>
+        <command>git push --force</command> to your branch.
+       </para>
+      </listitem>
+     </itemizedlist>
+    </para>
+   </listitem>
+  </itemizedlist>
+ </section>
+ <section xml:id="submitting-changes-commit-policy">
+  <title>Commit policy</title>
+
+  <itemizedlist>
+   <listitem>
+    <para>
+     Commits must be sufficiently tested before being merged, both for the master and staging branches.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     Hydra builds for master and staging should not be used as testing platform, it's a build farm for changes that have been already tested.
+    </para>
+   </listitem>
+   <listitem>
+    <para>
+     When changing the bootloader installation process, extra care must be taken. Grub installations cannot be rolled back, hence changes may break people's installations forever. For any non-trivial change to the bootloader please file a PR asking for review, especially from @edolstra.
+    </para>
+   </listitem>
+  </itemizedlist>
+
+  <section xml:id="submitting-changes-master-branch">
+   <title>Master branch</title>
+
+   <itemizedlist>
+    <listitem>
+     <para>
+      It should only see non-breaking commits that do not cause mass rebuilds.
+     </para>
+    </listitem>
+   </itemizedlist>
+  </section>
+
+  <section xml:id="submitting-changes-staging-branch">
+   <title>Staging branch</title>
+
+   <itemizedlist>
+    <listitem>
+     <para>
+      It's only for non-breaking mass-rebuild commits. That means it's not to be used for testing, and changes must have been well tested already. <link xlink:href="https://web.archive.org/web/20160528180406/http://comments.gmane.org/gmane.linux.distributions.nixos/13447">Read policy here</link>.
+     </para>
+    </listitem>
+    <listitem>
+     <para>
+      If the branch is already in a broken state, please refrain from adding extra new breakages. Stabilize it for a few days, merge into master, then resume development on staging. <link xlink:href="http://hydra.nixos.org/jobset/nixpkgs/staging#tabs-evaluations">Keep an eye on the staging evaluations here</link>. If any fixes for staging happen to be already in master, then master can be merged into staging.
+     </para>
+    </listitem>
+   </itemizedlist>
+  </section>
+
+  <section xml:id="submitting-changes-stable-release-branches">
+   <title>Stable release branches</title>
+
+   <itemizedlist>
+    <listitem>
+     <para>
+      If you're cherry-picking a commit to a stable release branch, always use <command>git cherry-pick -xe</command> and ensure the message contains a clear description about why this needs to be included in the stable branch.
+     </para>
+     <para>
+      An example of a cherry-picked commit would look like this:
+     </para>
+<screen>
+nixos: Refactor the world.
+
+The original commit message describing the reason why the world was torn apart.
+
+(cherry picked from commit abcdef)
+Reason: I just had a gut feeling that this would also be wanted by people from
+the stone age.
+</screen>
+    </listitem>
+   </itemizedlist>
+  </section>
+ </section>
+</chapter>