I am trying to use VS Code with with the Remote - SSH extension which runs the GUI on the local machine but interacts with the filesystem and runs all LSPs on the remote. These LSPs usually have system dependencies and I would normally use nix develop
and run VS Code from the development shell to provide them but in case of remote server it does not matter how I run the GUI but the server needs to be provided these dependencies the same so I would like to use nix develop
to do that too. Unfortunately I am having some trouble getting it to run this way.
I have already tried using the RemoteCommand
option in my SSH config and this works perfectly for direct SSH connections from the CLI but I think the Remote extension ignores it so this does not achieve the desired result. I verified this by executing ps -ef
on the remote and observing no bash --rcfile ...
process like nix develop normally starts.
I think I have to enforce the use of nix develop
on the remote system. I have a lot of control over the remote and I can make new users and configure them like I want (except they cannot have root privileges) so I tried making a new user that has exec nix develop ...
in its .profile
which, once again, works when I connect using CLI but does not when Remote - SSH connects. I can avoid this behavior from the CLI too if I connect like this ssh -t my-host-name 'bash --noprofile --norc'
and I assume this is what the extension is doing too because when executing ps
I see that it is not using the login shell.
Is there any way I can actually enforce the use of nix develop
on the remote machine? If not, how else can I provide certain dependencies to users using Nix (but not NixOS)?