nix-index icon indicating copy to clipboard operation
nix-index copied to clipboard

Allow filtering out results from FHS packages

Open athre0z opened this issue 11 months ago • 1 comments

There's a bunch of FHS packages in nixpkgs that essentially ship half a distro with them and massively pollute the output when searching for packages that provides common command line tools. For example I just wanted to locate the package that provides fsck.ext4 and more than 60 FHS packages matched, many of them somehow having fsck.ext4 in 4 different places within the package (some symlink foo, probably).

It takes quite a few seconds to locate the actually relevant e2fsprogs.bin line between the 240 lines of noise from FHS packages. This is not really specific to fsck.ext4 and I run into this problem quite frequently.

I think it'd make a lot of sense to automatically detect and tag these FHS packages, perhaps during the indexing phase, and to allow filtering them out with a option passed to nix-locate. Most of them seem to have a -fhs / -usr-target suffix somewhere in the paths, so it should hopefully be easy to detect them based on that. It might even make sense to invert that option, filtering out the FHS packages by default, but it'd be a rather breaking chance.

athre0z avatar Sep 03 '23 13:09 athre0z

Seconded, nix-locate is basically useless as-is

jwdevantier avatar Dec 05 '23 09:12 jwdevantier

This can be fixed by merging #243 .

doronbehar avatar Jul 25 '24 09:07 doronbehar

Adding --top-level should be sufficient to solve your problem. But I agree that it's a bit annoying since this should be the default. That's what #243 is for.

Ma27 avatar Jul 25 '24 10:07 Ma27