Differences between Nix channels

I’ve managed to glean the following information about the various Nix channels. I haven’t found these facts in one place, so I’m posting them here. Please correct me for any inaccuracies.

Sources:

Differences between channels

  • There are four classes of NixOS channels:

    • nixos-xx.yy, the ‘LTS’ channels, denoted by version number
    • nixos-unstable the rolling-update unstable NixOS
    • nixpkgs-unstable, recommended for Nix-as-a-package-manager (NaaPM)
    • nixos-(xx.yy|unstable)-small, a subset of NixOS curated for minimal servers.
  • Despite all the docs advising nixos-* for NixOS and nixpkgs-* for NaaPM, there is theoretically nothing that prevents you from using nixos-* for NaaPM and nixpkgs-* for NixOS. It is merely assumed that NaaPM users already have a stable system and want cutting-edge packages, whilst NixOS users need to rely on a more stable set. Beware, however, that something may break, because maintainers will assume this convention is followed.

  • nixpkgs-unstable is a statement of fact rather than a variant - there is no nixpkgs-stable (except maybe for Darwin?)

  • The set of packages in nixpkgs-unstable is not related in any way to nixos-unstable. nixos-unstable is only slighty less stable than nixos-stable (and is intended for rolling updates), nixpkgs-unstable is quite a bit looser.

  • All three of them are based on the nixpkgs master branch. Each of them advance only if all of their tests are passing. The only difference is the list of tests that each of them have.

  • It seems that nixos-* runs a ‘tighter’ set of packages - different packages are more likely to depend on the same version of a dependency, so you’ll have less duplicate packages in /nix/store.

  • nixpkgs-* contains a lot of macOS (Darwin)- specific packages, which nixos-*, being Linux-based, doesn’t need.

  • Besides for the above points, and of course package versions, it seems there are very few (no?) packages available on nixpkgs which aren’t on nixos-*.

One takeaway is, if you’re running NaaPM on Linux and can survive not having the latest version of everything, subscribing to nixos-unstable instead of nixpkgs can save you some disk space.

6 Likes

All the “unstable” channels are a snapshot of master branch at a certain point of time, all the “stable” channels are a snapshot of release-*.* branch. (Think git tags that move along the respective branches.) The difference is how often they advance, or rather what are the criteria for their advancement (tests that need to succeed).

See https://howoldis.herokuapp.com/ for more info about how the channels advance.

3 Likes

The nixos channel also runs many more nixosTests as part of it jobset as well as constituents (required jobs for a channel release). And the nixos channel is the one which also creates the command database which is used for the command-not-found logic:

[09:15:16] jon@jon-desktop /home/jon/projects/nixpkgs (master)
$ kubectl
The program 'kubectl' is not in your PATH. It is provided by several packages.
You can make it available in an ephemeral shell by typing one of the following:
  nix-shell -p kubectl
  nix-shell -p kubernetes
  nix-shell -p openshift
1 Like
Hosted by Flying Circus.