How to get tmux resurrect to restore neovim sessions

If for some reason you still can’t get this to work, make sure that you actually have all the programs required by the script/config you pasted installed on your system.

Some of the answers above use sponge which I didn’t have on my system.

I slightly adjusted the approach outlined by Mikilio on GitHub without the usage of sponge and finally got the tmux-resurrect working.

Just for reference, here is my config for this particular plugin:

{
  plugin = tmuxPlugins.resurrect;
  extraConfig = ''
    set -g @resurrect-strategy-nvim 'session'
    resurrect_dir=~/.tmux/resurrect/
    set -g @resurrect-dir $resurrect_dir
    set -g @resurrect-hook-post-save-all "sed -i 's| --cmd .*-vim-pack-dir||g; s|/etc/profiles/per-user/$USER/bin/||g; s|/nix/store/.*/bin/||g' $(readlink -f $resurrect_dir/last)"
  '';
}