summary refs log tree commit diff
path: root/nixos/doc/manual/installation/upgrading.xml
blob: ef83d4595183d1d5997ae1692a2e7df59574bcbf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<chapter xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         version="5.0"
         xml:id="sec-upgrading">

<title>Upgrading NixOS</title>

<para>The best way to keep your NixOS installation up to date is to
use one of the NixOS <emphasis>channels</emphasis>.  A channel is a
Nix mechanism for distributing Nix expressions and associated
binaries.  The NixOS channels are updated automatically from NixOS’s
Git repository after certain tests have passed and all packages have
been built.  These channels are:

<itemizedlist>
  <listitem>
    <para>Stable channels, such as <literal
    xlink:href="https://nixos.org/channels/nixos-14.04">nixos-14.04</literal>.
    These only get conservative bug fixes and package upgrades.  For
    instance, a channel update may cause the Linux kernel on your
    system to be upgraded from 3.4.66 to 3.4.67 (a minor bug fix), but
    not from 3.4.<replaceable>x</replaceable> to
    3.11.<replaceable>x</replaceable> (a major change that has the
    potential to break things).  Stable channels are generally
    maintained until the next stable branch is created.</para>
  </listitem>
  <listitem>
    <para>The unstable channel, <literal
    xlink:href="https://nixos.org/channels/nixos-unstable">nixos-unstable</literal>.
    This corresponds to NixOS’s main development branch, and may thus
    see radical changes between channel updates.  It’s not recommended
    for production systems.</para>
  </listitem>
</itemizedlist>

To see what channels are available, go to <link
xlink:href="https://nixos.org/channels"/>.  (Note that the URIs of the
various channels redirect to a directory that contains the channel’s
latest version and includes ISO images and VirtualBox
appliances.)</para>

<para>When you first install NixOS, you’re automatically subscribed to
the NixOS channel that corresponds to your installation source.   For
instance, if you installed from a 14.04 ISO, you will be subscribed to
the <literal>nixos-14.04</literal> channel.  To see which NixOS
channel you’re subscribed to, run the following as root:

<screen>
$ nix-channel --list | grep nixos
nixos https://nixos.org/channels/nixos-unstable
</screen>

To switch to a different NixOS channel, do

<screen>
$ nix-channel --add https://nixos.org/channels/<replaceable>channel-name</replaceable> nixos
</screen>

(Be sure to include the <literal>nixos</literal> parameter at the
end.)  For instance, to use the NixOS 14.04 stable channel:

<screen>
$ nix-channel --add http:s//nixos.org/channels/nixos-14.04 nixos
</screen>

But if you want to live on the bleeding edge:

<screen>
$ nix-channel --add https://nixos.org/channels/nixos-unstable nixos
</screen>

</para>

<para>You can then upgrade NixOS to the latest version in your chosen
channel by running

<screen>
$ nixos-rebuild switch --upgrade
</screen>

which is equivalent to the more verbose <literal>nix-channel --update
nixos; nixos-rebuild switch</literal>.</para>

<warning><para>It is generally safe to switch back and forth between
channels.  The only exception is that a newer NixOS may also have a
newer Nix version, which may involve an upgrade of Nix’s database
schema.  This cannot be undone easily, so in that case you will not be
able to go back to your original channel.</para></warning>

</chapter>