Make zsh autocompletion work on macOS (#50)

This commit is contained in:
Sridhar Ratnakumar 2024-03-22 10:11:05 -04:00 committed by GitHub
parent 9aca65a017
commit 737dcda77e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,16 @@
# Fix broken autocompletion. See https://github.com/nix-community/home-manager/issues/2562.
{ flake, ... }:
{
home-manager.users.${flake.config.people.myself}.imports = [
({ config, ... }: {
programs.zsh.initExtraBeforeCompInit = ''
fpath+=("${config.home.profileDirectory}"/share/zsh/site-functions "${config.home.profileDirectory}"/share/zsh/$ZSH_VERSION/functions "${config.home.profileDirectory}"/share/zsh/vendor-completions)
'';
})
];
# Even though we enable zsh in home-manager, we still need to enable the
# nix-darwin module to make completions work.
programs.zsh.enable = true;
}

View file

@ -5,6 +5,7 @@
imports = [
flake.inputs.self.darwinModules.default
../nix-darwin/ci.nix
../nix-darwin/zsh-completion-fix.nix
];
nixpkgs.hostPlatform = "aarch64-darwin";