Editors over SSH¶
Keep your editor on the host and use the compilers, language servers and other tools installed in the machine. VS Code's Remote - SSH and other SSH clients can connect through a host alias generated by nsl. This connection doesn't need a network listener on either side.
Add the alias¶
This starts the machine if needed and prints an entry like this:
Host nsl-dev
HostName dev
User you
IdentityFile /var/home/you/.local/share/nsl/machines/dev.ssh/id_ed25519
IdentitiesOnly yes
UserKnownHostsFile /var/home/you/.local/share/nsl/machines/dev.ssh/known_hosts
HostKeyAlias nsl-dev-…
StrictHostKeyChecking accept-new
ProxyCommand env NSL_HOME=/var/home/you/.local/share/nsl /usr/local/bin/nsl _ssh dev
Then connect to nsl-dev:
In VS Code, run Remote-SSH: Connect to Host… and pick nsl-dev.
How it works¶
SSH calls nsl _ssh NAME as its proxy command. nsl starts the machine, then asks the VM's agent to run sshd -i inside it. Standard input and output carry the connection. nsl generates a key for that machine and stores it with the host key in NSL_HOME/machines/NAME.ssh/. Removing the machine removes both keys.
Editor sessions count as nsl command sessions, so a machine stays running while an editor is connected.
Keep watched projects in the guest home¶
Host edits to files under /mnt/host produce no file events in the machine. Language servers, file watchers and hot reload work best on a checkout in the guest home, such as /home/you/src/project, opened over this SSH connection.