Confusion about channels


#1

I just took a look at the nixos-unstable branch on github and noticed that it is currently using emacs26

however, on my machine I seem to have emacs25 installed. What’s going on here?

More generally:
The nix community already seems pretty heavily invested in git (use github for pull requests etc.). Why have a channel mechanism that does not seem to use git?


#2

My understanding of nix channels is pretty limited but I think I may know the answer here.

Each nix channel is checked out on NixOS’s build servers. The servers compile the software in the channel and run tests. If the tests succeed (and at least if certain set of the software in the channel compiles successfully), the channel is published and everyone’s machine gets it.

Basically, the git may have version 26 in the master branch, which the server checked out and started running tests. Let’s say that hypothetically GCC is broken in the master branch of nixpkgs, so the entire branch is rejected and the old version remains as the “unstable” branch. This will continue until GCC is marked broken or is fixed, which will then allow the tests to succeed and will let nixpkgs update.

IDK if this makes any sense or is even correct. Hopefully someone knowledgeable can explain it better.


#3

Yes that’s correct @AdrianVovk . Once the hydra evaluation succeeds the latest succeeding commit is also pushed to https://github.com/nixos/nixpkgs-channels in the respective git branch.

Once is a while a channel gets “stuck” until somebody fixes it. If that happens, go to http://howoldis.herokuapp.com/ to get more information about the failing builds.


#4

Great. I started a thread (improvements to nixpkgs), where I try to come up with a solution to this.


#5

Why is it pushed in a separate repository (nixpkgs-channels) rather than in a branch in the nixpkgs?


#6

To separate a user-managed repo from a machine-managed repo.


#7

I found this thread looking for clarity on this question:

what is the difference between the nixpkgs and the nixpkgs-channels repositories

To make sure I understand the picture correctly:

  • nixpkgs
    • the human-managed repo in which all the packages in the various nix channels is developed, arranged, and organized
    • this is the repo we can use to contribute and to see what is currently in development (or has been developed).
  • nixpkgs-channels
    • the machine-managed repo, and changes there reflect the actual content available on https://nixos.org/channels
    • this is the repo we should look to if we want to see what is currently available in the channels (and what will be installed from a given channel, which is tracked by the different branches of the channel).

Is this correct?


#8

@shonfeder

Correct

Channel mechanism relies on Git! But it is not visible for end user. Should it? If all you don’t like is nix-channel utility, then good news for you, it is replacable:

  • nix-channel --add https://nixos.org/channels/XXXX can be replaced with git clone -b XXXX https://github.com/nixos/nixpkgs-channel
  • nix-channel --list is essentially ls now
  • nix-channel --update can be replace with git pull
  • nix-channel --rollback GENERATION can be replaced with
$ git checkout \
    $(git reflog --date=iso|grep pull|sed -n 'GENERATION p'|awk '{print $1}')

There are rare (very rare) cases when channel is rolled back, but it is not reflected in nixpkgs-channel repo.