Channel branches

From NixOS Wiki
Revision as of 10:16, 9 December 2017 by imported>Ixxie (Fixed section capitalization.)

Nix Channels are mechanisms for distributing Nix expressions as well as the associated binaries for them; a Nix channel corresponds to a repository in a conventional package management system. Official Nix channels are automatically updated once tests are passed in Nixpkgs' Hydra instance. It is also possible to create one's own Nix channels, but here we focus the official channels.

The official channels

Packages for Nix, as well as modules for NixOS are distributed through a number of channels. These channels can be broadly categorized into stable and unstable channels, and large and small channels:

  • Stable/unstable:
    • Stable channels (nixos-17.09) provide conservative updates for fixing bugs and security vulnerabilities, but do not receive major updates after initial release. New stable channels are released every six months.
    • Unstable channels (nixos-unstable, nixos-unstable-small) correspond to the main development branch of Nixpkgs, delivering the latest tested updates on a rolling basis.
  • Large/small:
    • Large channels (nixos-17.09, nixos-unstable) provide binary builds for the full breadth of Nixpkgs.
    • Small channels (nixos-17.09-small, nixos-unstable-small) are identical to large channels, but contain fewer binaries. This means they update faster, but require more to be built from source.

https://nixos.org/channels/ hosts the full list of the available official channels is available. Most users will want the stable/large channel, currently nixos-17.09.

Like packages installed via nix-env, channels are managed at user-level. NixOS uses the channels set for the root user to update the system-wide configuration; channels set for other users control only the user environment for that user. If you wish to change the channel used by the system-level configuration (/etc/nixos/configuration.nix), ensure you run the correct nix-channel command as root:

Common nix-channel commands
Listing current channels nix-channel --list
Adding a primary channel nix-channel --add https://nixos.org/channels/channel-name nixos
Adding other channels nix-channel --add https://some.channel/url my-alias
Remove a channel nix-channel --remove channel-alias
Updating a channel nix-channel --update channel-alias
Updating all channels nix-channel --update

Note that updating channels won't cause a rebuild in itself; if you want to update channels and rebuild, you can run nixos rebuild --upgrade to do both in one step.