nix-community / nix-index

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

feat: added prefix filtering support #177

Closed virchau13 closed 2 years ago

virchau13 commented 2 years ago

Added a way to only put paths starting with a certain prefix into the database, through a --filter-prefix flag. Should resolve #176, and is a way to solve NixOS/nixpkgs#39789.

--filter-prefix <PREFIX>    Only add paths starting with PREFIX (e.g. `/bin/`)

Some typos were also fixed.

bennofs commented 2 years ago

Thanks!

wmertens commented 2 years ago

Shouldn't this allow multiple paths? /bin and /sbin?

And this cannot be used to find .desktop files for something like a registry of all gui packages available, but maybe that would just use the entire index.

In any case, all those use cases could be covered with a regex match

bennofs commented 2 years ago

That's a good idea. I don't have much time right now to work on this but if anyone wants to replace the prefix filter by regex I am happy to review the changes.

virchau13 commented 2 years ago

Yes... a regex match would probably be better, lol. I implemented it this way mainly as a benchmark for nixpkgs#39789, and also because the change is so simple that it's hard to get wrong.