A Nix channel is a mechanism used by the legacy Nix CLI to keep Nixpkgs up to date. In the new Nix CLI, channels have been replaced by flakes.
A channel is a URL that points to some Nix code, such as https://nixos.org/channels/nixos-unstable
.
As a convenience, you can also use the URL syntax channel:{name}
, which is expanded by Nix to https://nixos.org/channels/{name}
.
You can configure Nix to fetch a channel automatically:
nix-channel --add https://nixos.org/channels/nixos-unstable
You can then run this to have Nix fetch all channels that you've configured:
nix-channel --update
The Nix code in the channels is unpacked into ~/.nix-defexpr/channels
where it can be found by legacy CLI commands such as nix-env
.
You can find more information about channels in the Nix manual.
Channel URL | Release date | Description |
---|---|---|
channel:nixos-22.11 |
Initially released in November of 2022 and updated for 6 months afterwards | A stable version of NixOS, released in November of 2022. Security patches and updates will be backported, but no new applications, or breaking changes will be applied |
channel:nixos-unstable |
Frequently updated | A rolling release channel of NixOS, which is updated whenever a set of important packages builds on Hydra. Security updates, new packages, and new modules will frequently appear on your computer, and breaking changes may occur |
channel:nixos-unstable-small |
Same as nixos-unstable , but even more frequently |
A rolling release channel similar to nixos-unstable but with a smaller set of packages that are tested. This means this channel is updated more frequently, but may have some broken packages on it as well |
nix-channel
The problem with channels is that they do not provide any guarantees about what inputs are actually used in a particular build.
A channel URL such as channel:nixos-22.11
can contain different Nix code at different points in time.
As such source pinning and rollbacks are much harder with channels.
This means that while Nix is reproducible in theory, in practise inputs to builds can frequently change, and a build may fail because of this. This can cause you to be unable to update your NixOS system, or build a package that previously could be built.
Because of this the use of Nix channels is highly discouraged!