ZSH completions not being loaded

Hello everyone, I’m a new nix user, and I’m having an issue with ZSH completions.

I’m using nix with nix-darwin on m1 mac. My config (irrelevant bits skipped): darwin-configuration.nix · GitHub

I installed the gopass package (nixpkgs/default.nix at c32c39d6f3b1fe6514598fa40ad2cf9ce22c3fb7 · NixOS/nixpkgs · GitHub), and it works well except for the fact that the ZSH completions are not being loaded.

I searched for completions in the system and found those files:


But none of those paths is present in my $fpath. Also, my $fpath includes /Users/wojtek/.nix-profile/share/zsh/site-functions - I would expect the completion files to be symlinked there, but this directory does not exist at all.

When I run repl (nix repl '<nixpkgs>' '<darwin>' '<home-manager>') and then enter config.environment.pathsToLink it returns [ "/etc/profile.d" "/share/zsh" "/info" "/share/info" "/share/man" "/etc/bash_completion.d" "/share/bash-completion/completions" "/bin" "/share/locale" ].

As a workaround, I tried adding:

initExtraFirst = ''
  fpath=(${config.home-manager.users.wojtek.home.path}/share/zsh/site-functions/ $fpath)

To my zsh config, which did indeed fix completions for gopass, but it also broke completions for nix (I think that’s because site-functions in home-manager include them as well, and so they’re being loaded twice).

Does anyone perhaps know how to fix this? Thanks for all the help!


The completions work OK on NixOS.

Seems relevant: bug: hm installed zsh completions aren't added to fpath · Issue #2562 · nix-community/home-manager · GitHub