Confusion about channels

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?

1 Like

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.

Yes that’s correct @AdrianVovk . Once the hydra evaluation succeeds the latest succeeding commit is also pushed to GitHub - NixOS/nixpkgs-channels: DEPRECATED! Use NixOS/nixpkgs repository instead. 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.

2 Likes

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

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

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

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 Channels for NixOS project(s)
    • 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?

@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.

2 Likes

@danbst
Yes, what I dislike about nix-channel is that it does not expose the bare git repository to the user. If I want to use the nixpkgs from my git repository in my nixos system configuration, won’t I have to do something like

let pkgs = /path/to/my/nixpkgs

I just want my system to know that the canonical nixpkgs lives in some specific place, and have that place be managed by a git repository that I can interact with using normal git commands. As far as I can tell, I’ll still need to be explicit about which nixpkg im using unless I use the channel mechanism.