Fish shell and manual page completion (NixOS + Home-Manager)

I would like to switch from my highly customized zsh setup to a simpler fish
shell setup on NixOS with home-manager. For my first steps I have the
following in my home-manager configuration (for testing I invoke fish
from zsh manually): = {
  enable = true;

Fish shell is unable to complete:

  1. Manual pages from my NixOS system like nix-env.
  2. Manual pages for the programs installed via home-manager like git.

Of course, invoking manual pages like nix-env or git-clone works.

What I’m doing wrong here? With zsh I get all the completions for
those manual pages.


 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.74, NixOS, 21.05.3892.70904d4a992 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - channels(root): `"nixos-21.05.3892.70904d4a992"`
 - channels(marcus): `"home-manager-21.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

For some reason fish needs a man-db cache to autocomplete the man. The generation of the cache is disabled by default because it’s quite expensive (and needs be rebuilt every time you change environment.systemPackages). If you enable fish in NixOS, then the cache will be built (

So, if you want to do this without NixOS, you have to port to home-manager. Otherwise just use the NixOS module instead of the home-manager one.

wonder if Home Manager - NixOS Wiki could be adapted to be aware of both.

Thanks a lot. So setting: = true; # NixOS = true; # home-manager

solves this. Now I understand: I’ve seen apropos somewhere in fishs completition functions and apropos requires the man-db in order to work.

Addendum: Setting this helps also for system packages (remove the shell you don’t use):

  environment.pathsToLink = [