Best way to expose binary built inside tmux plugin

Hi, I’d like to propose a PR to nixpkgs that exposes the binary built in nixpkgs/pkgs/misc/tmux-plugins/tmux-fingers/default.nix

I see three possible ways to approach this:

  1. Split the binary into another package (there’s a precedent in nixpkgs/pkgs/misc/tmux-plugins/tmux-thumbs/default.nix), but I don’t think this would work here because the binary is tied to the tmux plugin, and might not be useful as a standalone (could be wrong though)

  2. Use a passthru like:

    passthru = {
      fingers-binary = "${fingers}/bin/tmux-fingers";
    };
    

    and then pkgs.tmuxPlugins.fingers.fingers-binary

  3. Put the binary as an output in $out/bin

    postInstall = ''
       mkdir -p $out/bin
       cp ${fingers}/bin/tmux-fingers $out/bin/
    '';
    

    and use it like ${pkgs.tmuxPlugins.fingers}/bin/tmux-fingers

What could be the best option? Thanks

I’m not an expert, but maybe passthrough the whole fingers package instead of just the path to its binary, if the passthrough is the approach you end up going with.

2 Likes