command-not-found: suggest nix-shell as well#74993
command-not-found: suggest nix-shell as well#74993raboof wants to merge 1 commit intoNixOS:masterfrom
Conversation
| use Config; | ||
|
|
||
| my $program = $ARGV[0]; | ||
| my $quoted_command = '"' . shell_quote(@ARGV) . '"'; |
There was a problem hiding this comment.
is this guaranteed to be correct?
There was a problem hiding this comment.
likely not - but for corner cases what is 'correct' might be different depending on what shell the user is using, and taking that into account seems excessive.
| nix-env -iA nixos.$package | ||
|
|
||
| Or run it once with: | ||
| nix-shell -p $package --run $quoted_command |
There was a problem hiding this comment.
that should be nix run then, not nix-shell
There was a problem hiding this comment.
nix run is "experimental" and may even disappear behind a feature flag in the next release.
There was a problem hiding this comment.
yes, I've seen that change. That's really backwards. nix-shell is causing lots of trouble for just running applications because of the hooks, now we have a solution, and then it would "disappear" again 😕
There was a problem hiding this comment.
Yes, I agree. But we shouldn't recommend it until that problem is solved.
There was a problem hiding this comment.
Where is putting nix run behind a feature flag discussed? I find it very useful.
| EOF | ||
| print STDERR " nix-env -iA nixos.$_->{package}\n" foreach @$res; | ||
| print STDERR "\nOr run it once with:\n"; | ||
| print STDERR " nix-shell -p $_->{package} --run $quoted_command\n" foreach @$res; |
|
see also #74789 |
|
Conflicts with #74789 (rewrite of command-not-found to C++) |
Yes, though only somewhat: merging this before #74789 might be fine (it would be an easy-to-resolve conflict there, and make the feature disappear again when #74789 is merged, but I'd say that's fine). Indeed when #74789 is merged first we can close this one (and I could look into building the feature in C++ instead). (#74789 looks fine to me but from the comments it seemed somewhat controversial, so I wasn't sure whether to expect it to be merged any time soon (or at all) ) |
|
It looks like all improvements of command-not-found are stalled because there is a plan to replace it with nix-index (#39789). I guess I should take that for a spin (as documented at https://github.com/bennofs/nix-index#usage-as-a-command-not-found-replacement) and if it seems nice port this PR to that tool. |
Motivation for this change
Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"./result/bin/)nix path-info -Sbefore and after)Notify maintainers
cc @