NixOS tab completions don't work at all
Closed this issue ยท 6 comments
I am using zsh with tmux, powerline10k on nixos and whenever I try to tab complete with anything beginning with trash
it simply moves the prompt to a new line, this doesn't happen with trash-cli.
@DariusChit could it be more related to the postInstall
?
https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/tools/misc/trash-cli/default.nix#L51
https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/tools/misc/trashy/default.nix
@FMGordillo
Sorry for the confusion, tab completions don't work with trash-cli either anymore, both have the same behaviour.
Haven't used trash-cli
sorry for that!
I was facing the same issue with fish
until I checked that it works, but not as we expect:
using only the trash
command doesn't give us autocompletion, but using the right command it does
I'm not sure how it works though, but when I ran completion trash
in fish
I got this
So... yeah, probably we should use an alias instead
I believe this was an issue in clap, the Command Line Argument Parser that trashy uses, however this issue was fixed on their side only after the latest release, here is an overlay that is built against the latest commit from 2024-01-19
(final: prev: {
trashy = prev.trashy.overrideAttrs (oldAttrs: rec {
pname = "trashy";
version = "unstable-2024-01-19";
src = prev.fetchFromGitHub {
owner = "oberblastmeister";
repo = "trashy";
rev = "7c48827e55bca5a3188d3de44afda3028837b34b";
sha256 = "sha256-1pxmeXUkgAITouO0mdW6DgZR6+ai2dax2S4hV9jcJLM=";
};
# I don't really know what this does I just changed the command name from the existing package
postInstall = pkgs.lib.optionalString (pkgs.stdenv.buildPlatform.canExecute pkgs.stdenv.hostPlatform) ''
installShellCompletion --cmd trashy \
--bash <($out/bin/trashy completions bash) \
--fish <($out/bin/trashy completions fish) \
--zsh <($out/bin/trashy completions zsh) \
'';
cargoDeps = oldAttrs.cargoDeps.overrideAttrs (prev.lib.const {
name = "${pname}-vendor.tar.gz";
inherit src;
outputHash = "sha256-2QITAwh2Gpp+9JtJG77hcXZ5zhxwNztAtdfLmPH4J3Y=";
});
});
})
applying this fixed the issue for me on zsh (and I'd guess it does on other shells too)
(just keep in mind that the command changed from trash
to trashy
)
@arminius-smh
Thanks for this, it was very helpful.
I managed to get it to work except I had to change the postInstall
line to:
postInstall = prev.lib.optionalString (prev.stdenv.buildPlatform.canExecute prev.stdenv.hostPlatform) ''
so just swapped pkgs
to prev