I am looking for a shell command to display some information/metadata about a derivation. I can nix search nixpkgs nvimpager and it will give me a very short info:
* legacyPackages.x86_64-linux.nvimpager (0.10.4)
Use neovim as pager
But I would like to have a shell command that can show me more info, like the homepage or the long description from the meta attribute of the derivation.
Some other package managers have something like this, for example:
Debian/Ubuntu: apt info / apt-cache show
RHEL/Fedora: yum info / dnf info
ArchLinux: pacman -Si / pacman -Qi
VoidLinux: xbps-query -S
Alpine: apk info
Currently I am doing nix edit nixpkgs#nvimpager but that feels like an ugly hack and I have to close my editor afterwards and I can not list the info of several derivations at the same time. Is there any better command?
In the wiki I just found nix-env -qa --description '.*nvimpager.*' and nix-env -qa --xml --meta '.*nvimpager.*'. But the former is only the short description again and the latter is in xml. Additionally the searching is quite slow and I have to write a regex because I don’t understand how to specify a specific derivation directly. And it did not work on my NixOS system where I use flakes and the new nix command.
I don’t really see any details about how you function gets called, and I can infer that you’ve written a fish function that’s in your shell rc file that’s part of an auto-completion of something not shown.
Regardless, I managed to guesswork my way to a straightforward command-line I’ve confirmed works: