Why don't certain packages appear in nix search/nix-env -qa?

Hi, I’m relatively new to Nix. I’ve set up NixOS using flakes and I’ve installed Nushell. My nixpkgs is pinned to 23.11.

I wanted to install a Nushell plugin called query. Nushell’s own docs are fairly terse about how to install plugins, merely instructing you to point to a local file path where the plugin is located. I tried searching for a plugins package using nix-env -qa nushell and nix search nixpkgs nushell, but I didn’t get anything that looked like a plugin. Ditto for searching via the website.

Then I noticed in the nixpkgs repo that my plugin was already inside of nixpkgs 23.11. I also noticed that the pname attribute is nushell_plugin_query, which I vaguely recollected from trying Nix years ago was significant. But I couldn’t find nushell_plugin_query in any of my searches.

Then I had hunch that if I searched the website for “nushell” in the unstable channel that something might show up. Indeed, my hunch was correct and I was able to find the plugin under nushellPlugins.query.

From there, I was able to install the plugin by adding pkgs.nushellPlugins.query to my home.packages list in my home-manager config. But this process raised a few questions:

  • Why does the query plugin show up under unstable but not 23.11 even though the plugin is available in the nixos-23.11 nixpkgs repo branch?
  • Why is the plugin accessible using pkgs.nushellPlugins.query when the package name is nushell_plugin_query? Shouldn’t it be available nder pkgs.nushell_plugin_query? Does the pname have any significance?
  • Why was I able to install the package on my system when nix-env and nix search couldn’t find it?