3

I would like to load up nix-shell with tmux using the fish shell. I've accomplished this by adding to my .nix file:

shellHook = ''
  tmux -f .tmux.conf
'';

Then having a .tmux.conf that is just

set-option -g default-shell /nix/store/lpmzq9qf0dgn357l20y5868wayjr79yi-fish-3.3.1/bin/fish

I would love to get the hash out of the config file so that tmux will just always use the version of fish that nix-shell is currently using. Is this possible?

1 Answers1

3

You have many options but I'd say the simplest solution is to use

shellHook =
  let tmuxConf = pkgs.writeText "tmux.conf" "set-option -g default-shell ${pkgs.fish}/bin/fish";
  in ''
    tmux -f ${tmuxConf}
  '';

(not tested I am on my phone, you may need to adapt the pkgs.fish depending on the way you load packages)

user46261
  • 103
tobiasBora
  • 4,041
  • 4
  • 23
  • 35