Tmux plugins fetched from github generate incorrect path in ~/.config/tmux/tmux.conf

I’m using a flake based Home Manager setup on macOS (22.11), and generally things are working really well. However, I am having trouble with fetching plugins from github.

In my tmux.nix (imported into home.nix) I have the following plugin section:

plugins = with pkgs; [
      {
        plugin = tmuxPlugins.mkTmuxPlugin {
          pluginName = "t-smart-tmux-session-manager";
          version = "a98dc1e";
          src = pkgs.fetchFromGitHub {
            owner = "joshmedeski";
            repo = "t-smart-tmux-session-manager";
            rev = "a98dc1ea64df0d945957362e177a15a4a695de3c";
            sha256 = "sha256-PWLl8h6bczLtcNL0cFwaCbq1K/0O3eR0/Z/5wbUuN+Y=";
          };
        };
      }
      {
        plugin = tmuxPlugins.mkTmuxPlugin {
          pluginName = "tmux-fzf-url";
          version = "d6435bd";
          src = pkgs.fetchFromGitHub {
            owner = "joshmedeski";
            repo = "tmux-fzf-url";
            rev = "d6435bdb24dda5bc68b26605b549f3a63cbded59";
            sha256 = "sha256-oMCG3B3aax/thHxruEYLwnD2ulre/E06gKq4hqNHBHc=";
          };
        };
      }
      {
        plugin = tmuxPlugins.mkTmuxPlugin {
          pluginName = "tmux-nerd-font-window-name";
          version = "b5948e8";
          src = pkgs.fetchFromGitHub {
            owner = "joshmedeski";
            repo = "tmux-nerd-font-window-name";
            rev = "b5948e82c4931cb253282046bb053025441d8c34";
            sha256 = "sha256-8Uw6WNHuohq7KFhCq8fS69rLvzYTc/mRf2drvczhC9A=";
          };
        };
      }
      { plugin = tmuxPlugins.vim-tmux-navigator; }
    ]

That installs the plugins fine in the nix store. If I look at the generated ~/.config/tmux/tmux.conf, the scripts are sourced (this is the just the first plugin for brevity):

# ============================================= #
# Load plugins with Home Manager                #
# --------------------------------------------- #

# tmuxplugin-t-smart-tmux-session-manager
# ---------------------

run-shell /nix/store/ij6ynsvczjnrrk2h6y7kass5mlqdl9sp-tmuxplugin-t-smart-tmux-session-manager-a98dc1e/share/tmux-plugins/t-smart-tmux-session-manager/t_smart_tmux_session_manager.tmux

It is not loading in tmux because the filename has the separating dashes replaced with underscores. This is the actual path in nix store:

/nix/store/ij6ynsvczjnrrk2h6y7kass5mlqdl9sp-tmuxplugin-t-smart-tmux-session-manager-a98dc1e/share/tmux-plugins/t-smart-tmux-session-manager/t-smart-tmux-session-manager.tmux

If I manually add a run-shell command with that correct path to the bottom of the extraConfigs section it loads the plugin correctly. All the plugins fetched from github have this problem, whereas vim-tmux-navigator from nix pkgs has the correct path.

What am I doing wrong, and how can I stop the dashes getting replaced and breaking the path?

As a secondary question, I need to add the bin directory of that plugin to my path so that the script works outside of tmux. How do I correctly refer to the path of the bin directory of the plugin in my home.nix?

Thanks for any help you can give!

I found that specifying the file to load using the rtpFilePath property fixes this.
The default does a “plugin-name with dashes replaced to underscores” dance: