Get all information about all packages

In the documentation, I found a good way to get a list of all packages with detailed information for them.
$ nix-env -qa --meta --json > packages.json
However, there is no information about “Programs provided”, which is in search.nixpkgs.org .

How can this problem be solved?

nix-env only gives you evaluation-time information, i.e. what you get at the level of Nix expressions. The online package search has access to build-time data — not even sure how it works exactly, there’s some magic going on where data is put into an ElasticSearch instance, but I don’t know where it comes from — which you only get by performing a lot of computation. There’s nix-index that ships with a (massive) database and allows offline queries:

I’d love to get work funded to make that the default experience. Maybe we can get some of that done next year.

4 Likes

Well… This is a very good option. But, unfortunately, I still could not figure out how to get the necessary data - programs provided. I even unpacked index-x86_64-linux separately.
I found the necessary data there. However, I do not understand how to extract this whole thing correctly.
I think I will use nix-search from nix-search-cli. First, I will get a list of packages via nix-env, and then I will methodically go through package after package in several streams, writing all the values to the database data.