With pacman I can easily query database for containing files. For example:
pacman -F XInput2.h will show
extra/libxi 1.8-1 [installed]
I know there is GitHub - bennofs/nix-index: Quickly locate nix packages with specific files. But looking at the source code, I see they just query the binary cache server with every package’s hash. Is there a way to build file indexes more effectively?
No, I don’t think so. The binary cache is quite dumb. And thanks to that it’s relatively simple to distribute via a CDN.
nix-index can also have a local database, you don’t need to use the online binary cache
How did you enable that? I installed NixOS, and it doesn’t prompt like that by default.
Yeah, I know it caches file index.
I found unofficial nix-index-database, so it’s not an issue now. But if I can reuse nix-channels` cache, it would be better.
programs.command-not-found.enable, should be
true by default. I don’t know what’s wrong in your case.
The default DB path is
/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite so I’d start by checking its existence.
And in case the shell hook is not working for some reason, it’s possible to run explicitly, e.g.
Yes, the database wasn’t there. I found solution here (`command-not-found` unable to open database - #8 by cdepillabout)
I just run
sudo nix-channel --update to fix that.
programs.sqlite maps executable name to package name, I need full file index. Maybe it will be useful for someone,
programs.sqlite contains only in nixos channels. FYI you can download it from Channels for NixOS project(s)
Thanks, the issue is closed now.