Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue with getting nixos-wsl working with nixos-vscode-server: #31

Closed
zeta-00 opened this issue Apr 29, 2021 · 10 comments
Closed

issue with getting nixos-wsl working with nixos-vscode-server: #31

zeta-00 opened this issue Apr 29, 2021 · 10 comments
Labels
question Further information is requested

Comments

@zeta-00
Copy link

zeta-00 commented Apr 29, 2021

Hello @Trundle ,

Just thought that maybe you could take a look at this nixos-vscode-server issue that I'm having, it might have something to do with nixos-wsl because I'm unable to get them connected and working?

nix-community/nixos-vscode-server#2

Thanks in advance for the help!

@Reilithion
Copy link

I have had trouble using vscode with nixos-wsl too. Wasn't aware there was a nixos-vscode-server. I am also interested in a solution to this problem.

@nzbr
Copy link
Member

nzbr commented May 14, 2021

The underlying issue is, that the systemd user deamon does not get started, because no session for the user is ever started.
The user-mode deamon can be started by running systemctl start user@nixos.service (assuming that nixos is the username of the default user). This will work temporarily until WSL is restarted for the next time.
My permanent fix was to add the following to my configuration.nix:

  systemd.targets.user-daemon = {
    wants = [ "user@${defaultUser}.service" ];
    wantedBy = [ "multi-user.target" ];
  };

This adds a unit that does nothing itself, but depends on the user@-unit and is started automatically, causing the user@-unit to be started when WSL starts.

EDIT: Use a target instead of a service unit

@tudurom
Copy link

tudurom commented May 14, 2021

As of 89c644e the systemd user daemon gets started and many issues get fixed too. Make sure to update!

@nzbr
Copy link
Member

nzbr commented May 27, 2021

The user daemon does indeed get started now and nixos-vscode-server works. However, trying to connect with the WSL remote in VSCode fails now (log attached). I managed to connect by enabling the SSH server in NixOS and then using the SSH remote to connect to localhost, but that is more of a workaround than a real fix

Log file

@zeta-00
Copy link
Author

zeta-00 commented May 30, 2021

I'm also able to get nixos-vscode-server to load nixos in windows vscode, but whenever I try to load the terminal or nix-env-selector I get errors similar to @nzbr . I'm going to use ubuntu+nix in wsl for now, until this issue gets fixed,
thanks in advance for helping fix this issue!

@nzbr
Copy link
Member

nzbr commented May 30, 2021

The terminal does not work, because the nixos-vscode-server package uses an outdated version of nodejs. There are two open PRs against the nixos-vscode-server repo that fix this issue. The issue with the terminal is not limited to NixOS-WSL but instead affects NixOS installations on real hardware as well. As a workaround I am using my fork of the nixos-vscode-server repo until one of the PRs gets merged

@zeta-00
Copy link
Author

zeta-00 commented May 30, 2021

@nzbr ,

Thanks, I'll take a look at that,
and here's a similar issue if any of you want to take a look:

nix-community/nixos-vscode-server#2

@izzues
Copy link

izzues commented Jun 10, 2021

As of 89c644e the systemd user daemon gets started and many issues get fixed too. Make sure to update!

Hey, sorry for the stupid question, but how would I go about updating? Do I have to build the tarball from source and do wsl --import [...] again?

Thanks for your great work!

@tudurom
Copy link

tudurom commented Oct 2, 2021

Extremely late reply but...

You mostly update only the nix and sh files, you manually merge the changes in your own config.

@nzbr nzbr added the question Further information is requested label Mar 25, 2022
@nzbr
Copy link
Member

nzbr commented Apr 8, 2022

A fix has been merged and is included in the latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants