omerxx / tmux-floax

The missing floating pane for Tmux
GNU General Public License v3.0
439 stars 28 forks source link

Nix Home Manager documentation update for counter-intuitive naming #29

Open pete3n opened 2 months ago

pete3n commented 2 months ago

First, thanks for the plugin; I'll enjoy having it part of my workflow. I am opening this issue for awareness and documentation, but the solution is provided so it can be closed immediately.
BLUF: When implementing tmux-floax in Nix Home Manager using the tmuxPlugins.mkTmuxPlugin option, you must use "floax" as the pluginName, if you use tmux-floax as the name, because of how tmuxPlugins.mkTmuxPlugin names the .tmux plugin file, the run-shell command written to ~/.config/tmux/tmux.conf will be similar to:

run-shell /nix/store/szhfpi8yijpakp4dpw1130qkva5f5b0z-tmuxplugin-floax-unstable-2024-31-08/share/tmux-plugins/tmux-floax/tmux_floax.tmux 

Which will attempt to run the non-existent tmux_floax.tmux file. The actual .tmux plugin file is named floax.tmux and will not change to reflect a different pluginName value. I suggest the following documenation:

Nix Home Manager configuration example

{pkgs, ...}: let
  floax =
    pkgs.tmuxPlugins.mkTmuxPlugin
    {
      # Note pluginName MUST be "floax"
      pluginName = "floax";
      version = "unstable-2024-31-08";
      src = pkgs.fetchFromGitHub {
        owner = "omerxx";
        repo = "tmux-floax";
        rev = "dab0587c5994f3b061a597ac6d63a5c9964d2883";
        sha256 = "sha256-gp/l3SLmRHOwNV3glaMsEUEejdeMHW0CXmER4cRhYD4=";
      };
    };
in {
 programs.tmux = {
    enable = true;
    sensibleOnTop = false;
    escapeTime = 10;
    mouse = true;
    plugins =
      [
        # Not available in pkgs.tmuxPlugins
        {
          plugin = floax;
          extraConfig = ''
            set -g @floax-border-color 'blue'
          '';
        }
      ]
      # Available in pkgs.tmuxPlugins
      ++ (with pkgs.tmuxPlugins; [
        onedark-theme
        pain-control
        vim-tmux-navigator
        logging
        yank
        tmux-fzf
        {
          plugin = extrakto;
          extraConfig = ''
            set -g @extrakto_clip_tool "wl-copy"
          '';
        }
        resurrect
        {
          plugin = continuum;
          extraConfig = ''
            set -g @continuum-restore 'on'
            set -g @continuum-save-interval '10'
          '';
        }
      ]);
    extraConfig = ''
           set -g history-limit 50000
           setw -g clock-mode-style 24
    '';
  };
}

For reference, my complete dotfile example is located at: https://github.com/pete3n/dotfiles/blob/nixos-flake/modules/home-manager/pete/tmux-config.nix

omerxx commented 2 months ago

Hey @pete3n thanks for this, definitely something to consider. I'm happy to add this, care to open a pull request with your additions?