Sign in

Using SLY to connect to a slynk server running in vagrant

I want to be able to use sly, but I particularly want to be able to use it in my vagrant machines. sly-tramp seems to help with that. In order to use slynk remotely, first, I need to initialize the correct version of the slynk server remotely. The vagrant machines have the sly repository cloned to ~/sly and the following added to .sbclrc:

(push #p"~/sly/slynk/" ASDF:*CENTRAL-REGISTRY*) 
(asdf:require-system :slynk)
(slynk:create-server :port 4005) ; adjust this accordingly

I then activate the sly-tramp-contrib add the following to 'sly-filename-translations:

(setq sly-contribs '(sly-tramp)) 
(after! sly
(add-to-list 'sly-filename-translations
(sly-create-filename-translator
:machine-instance "test--step"
:remote-host "127.0.0.1"
:username "vagrant")))

This informs sly how to make the tramp translation to vagrant. I have vagrant-tramp installed which facilitates easily opening the tramp connection.

In order to be able to access the remote instance of sbcl, I have to first start it on the vagrant machine then bind the port on the host machine using

ssh vagrant@127.0.0.1 -p2222 -L4005:localhost:4005 
# remember to adjust the port

I can then connect to the remote slynk server using M-x sly-connect. The remote host is 127.0.0.1 and the port is whatever was used to start the server.

Some parts of this might be buggy down the line or unnecessary right now. I use the magnificent Doom Emacs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store