Holochain Forum

Vscode RLS support on WSL2

If you have WSL2 running probably these steps could help you set up Rust Language Support in Visual Studio Code.
Im gonna walk through the steps I believe are needed to make it run, however if you have done this before and think any of the steps can be avoided comment it out so we can just remove it.
If you want to add more on the documentation add your input. Everything is welcome.

This is the normal steps we would find in https://developer.holochain.org/docs/install/

curl https://nixos.org/nix/install | sh
. /home/holomachine/.nix-profile/etc/profile.d/nix.sh

Globally install Holochain and HC

 nix-env -f https://holochain.love -iA holochain.hc

Create a project folder and cd to it

mkdir projects
cd projects

Init an App with hc and generate a zome

hc init myApp
cd myApp
hc package
hc generate zomes/hello rust-proc
hc package

Now open VIsual Code

code .

On the extension look for, Nix Environment Selector and RLS and install them on the server side.
Reload window then press F1 and write Nix-Env select the only option then select default.nix.

Search for the RLS installed extension, click on the Manage Icon and configure settings as follow:
Make sure you do the same on the Remote[WSL] tab

Reload The window ctrl+shift+P-> Reload Window

Tell cargo to use git executable:
cd ~/.cargo
nano config

retry = 2                   # network retries
git-fetch-with-cli = true   # use the `git` executable for git

save the file

now go to the root folder where you created myApp
I followed this documentation https://docs.holochain.love/docs/configure/

nano default.nix
# This is an example of what downstream consumers of holonix should do
# This is also used to dogfood as many commands as possible for holonix
# For example the release process for holonix uses this file

 # point this to your local config.nix file for this project
 # example.config.nix shows and documents a lot of the options
 config = import ./config.nix;

 holonix = import (
  if ! config.holonix.use-github
  then config.holonix.local.path
  else fetchTarball {
   url = "https://github.com/${config.holonix.github.owner}/${config.holonix.github.repo}/tarball/${config.holonix.github.ref}";
   sha256 = config.holonix.github.sha256;
 ) { config = config; };

with holonix.pkgs;
 dev-shell = stdenv.mkDerivation (holonix.shell // {
  name = "dev-shell";

  buildInputs = [ ]
   ++ holonix.shell.buildInputs
   ++ config.buildInputs
nano config.nix
 # extend the shell with buildInputs specific to this project
 buildInputs = [ ];

 # configure holonix itself
 holonix = {

  # true = use a github repository as the holonix base (recommended)
  # false = use a local copy of holonix (useful for debugging)
  use-github = true;

  # configure the remote holonix github when use-github = true
  github = {

   # can be any github ref
   # branch, tag, commit, etc.
   ref = "v0.0.64";

   # the sha of what is downloaded from the above ref
   # note: even if you change the above ref it will not be redownloaded until
   #       the sha here changes (the sha is the cache key for downloads)
   # note: to get a new sha, get nix to try and download a bad sha
   #       it will complain and tell you the right sha
   sha256 = "0z58sn8k4s6vqyhl81awfkbi27y49bzlspcj85cdmn60n15wwwjh";

   # the github owner of the holonix repo
   owner = "holochain";

   # the name of the holonix repo
   repo = "holonix";

  # configuration for when use-github = false
  local = {
   # the path to the local holonix copy
   path = ./.;


 # configure the release process
 release = {
  hook = {
   # sanity checks before deploying
   # to stop the release
   # exit 1
   preflight = ''

   # bump versions in the repo
   version = ''

   # publish artifacts to the world
   publish = ''
echo "All finished!!!"

  # the commit hash that the release process should target
  # this will always be behind what ends up being deployed
  # the release process needs to add some commits for changelog etc.
  commit = "9dd598c48a75196aa16f667148d69e2e8225e498";

  # the semver for prev and current releases
  # the previous version will be scanned/bumped by release scripts
  # the current version is what the release scripts bump *to*
  version = {
   current = "0.0.1";
   previous = "_._._";

  github = {
   # markdown to inject into github releases
   # there is some basic string substitution {{ xxx }}
   # - {{ changelog }} will inject the changelog as at the target commit
   template = ''
{{ changelog }}

# Installation

Use Holonix to work with this repository.


- https://github.com/holochain/holonix
- https://nixos.org/

   # owner of the github repository that release are deployed to
   owner = "holochain";

   # repository name on github that release are deployed to
   repo = "holonix";

   # canonical local upstream name as per `git remote -v`
   upstream = "origin";

Everything should be ready to go, open nix-shell without https://holochain.love

code .

Make sure you have the selector correct:



If I missed anything please comment.
Special Thanks to the guys that helped solving it. @tixel @marcus



@sdelvalle57 Thanks very much for sharing this! Seems like WSL2 is slowly making Windows more useful for dev work. I’m gonna move this to #learning-library:recipes-howtos section so people can find it more easily.

1 Like

@sdelvalle57 following the steps that you provided, please advise…

  1. Am I supposed to replace the default.nix which is within the project root folder by the one you listed?
  2. There is no config.nix within the project root folder, so I should create it like the one you listed?
  3. By globally installing holochain and hc, I wouldn’t use nix-shell https://holochain.love anymore? If so, I don’t see, for instance, how rustup is set to the nightly version forced by Holochain.
  4. For the last step before launching VSC… nix-shell should be ran from the project root folder?
  5. Would I be running nix-shell https://holochain.love later on only to check if there is any Holochain update?
  6. If so and Holochain is updated, should I rerun nix-env -f https://holochain.love -iA holochain.hc?
  7. Have you tried this recipe with rust-analyzer extension, instead of RLS?

Thank you.

Thanks for commenting.
You’d need to replace default.nix and create config.nix
After this, just run nix-shell
Haven’t tried rust-analyzer yet, does it work for you?

For general Rust development, rust-analyzer has been working fine. It is not as mature as RLS but releases are frequent with bug fixes and features. I will retry your instructions later on. Thanks.

Let me know how it goes!! :+1: :+1: