"man" produces gibberish

After doing a nixos-rebuild, if I type man man, I now get:

<standard input>:4: warning: can't find character with input code 2
<standard input>:4: warning: can't find character with input code 4
<standard input>:4: warning: can't find character with input code 6
<standard input>:4: warning [p 1, 0.0i]: can't break line
<standard input>:4: warning: can't find character with input code 127
<standard input>:4: warning: can't find character with input code 7
<standard input>:5: warning: can't find character with input code 5
<standard input>:9: warning [p 1, 0.7i]: can't break line
<standard input>:10: warning: can't find character with input code 12
<standard input>:11: warning: numeric expression expected (got `J')
<standard input>:15: warning [p 1, 1.7i]: cannot adjust line
<standard input>:16: warning [p 1, 1.8i]: cannot adjust line
<standard input>:16: warning [p 1, 2.0i]: can't break line
<standard input>:19: warning: numeric expression expected (got `�')
<standard input>:19: warning [p 1, 2.5i]: cannot adjust line
<standard input>:19: warning [p 1, 2.7i]: cannot adjust line
<standard input>:19: warning [p 1, 2.8i]: cannot adjust line
<standard input>:20: cannot use character `1' as a starting delimiter
<standard input>:20: warning [p 1, 3.2i]: can't break line
^H<B5>[[w<E3><B8>~ǯ<C0>jZ<CE>h<CB>=<EE><CB>l2'<BE><B6><F8><B6>{;<B3>qv6E<B0>        Ҳ<FA><E4><C7>o]<ED><E9><C9>d2cĥP<A8><FA><EA><AB>:<B9><EB><E4><AE>'?<E8><AA>ҩTue<AA>2Sek9+<ED>R.U<CB><C9>ZVM<A6>6y]j馥)<AA><DF><D2><CB>B͵ٻʾ<CA>S<EC>/Zl5=m<B1>.<CD>|Q<C9>
... and more gibberish like that

I’m using an identical NixOS configuration (apart from hardware stuff) on another machine, and I don’t have this problem.

# nix-channel --list
nixos https://nixos.org/channels/nixos-19.03

My configuration.nix:

$ cat /etc/nixos/configuration.nix
{ config, pkgs, options, ... }:


  networking.hostName = "wombat9000"; # Define your hostname.

  imports =
    [ # Include the results of the hardware scan.


My wombat9000.nix:

$ cat /home/amy/dotWombat/nixos/wombat9000.nix
{ config, pkgs, ... }:

  boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only

My R.nix and python3.nix files are probably not relevant.

My base.nix is below. I’m guessing the problem has something to do with the i18n section, but I don’t think I’ve changed that since I first installed NixOS.

$ cat /home/amy/dotWombat/nixos/base.nix 
{ config, pkgs, options, ... }:

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  # boot.loader.grub.efiSupport = true;
  # boot.loader.grub.efiInstallAsRemovable = true;
  # boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  # boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
  # boot.initrd.checkJournalingFS = false;

  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = ",localhost,internal.domain";

  # Select internationalisation properties.
  i18n = {
    consoleFont = "Lat2-Terminus16";
    consoleKeyMap = "uk";
    defaultLocale = "en_IE.UTF-8";

  # Set your time zone.
  time.timeZone = "Europe/Dublin";

  nixpkgs.overlays = [
    (import /home/amy/nix-overlays/default.nix)

  # Allow software with an unfree license
  nixpkgs.config.allowUnfree = true;

  # Packages I want to use
  environment.systemPackages = import /home/amy/dotWombat/nixos/packages.nix pkgs;

  # Set the JAVA_HOME environment variable
  programs.java.enable = true;

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = { enable = true; enableSSHSupport = true; };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # Enable CUPS to print documents.
  # services.printing.enable = true;

  # Enable sound.
  sound.enable = true;
  hardware.pulseaudio.enable = true;

  # Enable the X11 windowing system.
  # services.xserver.enable = true;
  # services.xserver.layout = "uk";
  # services.xserver.xkbOptions = "eurosign:e";
  services.xserver = {
    enable = true;
    layout = "ie";
    windowManager.xmonad = {
      enable = true;
      enableContribAndExtras = true;
      extraPackages = haskellPackages: [

  # Enable touchpad support.
  # services.xserver.libinput.enable = true;

  # Enable the KDE Desktop Environment.
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  nix.gc.automatic = true;
  nix.gc.dates = "06:15";

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.amy = {
    isNormalUser = true;
    home = "/home/amy";
    description = "Amy de Buitleir";
    extraGroups = [ "wheel" "networkmanager" "vboxsf" ];
    uid = 1000;

  # This value determines the NixOS release with which your system is to be
  # compatible, in order to avoid breaking some software such as database
  # servers. You should change this only after NixOS release notes say you
  # should.
  system.stateVersion = "18.09"; # Did you read the comment?

My packages.nix is probably not relevant.

$ locale

What is your new nixos-version?

$ nixos-version
19.03.173408.bd6ba87381e (Koi)

Hmm… Can’t reproduce it:

nix run -f https://github.com/NixOS/nixpkgs/archive/bd6ba87381e.tar.gz man -c env LANG=en_IE.utf8 man man

Does the above work?

Yes, that works fine.

I did a nixos-rebuild switch --upgrade, and it succeeded without errors. But now, in addition to producing the gibberish in my first post (in the pager), I get the following on stderr.

$ man man
Unrecognized line in config file (ignored)
MANDB_MAP /usr/man /var/cache/man/fsstnd
Unrecognized line in config file (ignored)
MANDB_MAP /run/current-system/sw/share/man /var/cache/man
Unrecognized line in config file (ignored)
MANDB_MAP /usr/local/man /var/cache/man/oldlocal
Unrecognized line in config file (ignored)
MANDB_MAP /run/current-system/sw/share/man /var/cache/man/local
Unrecognized line in config file (ignored)
MANDB_MAP /usr/X11R6/man /var/cache/man/X11R6
Unrecognized line in config file (ignored)
MANDB_MAP /opt/man /var/cache/man/opt
Unrecognized line in config file (ignored)
SECTION 1 n l 8 3 0 2 5 4 9 6 7

$ nixos-version
19.03.173522.021d733ea3f (Koi)

I have never made any changes to /etc/man.confsince the day I first installed NixOS. Here it is:

$ cat /etc/man.conf
# man_db.conf
# This file is used by the man-db package to configure the man and cat paths.
# It is also used to provide a manpath for those without one by examining
# their PATH environment variable. For details see the manpath(5) man page.
# Lines beginning with `#' are comments and are ignored. Any combination of
# tabs or spaces may be used as `whitespace' separators.
# There are three mappings allowed in this file:
# --------------------------------------------------------
# MANDATORY_MANPATH                     manpath_element
# MANPATH_MAP           path_element    manpath_element
# MANDB_MAP             global_manpath  [relative_catpath]
# every automatically generated MANPATH includes these fields
#MANDATORY_MANPATH                      /usr/src/pvm3/man
MANDATORY_MANPATH                       /usr/man
MANDATORY_MANPATH                       /run/current-system/sw/share/man
MANDATORY_MANPATH                       /run/current-system/sw/share/man
# set up PATH to MANPATH mapping
# ie. what man tree holds man pages for what binary directory.
#               *PATH*        ->        *MANPATH*
MANPATH_MAP     /bin                    /run/current-system/sw/share/man
MANPATH_MAP     /usr/bin                /run/current-system/sw/share/man
MANPATH_MAP     /sbin                   /run/current-system/sw/share/man
MANPATH_MAP     /usr/sbin               /run/current-system/sw/share/man
MANPATH_MAP     /usr/local/bin          /usr/local/man
MANPATH_MAP     /usr/local/bin          /run/current-system/sw/share/man
MANPATH_MAP     /usr/local/sbin         /usr/local/man
MANPATH_MAP     /usr/local/sbin         /run/current-system/sw/share/man
MANPATH_MAP     /usr/X11R6/bin          /usr/X11R6/man
MANPATH_MAP     /usr/bin/X11            /usr/X11R6/man
MANPATH_MAP     /usr/games              /run/current-system/sw/share/man
MANPATH_MAP     /opt/bin                /opt/man
MANPATH_MAP     /opt/sbin               /opt/man
# For a manpath element to be treated as a system manpath (as most of those
# above should normally be), it must be mentioned below. Each line may have
# an optional extra string indicating the catpath associated with the
# manpath. If no catpath string is used, the catpath will default to the
# given manpath.
# You *must* provide all system manpaths, including manpaths for alternate
# operating systems, locale specific manpaths, and combinations of both, if
# they exist, otherwise the permissions of the user running man/mandb will
# be used to manipulate the manual pages. Also, mandb will not initialise
# the database cache for any manpaths not mentioned below unless explicitly
# requested to do so.
# In a per-user configuration file, this directive only controls the
# location of catpaths and the creation of database caches; it has no effect
# on privileges.
# Any manpaths that are subdirectories of other manpaths must be mentioned
# *before* the containing manpath. E.g. /usr/man/preformat must be listed
# before /usr/man.
#               *MANPATH*     ->        *CATPATH*
MANDB_MAP       /usr/man                /var/cache/man/fsstnd
MANDB_MAP       /run/current-system/sw/share/man                /var/cache/man
MANDB_MAP       /usr/local/man          /var/cache/man/oldlocal
MANDB_MAP       /run/current-system/sw/share/man        /var/cache/man/local
MANDB_MAP       /usr/X11R6/man          /var/cache/man/X11R6
MANDB_MAP       /opt/man                /var/cache/man/opt
# Program definitions.  These are commented out by default as the value
# of the definition is already the default.  To change: uncomment a
# definition and modify it.
#DEFINE         pager
#DEFINE         cat     cat
#DEFINE         tr      tr '\255\267\264\327' '\055\157\047\170'
#DEFINE         grep    grep
#DEFINE         troff   groff -mandoc
#DEFINE         nroff   nroff -mandoc
#DEFINE         eqn     eqn
#DEFINE         neqn    neqn
#DEFINE         tbl     tbl
#DEFINE         col 
#DEFINE         vgrind 
#DEFINE         refer   refer
#DEFINE         grap 
#DEFINE         pic     pic -S
#DEFINE         compressor      gzip -c7
# Misc definitions: same as program definitions above.
#DEFINE         whatis_grep_flags               -i
#DEFINE         apropos_grep_flags              -iEw
#DEFINE         apropos_regex_grep_flags        -iE
# Section names. Manual sections will be searched in the order listed here;
# the default is 1, n, l, 8, 3, 0, 2, 5, 4, 9, 6, 7. Multiple SECTION
# directives may be given for clarity, and will be concatenated together in
# the expected way.
# If a particular extension is not in this list (say, 1mh), it will be
# displayed with the rest of the section it belongs to. The effect of this
# is that you only need to explicitly list extensions if you want to force a
# particular order. Sections with extensions should usually be adjacent to
# their main section (e.g. "1 1mh 8 ...").
SECTION         1 n l 8 3 0 2 5 4 9 6 7
# Range of terminal widths permitted when displaying cat pages. If the
# terminal falls outside this range, cat pages will not be created (if
# missing) or displayed.
# If CATWIDTH is set to a non-zero number, cat pages will always be
# formatted for a terminal of the given width, regardless of the width of
# the terminal actually being used. This should generally be within the
#CATWIDTH       0
# Flags.
# NOCACHE keeps man from creating cat pages.

Having the same issue on version 19.03.173682.8a3b960203b (Koi).

Any ideas?

19.03 is no longer actively maintained, I would upgrade to 19.09, follow https://unix.stackexchange.com/questions/491727/how-do-i-upgrade-nixos-to-use-a-new-channel-nixos-version for steps to do so

I’m on 19.09 now and I’m still having the problem on that machine. As I said before I’m using an identical NixOS configuration (apart from hardware stuff) on another machine, and I don’t have this problem there.