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
2 Likes
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:
documentation.man = {
enable = true;
generateCaches = true;
};
4 Likes
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 =
let
manualCache = pkgs.runCommandLocal "man-cache" { } ''
echo "MANDB_MAP ${cfg.man.manualPages}/share/man $out" > man.conf
${pkgs.man-db}/bin/mandb -C man.conf -psc >/dev/null 2>&1
'';
in
''
# 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
'';
2 Likes
Thanks, @rnhmjoj, will try this.
@LnL7 can you maybe look at this?