-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace `command-not-found' with nix-index #39789
Comments
Deprecating command-not-found.pl after it has been established that nix-index is better for the existing use case is 👍 for me. First add a default off NixOS module which uses nix-index instead of command-not-found.pl, collect some data about usage (for example, your own), and then use that to build the case for actually making that optional module the default. |
Quoting myself from #88590
@bennofs said, he would add support for reading databases from multiple locations which would allow to have a smaller database that we install by default and a bigger one that could be installed on demand. |
I marked this as stale due to inactivity. → More info |
I still think this would be good, even with a 27MB database (since it can easily be disabled for minimal images). With a 270KB database, it's a no-brainer. |
I marked this as stale due to inactivity. → More info |
still relevant. |
For those who found this from search and want to use nix-index and already use home-manager, https://nix-community.github.io/home-manager/options.html#opt-programs.nix-index.enable If you would also like to pin your system nixpkgs to the one in your flake.nix, it seems to be as easy as |
nix-index is much slower than
This makes sense, since nix-index has to store a lot more information and support partial searches, but it makes nix-index difficult to use as a "command not found" handler. Since |
Is this not just because the current index is bigger? If nix-index would use a smaller database that just contains |
Hmm... that appears to be true. This change makes sense, then, especially if the |
Since we're on the subject, how does nix-locate get the db? C-n-f gets it via the channel, but that is not available in flakes. It would be nice to have a mapping from Hydra build commitishes to nix-locate-bin-only output hashes |
I decided to implement prefix filtering in Here is the @nix-index <hexagon:~/prog/repos/nix-index>% du -sh data/files
2.8M data/files The @nix-index <hexagon:~/prog/repos/nix-index>% time nix-locate --at-root -w '/bin/yt-dlp' --db data/
yt-dlp.out 713 x /nix/store/57sxxkq50rpkrww2s8j7y316avg90f1h-python3.9-yt-dlp-2022.2.4/bin/yt-dlp
yt-dlp-light.out 648 x /nix/store/c0zg1q1dv17shdmchkzhvpj1mq6dfwl7-python3.9-yt-dlp-2022.2.4/bin/yt-dlp
python310Packages.yt-dlp.out 717 x /nix/store/9snrnr6wxpyzylzmqbq6dm9lg6gpyg8d-python3.10-yt-dlp-2022.2.4/bin/yt-dlp
python310Packages.yt-dlp-light.out 652 x /nix/store/appg4gd91hq32425p4ran8ajs27dxa0p-python3.10-yt-dlp-2022.2.4/bin/yt-dlp
nix-locate --at-root -w '/bin/yt-dlp' --db data/ 0.03s user 0.01s system 97% cpu 0.039 total It works at about the same speed. Overall, I would say using Here is what needs to happen on the
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
@bennofs has created a useful project called nix-index which provides an index of files built by Hydra
https://github.com/bennofs/nix-index
In many ways it is similar to command-not-found.pl. Some advantages of nix-index, though:
I'm wondering whether people think this would be worthwhile to do? Instead of shipping channels with programs.sqlite we could include the generated nix-index. It would probably be slightly larger but also much more versatile.
The text was updated successfully, but these errors were encountered: