nix-channel1Nixnix-channelmanage Nix channelsnix-channelurlnamenamenamesgenerationDescriptionA Nix channel is 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 both a set of Nix
expressions and a pointer to a binary cache. See also .This command has the following operations:
url [name]Adds a channel named
name with URL
url to the list of subscribed channels.
If name is omitted, it defaults to the
last component of url, with the
suffixes -stable or
-unstable removed.nameRemoves the channel named
name from the list of subscribed
channels.Prints the names and URLs of all subscribed
channels on standard output. [names…]Downloads the Nix expressions of all subscribed
channels (or only those included in
names if specified), makes them the
default for nix-env operations (by symlinking
them from the directory ~/.nix-defexpr), and
performs a nix-pull on the manifests of all
channels to make pre-built binaries available. [generation]Reverts the previous call to nix-channel
--update. Optionally, you can specify a specific channel
generation number to restore.Note that does not automatically perform
an update.The list of subscribed channels is stored in
~/.nix-channels.ExamplesTo subscribe to the Nixpkgs channel and install the GNU Hello package:
$ nix-channel --add https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --update
$ nix-env -iA nixpkgs.helloYou can revert channel updates using :
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.nixpkgsVersion'
"14.04.527.0e935f1"
$ nix-channel --rollback
switching from generation 483 to 482
$ nix-instantiate --eval -E '(import <nixpkgs> {}).lib.nixpkgsVersion'
"14.04.526.dbadfad"
Files/nix/var/nix/profiles/username/channelsnix-channel uses a
nix-env profile to keep track of previous
versions of the subscribed channels. Every time you run
nix-channel --update, a new channel generation
(that is, a symlink to the channel Nix expressions in the Nix store)
is created. This enables nix-channel --rollback
to revert to previous versions.~/.nix-defexpr/channelsThis is a symlink to
/nix/var/nix/profiles/username/channels. It
ensures that nix-env 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.Channel formatA channel URL should point to a directory containing the
following files:nixexprs.tar.xzA tarball containing Nix expressions and files
referenced by them (such as build scripts and patches). At
top-level, the tarball should contain a single directory. That
directory must contain a file default.nix
that serves as the channel’s “entry point”.binary-cache-urlA file containing the URL to a binary cache (such
as https://cache.nixos.org. Nix will automatically
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
to the channels of non-root users are ignored. Binary caches can
be created and maintained using
nix-push.MANIFEST.bz2(Deprecated in favour of binary caches.) A
manifest as created by nix-push. Only used if
binary-cache-url is not present or if the
nix.conf option
is set.