Tmux doesn't use tmux config generated by nix

Tmux does not use the tmux config at the default location

running tmux ignores the config file entirely

running ~ tmux -f .config/tmux/tmux.conf works and uses the tmux config generated by nix

here is tmux.nix, which is included as a module in homemanager. there are no other references to tmux anywhere

{ pkgs, ... }:

{
  programs.tmux = {
    enable = true;
    extraConfig = ''
      set -g status-fg white
      set -g status-bg black

      # C-b is not acceptable -- Emacs uses it
      set-option -g prefix C-q
    '';
   };
}

is is included in home.nix as a module here:

{ config, pkgs, ... }:

{
  # TODO please change the username & home directory to your own
  home.username = "arthur";
  home.homeDirectory = "/home/arthur";
  imports = [
    ./tmux.nix
  ]
 ...

the config is in the correct location and links to the generated config

โžœ  ~ ls -l  ~/.config/tmux/tmux.conf
lrwxrwxrwx 1 arthur users 85 Mar 29 11:30 /home/arthur/.config/tmux/tmux.conf -> /nix/store/2yhk2skcqpgmvb7ss41gdqdlp5gi5449-home-manager-files/.config/tmux/tmux.conf

What am I doing wrong?

At first glance, this should work as you expect.

Two potential points to check further:

  1. Archwiki sez tmux looks for its config in ~/.tmux.conf before going to ~/.config. Check that there is no config in the root of your home
  2. Using which tmux check that when you invoke tmux in your environment you are actually launching the binary and not a wrapper around it which forces some other config
1 Like

You got it in one try!

~ ยป which tmux                                            
tmux: aliased to _zsh_tmux_plugin_run

removing the tmux plugin from zsh solved the mystery

You can still use the oh-my-zsh tmux plugin if you wish.
ZSH_TMUX_CONFIG = "$HOME/.config/tmux/tmux.conf";

1 Like