Skip to content

sonowz/vscode-remote-wsl-nixos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

vscode-remote-wsl-nixos

Now that WSL 2 has been released from Windows 2004 update, NixOS can be run in Windows machine 🎉 Since NixOS differs from other Linux in some aspects, it has some difficulties working with Visual Studio Code Remote-WSL extension. This repository quickly fixes problems working with VSCode.

Steps

  1. Install NixOS as a WSL 2 distro. Currently there's a community supported repository here (NixOS-WSL).
  2. Install Visual Studio Code and its Remote-WSL extension.
  3. Make sure wget is installed in your NixOS as a system package. If you have no idea on this, run nix profile install nixpkgs#wget command to install wget.
  4. Run cp ./server-env-setup ~/.vscode-server/server-env-setup. See here for description.
  5. Now VSCode can connect to your NixOS!

Known issue

Every time your vscode gets updated (including the very first run), the remote connection will fail. Just click 'retry' and reconnect.

This is a wontfix issue. See server-env-setup script for explanations.

For non-flake users

Since NixOS-WSL includes flakes as default, non-flake is considered as legacy. Please use non-flakes/server-env-setup file instead of server-env-setup.


Alternative Solution

Solution described in this post works by setting up server-env-setup file using home-manager. (This also requires nix-ld)

About

Develop using VSCode Remote-WSL environment with NixOS

Resources

Stars

Watchers

Forks

Packages

No packages published