Difference between revisions of "Nix channels"

From NixOS Wiki
Jump to: navigation, search
(remove separate 'unstable' section, as it was duplicate information (and partly wrong at that))
(replace howoldis page (which currently doesn't work) with https://status.nixos.org/)
Line 3: Line 3:
 
A "channel" is a name for the latest "verified" git commits in Nixpkgs. Each channel has a different definition of what "verified" means. Each time a new git commit is verified, the channel declaring this verification gets updated. Contrary to a user of the git master branch, a channel user will benefit from both verified commits and binary packages from the binary cache.
 
A "channel" is a name for the latest "verified" git commits in Nixpkgs. Each channel has a different definition of what "verified" means. Each time a new git commit is verified, the channel declaring this verification gets updated. Contrary to a user of the git master branch, a channel user will benefit from both verified commits and binary packages from the binary cache.
  
Channels are reified as git branches in the [https://github.com/nixos/nixpkgs-channels nixpkgs-channels] repository and as disk images in the [https://nixos.org/channels/ channels webpage]. There is also the handy [http://howoldis.herokuapp.com/ howoldis app] that tracks the age of channels.
+
Channels are reified as git branches in the [https://github.com/nixos/nixpkgs-channels nixpkgs-channels] repository and as disk images in the [https://nixos.org/channels/ channels webpage]. There is also the handy [https://status.nixos.org/ nix channel status webpage] that tracks the age of channels.
  
 
There are several channels, each with its own use case and verification phase.
 
There are several channels, each with its own use case and verification phase.

Revision as of 23:40, 18 March 2020

Nixpkgs is the git repository containing all packages and NixOS modules/expressions. Installing packages directly from the master branch of the Nixpkgs repo is possible, but risky, since git commits are merged into master before being heavily tested. That's where channels are useful.

A "channel" is a name for the latest "verified" git commits in Nixpkgs. Each channel has a different definition of what "verified" means. Each time a new git commit is verified, the channel declaring this verification gets updated. Contrary to a user of the git master branch, a channel user will benefit from both verified commits and binary packages from the binary cache.

Channels are reified as git branches in the nixpkgs-channels repository and as disk images in the channels webpage. There is also the handy nix channel status webpage that tracks the age of channels.

There are several channels, each with its own use case and verification phase.

The official channels

Channels can be broadly categorized into stable and unstable channels, and large and small channels:

  • Stable/unstable:
    • Stable channels (nixos-19.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, nixpkgs-unstable) correspond to the main development branch (master) of Nixpkgs, delivering the latest tested updates on a rolling basis.
  • Large/small:
    • Large channels (nixos-19.09, nixos-unstable) provide binary builds for the full breadth of Nixpkgs.
    • Small channels (nixos-19.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.

Most users will want the stable/large channel, currently nixos-19.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.

Channel update process

Each unstable channel has a particular job at hydra.nixos.org which must succeed:

Once the job succeeds at a particular nixpkgs commit, cache.nixos.org will download binaries from hydra.nixos.org.

When the download completes, the channel updates.

To find out when a channel was last updated, check this page.