2014-08-27 16:41:09 +00:00
|
|
|
|
<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="sec-channels">
|
|
|
|
|
|
|
|
|
|
<title>Channels</title>
|
|
|
|
|
|
|
|
|
|
<para>If you want to stay up to date with a set of packages, it’s not
|
|
|
|
|
very convenient to manually download the latest set of Nix expressions
|
2014-12-13 22:16:08 +00:00
|
|
|
|
for those packages and upgrade using <command>nix-env</command>.
|
|
|
|
|
Fortunately, there’s a better way: <emphasis>Nix
|
|
|
|
|
channels</emphasis>.</para>
|
2014-08-27 16:41:09 +00:00
|
|
|
|
|
|
|
|
|
<para>A Nix channel is just a URL that points to a place that contains
|
|
|
|
|
a set of Nix expressions and a manifest. Using the command <link
|
|
|
|
|
linkend="sec-nix-channel"><command>nix-channel</command></link> you
|
|
|
|
|
can automatically stay up to date with whatever is available at that
|
|
|
|
|
URL.</para>
|
2020-01-09 22:15:19 +00:00
|
|
|
|
|
|
|
|
|
<para>To see the list of official NixOS channels, visit <link
|
|
|
|
|
xlink:href="https://nixos.org/channels" />.</para>
|
2014-08-27 16:41:09 +00:00
|
|
|
|
|
|
|
|
|
<para>You can “subscribe” to a channel using
|
|
|
|
|
<command>nix-channel --add</command>, e.g.,
|
|
|
|
|
|
|
|
|
|
<screen>
|
2014-12-13 22:16:08 +00:00
|
|
|
|
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable</screen>
|
2014-08-27 16:41:09 +00:00
|
|
|
|
|
|
|
|
|
subscribes you to a channel that always contains that latest version
|
2014-12-13 22:16:08 +00:00
|
|
|
|
of the Nix Packages collection. (Subscribing really just means that
|
|
|
|
|
the URL is added to the file <filename>~/.nix-channels</filename>,
|
|
|
|
|
where it is read by subsequent calls to <command>nix-channel
|
|
|
|
|
--update</command>.) You can “unsubscribe” using <command>nix-channel
|
|
|
|
|
--remove</command>:
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-channel --remove nixpkgs
|
|
|
|
|
</screen>
|
|
|
|
|
</para>
|
2014-08-27 16:41:09 +00:00
|
|
|
|
|
|
|
|
|
<para>To obtain the latest Nix expressions available in a channel, do
|
|
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
|
$ nix-channel --update</screen>
|
|
|
|
|
|
2014-12-13 22:16:08 +00:00
|
|
|
|
This downloads and unpacks the Nix expressions in every channel
|
2020-07-23 12:28:05 +00:00
|
|
|
|
(downloaded from <literal><emphasis>url</emphasis>/nixexprs.tar.bz2</literal>).
|
2014-12-13 22:16:08 +00:00
|
|
|
|
It also makes the union of each channel’s Nix expressions available by
|
|
|
|
|
default to <command>nix-env</command> operations (via the symlink
|
|
|
|
|
<filename>~/.nix-defexpr/channels</filename>). Consequently, you can
|
|
|
|
|
then say
|
2014-08-27 16:41:09 +00:00
|
|
|
|
|
|
|
|
|
<screen>
|
2014-12-13 22:16:08 +00:00
|
|
|
|
$ nix-env -u</screen>
|
2014-08-27 16:41:09 +00:00
|
|
|
|
|
|
|
|
|
to upgrade all packages in your profile to the latest versions
|
|
|
|
|
available in the subscribed channels.</para>
|
|
|
|
|
|
2014-12-13 22:16:08 +00:00
|
|
|
|
</chapter>
|