How do we see a list of available nixpkg channels?

Is there a command that lists available channels?

Eventually I discovered that I could visit the Channels for NixOS project(s) to see the list in my browser, but I was thinking there would be a command to do so, but the manual doesn’t seem to say.

I’ve never head of a command to list them, there’s two rather quick ways off the top of my head though:

git ls-remote -h https://github.com/nixos/nixpkgs-channels.git

and this:

curl -s https://howoldis.herokuapp.com/api/channels | jq '.[].name'

Hope that helps.

2 Likes

That makes sense if you know about those URLs and how they work. I think a simple nix command would be great.

2 Likes

Fundamentally, nix is a decentralized system, in the same way as git. The nix tool itself doesn’t treat nixpkgs channels from nixos.org specially, in the same way that git doesn’t treat github specially; it just happens to be a centralized community convention to group common nix expressions there, but they can come from anywhere – e.g., you can make your own private channels, cachix channels, Nix User Repository channels, and so on.

This is why the nix tool itself doesn’t have a “list all channels” command, just like git doesn’t have a “list all repos I could clone” command: it doesn’t know where they are, and there’s no centralized exhaustive list it can query. It might be nice to have some kind of wrapper like hub, though, for the common ones.

2 Likes

Nice. Makes sense. I suppose there is indeed an “official” list of channels; “official channels”. I’ll propose some updates to the manual to make this more obvious for total newbs like me. :slight_smile:

3 Likes

Alright, I opened a pull request to add a links to the official channels in the manual: Add a link to official channels in the docs. by trusktr · Pull Request #3308 · NixOS/nix · GitHub.