Skip to content

Instantly share code, notes, and snippets.

@jwfang
Created April 2, 2024 08:12
Show Gist options
  • Save jwfang/0dbdaf77745e225e0483daae4d570893 to your computer and use it in GitHub Desktop.
Save jwfang/0dbdaf77745e225e0483daae4d570893 to your computer and use it in GitHub Desktop.
NixOS colorful man pages, and support home-manager packages
  1. Get colorful man pages
  • replace man-db with mandoc, see NixOS wiki, and install most

in configuration.nix

documentation.man = {
# In order to enable to mandoc man-db has to be disabled.
man-db.enable = false;
mandoc.enable = true;
};
environment.sysemPackages = [
pkgs.most
];

you may want to install extra man pages, see above wiki

  • use most as MANPAGER, try it at terminal
MANPAGER=most man nix

now we have colorful man pages.

  1. home-manager configuration
  • home-manager default to enable man-db and not supporting mandoc at the moment (2024-04), so we need to disable it and use our man command from mandoc.

    program.man.enable = false;

  • configura MANPAGER to most, need to re-login to take effect:

home.sessionVariable = {
  MANPAGER = "most";
};
  • tell mandoc to find our man pages installed via home-manager
shellAlias = {
  man = "man -m ~/.nix-profile/share/man";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment