Fixing permission denied error when starting tmux under on NixOS/WSL
I got this error when trying to run tmux from my WSL NixOS install:
error creating /mnt/wslg/runtime-dir/tmux-1001 (Permission denied)
Everything is fine under NixOS in other environments so it seems WSL specific.
I found a similar issue on
unix.stackexchange
suggesting that tmux’s temp directory is not correctly set. Simply setting
TMUX_TMPDIR
to /tmp
in Home Manager does the trick.
home.sessionVariables = {
TMUX_TMPDIR = "/tmp";
};