1<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" xml:id="sec-package-management">
2 <title>Package Management</title>
3 <para>
4 This section describes how to add additional packages to your
5 system. NixOS has two distinct styles of package management:
6 </para>
7 <itemizedlist>
8 <listitem>
9 <para>
10 <emphasis>Declarative</emphasis>, where you declare what
11 packages you want in your <literal>configuration.nix</literal>.
12 Every time you run <literal>nixos-rebuild</literal>, NixOS will
13 ensure that you get a consistent set of binaries corresponding
14 to your specification.
15 </para>
16 </listitem>
17 <listitem>
18 <para>
19 <emphasis>Ad hoc</emphasis>, where you install, upgrade and
20 uninstall packages via the <literal>nix-env</literal> command.
21 This style allows mixing packages from different Nixpkgs
22 versions. It’s the only choice for non-root users.
23 </para>
24 </listitem>
25 </itemizedlist>
26 <xi:include href="declarative-packages.section.xml" />
27 <xi:include href="ad-hoc-packages.section.xml" />
28</chapter>