Man -k . & apropos . return "nothing appropriate"

I want to list all the manpages I have but when I run man -k . or apropos . I get “.: nothing appropriate.”. Individual man pages works fine though, how can I fix this issue?

I’m using flakes, my nix version is nix (Nix) 2.4pre20210326_dd77f71 & running macOS 11.6 & also nix-darwin


This is an issue where the man and apropos commands are installed (as a dependency of another package?) but the relevant module has not been enabled.

If you enable the documentation module and cache generation as shown below then the commands will work like you expect: = {
    enable = true;
    generateCaches = true;

@Princemachiavelli I tried that, but it didn’t solve the problem, also generateCaches looks like it’s not supported in nix-darwin

apropos and man -k absolutely need a man-db cache to work. So, you better ask LnL7 or some other maintainer to port the new changes in documentation.nix to nix-darwin.

In the meantime you can do what generateCaches does behind the curtains:

environment.etc."man_db.conf".text =
    manualCache = pkgs.runCommandLocal "man-cache" { } ''
      echo "MANDB_MAP ${}/share/man $out" > man.conf
      ${}/bin/mandb -C man.conf -psc >/dev/null 2>&1
    # Manual pages paths for NixOS
    MANPATH_MAP /run/current-system/sw/bin /run/current-system/sw/share/man
    MANPATH_MAP /run/wrappers/bin          /run/current-system/sw/share/man

    # Generated manual pages cache for NixOS (immutable)
    MANDB_MAP /run/current-system/sw/share/man ${manualCache}
    # Manual pages caches for NixOS
    MANDB_MAP /run/current-system/sw/share/man /var/cache/man/nixos

Thanks, @rnhmjoj, will try this.

@LnL7 can you maybe look at this?