nix-community / nix-index

Quickly locate nix packages with specific files [maintainers=@bennofs @figsoda @raitobezarius]
Other
835 stars 48 forks source link

Allow filtering out results from FHS packages #233

Open athre0z opened 1 year ago

athre0z commented 1 year ago

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.

jwdevantier commented 10 months ago

Seconded, nix-locate is basically useless as-is

doronbehar commented 2 months ago

This can be fixed by merging #243 .

Ma27 commented 2 months ago

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.