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
[net]
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
let
# 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;
# START HOLONIX IMPORT BOILERPLATE
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; };
# END HOLONIX IMPORT BOILERPLATE
in
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 = ''
hn-release-hook-preflight-manual
'';
# bump versions in the repo
version = ''
hn-release-hook-version-readme
'';
# 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.
See:
- 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
nix-shell
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
Thanks