'\" t
.\" Title: nix-channel
.\" Author: Eelco Dolstra
.\" Generator: DocBook XSL Stylesheets v1.79.2
.\" Date: 12/12/2020
.\" Manual: Command Reference
.\" Source: Nix 2.3.7
.\" Language: English
.\"
.TH "NIX\-CHANNEL" "1" "12/12/2020" "Nix 2\&.3\&.7" "Command Reference"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
nix-channel \- manage Nix channels
.SH "SYNOPSIS"
.HP \w'\fBnix\-channel\fR\ 'u
\fBnix\-channel\fR {\fB\-\-add\fR\ \fIurl\fR\ [\fIname\fR] | \fB\-\-remove\fR\ \fIname\fR | \fB\-\-list\fR | \fB\-\-update\fR\ [\fInames\fR...] | \fB\-\-rollback\fR\ [\fIgeneration\fR] }
.SH "DESCRIPTION"
.PP
A Nix channel is a mechanism that allows you to automatically stay up\-to\-date with a set of pre\-built Nix expressions\&. A Nix channel is just a URL that points to a place containing a set of Nix expressions\&.
.PP
This command has the following operations:
.PP
\fB\-\-add\fR \fIurl\fR [\fIname\fR]
.RS 4
Adds a channel named
\fIname\fR
with URL
\fIurl\fR
to the list of subscribed channels\&. If
\fIname\fR
is omitted, it defaults to the last component of
\fIurl\fR, with the suffixes
\-stable
or
\-unstable
removed\&.
.RE
.PP
\fB\-\-remove\fR \fIname\fR
.RS 4
Removes the channel named
\fIname\fR
from the list of subscribed channels\&.
.RE
.PP
\fB\-\-list\fR
.RS 4
Prints the names and URLs of all subscribed channels on standard output\&.
.RE
.PP
\fB\-\-update\fR [\fInames\fR\&...]
.RS 4
Downloads the Nix expressions of all subscribed channels (or only those included in
\fInames\fR
if specified) and makes them the default for
\fBnix\-env\fR
operations (by symlinking them from the directory
~/\&.nix\-defexpr)\&.
.RE
.PP
\fB\-\-rollback\fR [\fIgeneration\fR]
.RS 4
Reverts the previous call to
\fBnix\-channel \-\-update\fR\&. Optionally, you can specify a specific channel generation number to restore\&.
.RE
.PP
Note that
\fB\-\-add\fR
does not automatically perform an update\&.
.PP
The list of subscribed channels is stored in
~/\&.nix\-channels\&.
.SH "EXAMPLES"
.PP
To subscribe to the Nixpkgs channel and install the GNU Hello package:
.sp
.if n \{\
.RS 4
.\}
.nf
$ nix\-channel \-\-add https://nixos\&.org/channels/nixpkgs\-unstable
$ nix\-channel \-\-update
$ nix\-env \-iA nixpkgs\&.hello
.fi
.if n \{\
.RE
.\}
.PP
You can revert channel updates using
\fB\-\-rollback\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
$ nix\-instantiate \-\-eval \-E \*(Aq(import {})\&.lib\&.nixpkgsVersion\*(Aq
"14\&.04\&.527\&.0e935f1"
$ nix\-channel \-\-rollback
switching from generation 483 to 482
$ nix\-instantiate \-\-eval \-E \*(Aq(import {})\&.lib\&.nixpkgsVersion\*(Aq
"14\&.04\&.526\&.dbadfad"
.fi
.if n \{\
.RE
.\}
.SH "FILES"
.PP
/nix/var/nix/profiles/per\-user/\fIusername\fR/channels
.RS 4
\fBnix\-channel\fR
uses a
\fBnix\-env\fR
profile to keep track of previous versions of the subscribed channels\&. Every time you run
\fBnix\-channel \-\-update\fR, a new channel generation (that is, a symlink to the channel Nix expressions in the Nix store) is created\&. This enables
\fBnix\-channel \-\-rollback\fR
to revert to previous versions\&.
.RE
.PP
~/\&.nix\-defexpr/channels
.RS 4
This is a symlink to
/nix/var/nix/profiles/per\-user/\fIusername\fR/channels\&. It ensures that
\fBnix\-env\fR
can find your channels\&. In a multi\-user installation, you may also have
~/\&.nix\-defexpr/channels_root, which links to the channels of the root user\&.
.RE
.SH "CHANNEL FORMAT"
.PP
A channel URL should point to a directory containing the following files:
.PP
nixexprs\&.tar\&.xz
.RS 4
A tarball containing Nix expressions and files referenced by them (such as build scripts and patches)\&. At the top level, the tarball should contain a single directory\&. That directory must contain a file
default\&.nix
that serves as the channel\(cqs \(lqentry point\(rq\&.
.RE
.SH "AUTHOR"
.PP
\fBEelco Dolstra\fR
.RS 4
Author
.RE
.SH "COPYRIGHT"
.br
Copyright \(co 2004-2018 Eelco Dolstra
.br