Configuring tmux plugins in configuration.nix

Hi all,

Please can someone shed some light on how to load tmux plugins for all users via a NixOS config?

I’ve been trying to configure tmux with a default config specified via programs.tmux.extraTmuxConf, it’s working very well for keys, status bar and colours etc, but plugins simply do not work.

I can see the plugins installed in the nix store via their environment.systemPackages just fine, but don’t know how to get the plugins loaded by the /etc/tmux.conf that is generated by the extraTmuxConf.

For example, how would I get the “sidebar” plugin (NixOS Search) to load so that <prefix>+Tab opens the sidebar as expected?

Thanks in advance for any help.

1 Like

OK, solved it! Just needed to add something like the following into the programs.tmux.extraTmuxConf section…

run-shell ${pkgs.tmuxPlugins.sidebar}/share/tmux-plugins/sidebar/sidebar.tmux
2 Likes

This works very well @ianmjones. I was trying to configure something similar with GitHub - tmux-plugins/tmux-cpu: Plug and play cpu percentage and icon indicator for Tmux.

I wonder if it’d make sense to move sourcing of plugins after extraConfig instead. I was actually in the process of raising a PR for this with an option for an extra extra config which loads before plugins.

I have this same issue, where I need some config set before the plugin .tmux file is run, not after.