2006-08-21 16:05:11 +00:00
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook"
|
2014-08-27 16:41:09 +00:00
|
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
|
|
|
version="5.0"
|
|
|
|
|
xml:id="sec-nix-channel">
|
2014-09-16 12:57:45 +00:00
|
|
|
|
|
2007-09-19 14:01:41 +00:00
|
|
|
|
<refmeta>
|
|
|
|
|
<refentrytitle>nix-channel</refentrytitle>
|
|
|
|
|
<manvolnum>1</manvolnum>
|
|
|
|
|
<refmiscinfo class="source">Nix</refmiscinfo>
|
2014-09-16 12:57:45 +00:00
|
|
|
|
<refmiscinfo class="version"><xi:include href="../version.txt" parse="text"/></refmiscinfo>
|
2007-09-19 14:01:41 +00:00
|
|
|
|
</refmeta>
|
|
|
|
|
|
2005-04-09 17:16:00 +00:00
|
|
|
|
<refnamediv>
|
|
|
|
|
<refname>nix-channel</refname>
|
|
|
|
|
<refpurpose>manage Nix channels</refpurpose>
|
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
|
<cmdsynopsis>
|
|
|
|
|
<command>nix-channel</command>
|
|
|
|
|
<group choice='req'>
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<arg choice='plain'><option>--add</option> <replaceable>url</replaceable> <arg choice='opt'><replaceable>name</replaceable></arg></arg>
|
2015-01-12 01:51:20 +00:00
|
|
|
|
<arg choice='plain'><option>--remove</option> <replaceable>name</replaceable></arg>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
<arg choice='plain'><option>--list</option></arg>
|
2012-05-07 21:55:56 +00:00
|
|
|
|
<arg choice='plain'><option>--update</option> <arg rep='repeat'><replaceable>names</replaceable></arg></arg>
|
2014-10-14 10:07:56 +00:00
|
|
|
|
<arg choice='plain'><option>--rollback</option> <arg choice='opt'><replaceable>generation</replaceable></arg></arg>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
</group>
|
|
|
|
|
</cmdsynopsis>
|
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
|
|
<refsection><title>Description</title>
|
|
|
|
|
|
2018-03-01 05:27:25 +00:00
|
|
|
|
<para>A Nix channel is a mechanism that allows you to automatically stay
|
2005-04-09 17:16:00 +00:00
|
|
|
|
up-to-date with a set of pre-built Nix expressions. A Nix channel is
|
2014-12-13 22:16:08 +00:00
|
|
|
|
just a URL that points to a place containing both a set of Nix
|
|
|
|
|
expressions and a pointer to a binary cache. <phrase
|
2012-04-14 16:38:52 +00:00
|
|
|
|
condition="manual">See also <xref linkend="sec-channels"
|
|
|
|
|
/>.</phrase></para>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
|
|
|
|
<para>This command has the following operations:
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<varlistentry><term><option>--add</option> <replaceable>url</replaceable> [<replaceable>name</replaceable>]</term>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<listitem><para>Adds a channel named
|
|
|
|
|
<replaceable>name</replaceable> with URL
|
|
|
|
|
<replaceable>url</replaceable> to the list of subscribed channels.
|
|
|
|
|
If <replaceable>name</replaceable> is omitted, it defaults to the
|
|
|
|
|
last component of <replaceable>url</replaceable>, with the
|
|
|
|
|
suffixes <literal>-stable</literal> or
|
|
|
|
|
<literal>-unstable</literal> removed.</para></listitem>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<varlistentry><term><option>--remove</option> <replaceable>name</replaceable></term>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<listitem><para>Removes the channel named
|
|
|
|
|
<replaceable>name</replaceable> from the list of subscribed
|
|
|
|
|
channels.</para></listitem>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry><term><option>--list</option></term>
|
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<listitem><para>Prints the names and URLs of all subscribed
|
|
|
|
|
channels on standard output.</para></listitem>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2012-05-07 21:55:56 +00:00
|
|
|
|
<varlistentry><term><option>--update</option> [<replaceable>names</replaceable>…]</term>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
|
|
|
|
<listitem><para>Downloads the Nix expressions of all subscribed
|
2012-05-07 21:55:56 +00:00
|
|
|
|
channels (or only those included in
|
2016-04-11 12:16:56 +00:00
|
|
|
|
<replaceable>names</replaceable> if specified) and makes them the
|
2012-05-07 21:55:56 +00:00
|
|
|
|
default for <command>nix-env</command> operations (by symlinking
|
2016-04-11 12:16:56 +00:00
|
|
|
|
them from the directory
|
|
|
|
|
<filename>~/.nix-defexpr</filename>).</para></listitem>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2014-10-14 10:07:56 +00:00
|
|
|
|
<varlistentry><term><option>--rollback</option> [<replaceable>generation</replaceable>]</term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>Reverts the previous call to <command>nix-channel
|
|
|
|
|
--update</command>. Optionally, you can specify a specific channel
|
|
|
|
|
generation number to restore.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
2005-04-09 17:16:00 +00:00
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
|
|
</para>
|
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<para>Note that <option>--add</option> does not automatically perform
|
|
|
|
|
an update.</para>
|
2005-04-09 17:16:00 +00:00
|
|
|
|
|
|
|
|
|
<para>The list of subscribed channels is stored in
|
|
|
|
|
<filename>~/.nix-channels</filename>.</para>
|
|
|
|
|
|
|
|
|
|
</refsection>
|
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
<refsection><title>Examples</title>
|
|
|
|
|
|
|
|
|
|
<para>To subscribe to the Nixpkgs channel and install the GNU Hello package:</para>
|
|
|
|
|
|
|
|
|
|
<screen>
|
2014-10-14 10:07:56 +00:00
|
|
|
|
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
2012-04-14 16:38:52 +00:00
|
|
|
|
$ nix-channel --update
|
|
|
|
|
$ nix-env -iA nixpkgs.hello</screen>
|
|
|
|
|
|
2014-10-14 10:07:56 +00:00
|
|
|
|
<para>You can revert channel updates using <option>--rollback</option>:</para>
|
|
|
|
|
|
|
|
|
|
<screen>
|
2018-07-16 09:00:42 +00:00
|
|
|
|
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
|
2014-10-14 10:07:56 +00:00
|
|
|
|
"14.04.527.0e935f1"
|
|
|
|
|
|
|
|
|
|
$ nix-channel --rollback
|
|
|
|
|
switching from generation 483 to 482
|
|
|
|
|
|
2018-07-16 09:00:42 +00:00
|
|
|
|
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
|
2014-10-14 10:07:56 +00:00
|
|
|
|
"14.04.526.dbadfad"
|
|
|
|
|
</screen>
|
|
|
|
|
|
|
|
|
|
</refsection>
|
|
|
|
|
|
|
|
|
|
<refsection><title>Files</title>
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
2015-02-22 16:39:29 +00:00
|
|
|
|
<varlistentry><term><filename>/nix/var/nix/profiles/per-user/<replaceable>username</replaceable>/channels</filename></term>
|
2014-10-14 10:07:56 +00:00
|
|
|
|
|
|
|
|
|
<listitem><para><command>nix-channel</command> uses a
|
|
|
|
|
<command>nix-env</command> profile to keep track of previous
|
|
|
|
|
versions of the subscribed channels. Every time you run
|
|
|
|
|
<command>nix-channel --update</command>, a new channel generation
|
|
|
|
|
(that is, a symlink to the channel Nix expressions in the Nix store)
|
|
|
|
|
is created. This enables <command>nix-channel --rollback</command>
|
|
|
|
|
to revert to previous versions.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry><term><filename>~/.nix-defexpr/channels</filename></term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>This is a symlink to
|
2015-02-22 16:39:29 +00:00
|
|
|
|
<filename>/nix/var/nix/profiles/per-user/<replaceable>username</replaceable>/channels</filename>. It
|
2014-10-14 10:07:56 +00:00
|
|
|
|
ensures that <command>nix-env</command> can find your channels. In
|
|
|
|
|
a multi-user installation, you may also have
|
|
|
|
|
<filename>~/.nix-defexpr/channels_root</filename>, which links to
|
|
|
|
|
the channels of the root user.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
|
|
2012-04-14 16:38:52 +00:00
|
|
|
|
</refsection>
|
|
|
|
|
|
2014-12-13 22:16:08 +00:00
|
|
|
|
<refsection><title>Channel format</title>
|
|
|
|
|
|
|
|
|
|
<para>A channel URL should point to a directory containing the
|
|
|
|
|
following files:</para>
|
|
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
|
|
|
|
|
|
<varlistentry><term><filename>nixexprs.tar.xz</filename></term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>A tarball containing Nix expressions and files
|
2018-03-01 05:27:25 +00:00
|
|
|
|
referenced by them (such as build scripts and patches). At the
|
|
|
|
|
top level, the tarball should contain a single directory. That
|
2014-12-13 22:16:08 +00:00
|
|
|
|
directory must contain a file <filename>default.nix</filename>
|
|
|
|
|
that serves as the channel’s “entry point”.</para></listitem>
|
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
<varlistentry><term><filename>binary-cache-url</filename></term>
|
|
|
|
|
|
|
|
|
|
<listitem><para>A file containing the URL to a binary cache (such
|
2018-03-01 05:27:25 +00:00
|
|
|
|
as <uri>https://cache.nixos.org</uri>). Nix will automatically
|
2014-12-13 22:16:08 +00:00
|
|
|
|
check this cache for pre-built binaries, if the user has
|
|
|
|
|
sufficient rights to add binary caches. For instance, in a
|
|
|
|
|
multi-user Nix setup, the binary caches provided by the channels
|
|
|
|
|
of the root user are used automatically, but caches corresponding
|
2016-08-10 15:13:11 +00:00
|
|
|
|
to the channels of non-root users are ignored.</para></listitem>
|
2014-12-13 22:16:08 +00:00
|
|
|
|
|
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
|
|
</variablelist>
|
|
|
|
|
|
|
|
|
|
</refsection>
|
|
|
|
|
|
2005-04-09 17:16:00 +00:00
|
|
|
|
</refentry>
|