I just found comma, which lets you run
, command-name at the terminal and it will search nixpkgs for the binary, install the relevant package, and run the command. If there are more than one possible package it lets you choose with fzy. A friend had the idea to replace command-not-found with it, so that if you run a command that you don’t have installed, it just installs it and runs. I set it as
command_not_found_handler on zsh), and it works prefectly.
Is this worth putting in nixpkgs? Perhaps under
programs.command-not-found.auto-install = true;? If it was changed to always display a fuzzy-finder, it could maybe even replace the current command-not-found. Thoughts?
flip argument can be that I have found in some cases where some tools you want to choose the right one:
The program 'lspci' is not in your PATH. It is provided by several packages.
You can make it available in an ephemeral shell by typing one of the following:
nix-shell -p busybox
nix-shell -p pciutils
nix-shell -p toybox
Maybe I’m just a cliche “poweruser”, but I do really want to be specific about what packages i’m introducing to my system/shell.
If there are multiple places the program might have come from, comma pops up an interactive choice.
That’s also why I was suggesting there be an option to always behave that way, even when there is only 1 option, it would still prompt to confirm. Still not sure how that would work it’s way in exactly, but it’s a thought.
ah, didn’t know that, I guess that’s a nice experience in an interactive shell.