-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
nix: flake output completion #2374
Comments
Need to have a look at it, but should have the same issue. The problem is the first invocation. E.g. there is one nix command that triggers the channel download, which is like ~15mb as far as i remember. |
Indeed it has that issue. I pin my nixpkgs, so it is almost always cached for me. It's honestly not that huge of an issue though IMHO. Better wait a few seconds every so often than to have no completion at all. It's the same with regular upstream bash completions, so, while obviously not ideal, this is intended behaviour. |
With flakes, the time to generate the completions are much faster than using channels, but the first time running the completions command on a flake still takes ~2ish seconds to generate, even if used on a flake located in a local directory. |
It currently cannot complete flake outputs but carapace can be configured to bridge bash completions for certain commands. See carapace-sh/carapace-bin#2374
For the NixOS users looking for solutions: I posted mine here |
I don't mind it being a bit slow, so I'm not against adding it. |
I did a little more digging. NIX_GET_COMPLETIONS takes a number which is the argument to complete (starting at 0). It is possible to first do something like |
Fixes: carapace-sh#2374 This will only complete attributes for flakes that are in the user's registry or are a local path. This means that the flake eval cache should be very useful for these completions, and that carapace won't go out and fetch random flakes when the user is trying to tab complete.
Fixes: #2374 This will only complete attributes for flakes that are in the user's registry or are a local path. This means that the flake eval cache should be very useful for these completions, and that carapace won't go out and fetch random flakes when the user is trying to tab complete.
Request
#2350 avoided adding these because fetching these was thought to be too slow (#2348).
This is however quite an essential feature using the nix CLI effectively.
cc @aftix
Proposed solution
Nix has built-in support for completions, couldn't those be leveraged?
NIX_GET_COMPLETIONS=2 nix build nixpkgs#
instantly returns a list of completions.Anything else?
No response
The text was updated successfully, but these errors were encountered: