| 11 Mar 2023 |
henrik-ch | I think that improved things:
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ code .
Installing VS Code Server for x64 (5e805b79fcb6ba4c2d23712967df89a089da575b)
Downloading: 100%
Unpacking: 100%
Unpacked 2399 files and folders to /home/i97henka/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b.
cannot execute /home/i97henka/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b/node: NIX_LD or NIX_LD_x86_64-linux is not set
Do you know about that setting NIX_LD or NIX_LD_x86_64-linux?
| 13:30:04 |
K900 | Are you on 22.11 or unstable? | 13:30:48 |
K900 | Those should be set by default on unstable | 13:30:56 |
henrik-ch | [i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ nixos-version
22.11.2630.e6d5772f351 (Raccoon)
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ sudo nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-22.11
| 13:32:40 |
henrik-ch | so I need to change that. | 13:32:59 |
K900 | You could also set them manually, but generally it might be a better idea to run unstable, as that's what nixos-wsl is mostly tested afaisnt | 13:33:28 |
K900 | * You could also set them manually, but generally it might be a better idea to run unstable, as that's what nixos-wsl is mostly tested against | 13:33:40 |
henrik-ch | better to change the channel, or do it over configuration.nix somehow? | 13:33:44 |
K900 | You have to change the channel if you want to run unstable | 13:34:20 |
K900 | Unless you use niv or flakes or some other way of tracking your inputs that's not channels | 13:34:37 |
henrik-ch | I have flakes activated by default in the nixos-wsl, but I think that I only use them in specific folders with direnv, and not for the whole system management? How can I check?
This is my channel setup now:
[i97henka@nixos:~]$ sudo nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-22.11
nixpkgs https://nixos.org/channels/nixpkgs-unstable
Does that look right?
| 13:38:04 |
K900 | If you have /etc/nixos/configuration.nix and no /etc/nixos/flake.nix, you're using channels | 13:39:30 |
K900 | And no, you want to replace the nixos channel | 13:39:38 |
K900 | And you probably want to use nixos-unstable, not nixpkgs-unstable | 13:39:52 |
henrik-ch | I think that the replace of the nixos channel is done now:
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ sudo nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-unstable
nixpkgs https://nixos.org/channels/nixpkgs-unstable
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ sudo nixos-rebuild switch --u
pgrade
unpacking channels...
building Nix...
building the system configuration...
activating the configuration...
setting up /usr/share/applications...
setting up /usr/share/icons...
setting up /etc...
setting up /bin...
setting up /bin/login...
setting up /sbin/init shim...
reloading user units for i97henka...
setting up tmpfiles
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ cd ~
[i97henka@nixos:~]$ rm -rf .vscode-server/
[i97henka@nixos:~]$ cd github/vscode-remote-wsl-nixos/
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ code .
Installing VS Code Server for x64 (5e805b79fcb6ba4c2d23712967df89a089da575b)
Downloading: 100%
Unpacking: 100%
Unpacked 2399 files and folders to /home/i97henka/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b.
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$
It's no errors in the command line now, but unfortunately still the same in the vscode terminal:
[2023-03-11 14:04:01.455] Windows build: 22621. Multi distro support: available. WSL path support: enabled
[2023-03-11 14:04:01.849] Using shell environment from invoking shell: /tmp/vscode-distro-env.SGB9gH
[2023-03-11 14:04:02.003] WSL daemon log file:
[2023-03-11 14:04:02.004] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d NixOS -e sh -c "if [ -d ~/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf alpine-; fi; uname -m"
[2023-03-11 14:04:02.403] Unable to detect if server is already installed: Error: Command failed: C:\WINDOWS\System32\wsl.exe -d NixOS -e sh -c "if [ -d ~/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf alpine-; fi; uname -m"
[2023-03-11 14:04:02.403] /nix/store/7xf4f4d9jip5rjkzwvxwxqgmyhzzvyqk-bash-interactive-5.2-p15/bin/sh: line 1: uname: command not found
[2023-03-11 14:04:02.403]
[2023-03-11 14:04:02.403] 湩瑳污潦湵
[2023-03-11 14:04:02.403] 港硩猯潴敲㜯晸昴搴樹灩爵歪睺硶硷東祭穨発煹慢桳椭瑮牥捡楴敶㔭㈮瀭㔱戯湩猯㩨氠湩㨱甠慮敭›潣浭湡潮⁴潦湵
[2023-03-11 14:04:02.404] Launching C:\WINDOWS\System32\wsl.exe -d NixOS sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 5e805b79fcb6ba4c2d23712967df89a089da575b stable code-server .vscode-server --host=:: --print-ip-address --port=0 --connection-token=1574352636-3755954077-1501434474-266153846 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2023-03-11 14:04:03.015] Setting up server environment: Looking for /home/i97henka/.vscode-server/server-env-setup. Not found.
[2023-03-11 14:04:03.015] WSL version: NixOS
[2023-03-11 14:04:03.016] /mnt/c/Users/i97he/.vscode/extensions/ms-vscode-remote.remote-wsl-0.76.1/scripts/wslServer.sh: line 28: uname: command not found
[2023-03-11 14:04:03.016] /mnt/c/Users/i97he/.vscode/extensions/ms-vscode-remote.remote-wsl-0.76.1/scripts/wslServer.sh: line 32: dirname: command not found
[2023-03-11 14:04:03.033] /mnt/c/Users/i97he/.vscode/extensions/ms-vscode-remote.remote-wsl-0.76.1/scripts/wslServer.sh: line 32: /wslDownload.sh: No such file or directory
[2023-03-11 14:04:03.033] VS Code Server for WSL closed unexpectedly.
[2023-03-11 14:04:03.033] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2023-03-11 14:04:03.050] WSL Daemon exited with code 0
[2023-03-11 14:05:24.901] Download in background is enabled
| 14:05:56 |
| Fallenbagel changed their display name from fallenbagel to Fallenbagel. | 18:19:10 |
| 14 Mar 2023 |
| Yilong Liu joined the room. | 01:35:53 |
| purewaterisme joined the room. | 05:49:57 |
purewaterisme | In reply to @i97henka:matrix.org
I think that the replace of the nixos channel is done now:
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ sudo nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-unstable
nixpkgs https://nixos.org/channels/nixpkgs-unstable
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ sudo nixos-rebuild switch --u
pgrade
unpacking channels...
building Nix...
building the system configuration...
activating the configuration...
setting up /usr/share/applications...
setting up /usr/share/icons...
setting up /etc...
setting up /bin...
setting up /bin/login...
setting up /sbin/init shim...
reloading user units for i97henka...
setting up tmpfiles
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ cd ~
[i97henka@nixos:~]$ rm -rf .vscode-server/
[i97henka@nixos:~]$ cd github/vscode-remote-wsl-nixos/
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$ code .
Installing VS Code Server for x64 (5e805b79fcb6ba4c2d23712967df89a089da575b)
Downloading: 100%
Unpacking: 100%
Unpacked 2399 files and folders to /home/i97henka/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b.
[i97henka@nixos:~/github/vscode-remote-wsl-nixos]$
It's no errors in the command line now, but unfortunately still the same in the vscode terminal:
[2023-03-11 14:04:01.455] Windows build: 22621. Multi distro support: available. WSL path support: enabled
[2023-03-11 14:04:01.849] Using shell environment from invoking shell: /tmp/vscode-distro-env.SGB9gH
[2023-03-11 14:04:02.003] WSL daemon log file:
[2023-03-11 14:04:02.004] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d NixOS -e sh -c "if [ -d ~/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf alpine-; fi; uname -m"
[2023-03-11 14:04:02.403] Unable to detect if server is already installed: Error: Command failed: C:\WINDOWS\System32\wsl.exe -d NixOS -e sh -c "if [ -d ~/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf alpine-; fi; uname -m"
[2023-03-11 14:04:02.403] /nix/store/7xf4f4d9jip5rjkzwvxwxqgmyhzzvyqk-bash-interactive-5.2-p15/bin/sh: line 1: uname: command not found
[2023-03-11 14:04:02.403]
[2023-03-11 14:04:02.403] 湩瑳污潦湵
[2023-03-11 14:04:02.403] 港硩猯潴敲㜯晸昴搴樹灩爵歪睺硶硷東祭穨発煹慢桳椭瑮牥捡楴敶㔭㈮瀭㔱戯湩猯㩨氠湩㨱甠慮敭›潣浭湡潮⁴潦湵
[2023-03-11 14:04:02.404] Launching C:\WINDOWS\System32\wsl.exe -d NixOS sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 5e805b79fcb6ba4c2d23712967df89a089da575b stable code-server .vscode-server --host=:: --print-ip-address --port=0 --connection-token=1574352636-3755954077-1501434474-266153846 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2023-03-11 14:04:03.015] Setting up server environment: Looking for /home/i97henka/.vscode-server/server-env-setup. Not found.
[2023-03-11 14:04:03.015] WSL version: NixOS
[2023-03-11 14:04:03.016] /mnt/c/Users/i97he/.vscode/extensions/ms-vscode-remote.remote-wsl-0.76.1/scripts/wslServer.sh: line 28: uname: command not found
[2023-03-11 14:04:03.016] /mnt/c/Users/i97he/.vscode/extensions/ms-vscode-remote.remote-wsl-0.76.1/scripts/wslServer.sh: line 32: dirname: command not found
[2023-03-11 14:04:03.033] /mnt/c/Users/i97he/.vscode/extensions/ms-vscode-remote.remote-wsl-0.76.1/scripts/wslServer.sh: line 32: /wslDownload.sh: No such file or directory
[2023-03-11 14:04:03.033] VS Code Server for WSL closed unexpectedly.
[2023-03-11 14:04:03.033] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2023-03-11 14:04:03.050] WSL Daemon exited with code 0
[2023-03-11 14:05:24.901] Download in background is enabled
Hello. I also just ran into this issue. Are you running nativeSystemd? Disabling that fixed the issue for me(though obviously this is not an ideal solution) | 05:50:51 |
henrik-ch | In reply to @purewaterisme:matrix.org Hello. I also just ran into this issue. Are you running nativeSystemd? Disabling that fixed the issue for me(though obviously this is not an ideal solution) Thank you very much for sharing 🙏 purewaterisme. I managed to get something working now, but it feels like a bad case of cargo-culting, as I don't understand why many of the steps that I took were needed 🤣.
Here my latest configuration.nix:
{ pkgs, config, modulesPath, ... }:
let
#nixvim = import (builtins.fetchGit {
# url = "https://github.com/pta2002/nixvim";
#});
nixos-wsl = import ./nixos-wsl;
in
{
imports = [
#nixvim.nixosModules.nixvim
nixos-wsl.nixosModules.wsl
<home-manager/nixos>
];
wsl = {
enable = true;
nativeSystemd = false;
wslConf.automount.root = "/mnt";
defaultUser = "i97henka";
startMenuLaunchers = true;
};
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
users.users.i97henka = {
isNormalUser = true;
extraGroups = [ "wheel"];
};
home-manager.users.i97henka = { pkgs, ... }: {
home.stateVersion = "22.11";
home.packages = [ pkgs.jq pkgs.ripgrep pkgs.gh ];
nixpkgs.config.allowUnfree = true;
programs.bash = {
enable = true;
shellAliases = {
ll = "ls -l";
".." = "cd ..";
gst = "git status";
glo = "git log --oneline";
gfa = "git fetch --all";
ggfl = "git push --force-with-lease";
};
};
programs.git.enable = true;
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
programs.fzf.enable = true;
programs.bat.enable = true;
programs.vscode.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
};
};
environment.systemPackages = with pkgs; [
bat
git
vim
wget
];
programs.nix-ld.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "curses";
};
system.stateVersion = "22.11";
}
What is very interesting and unexpected about this for me - it's running the linux version of vscode, so "pure wsl", rather than running a server and hosting the gui in the windows. I hope that it gets clearer what I mean when I post a screenshot in the next step.
| 09:02:53 |
henrik-ch | It's the first wsl gui app that I ever have run, I don't have a unix windows manager installed afaik.
| 09:05:23 |
henrik-ch |  Download wsl_vscode_gui.png | 09:05:33 |
henrik-ch | In reply to @purewaterisme:matrix.org Hello. I also just ran into this issue. Are you running nativeSystemd? Disabling that fixed the issue for me(though obviously this is not an ideal solution) * Thank you very much for sharing 🙏 purewaterisme. I managed to get something working now, but it feels like a bad case of cargo-culting, as I don't understand why many of the steps that I took were needed 🤣.
Here my latest configuration.nix:
{ pkgs, config, modulesPath, ... }:
let
#nixvim = import (builtins.fetchGit {
# url = "https://github.com/pta2002/nixvim";
#});
nixos-wsl = import ./nixos-wsl;
in
{
imports = [
#nixvim.nixosModules.nixvim
nixos-wsl.nixosModules.wsl
<home-manager/nixos>
];
wsl = {
enable = true;
nativeSystemd = false;
wslConf.automount.root = "/mnt";
defaultUser = "i97henka";
startMenuLaunchers = true;
};
# Enable nix flakes
nix.package = pkgs.nixFlakes;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
users.users.i97henka = {
isNormalUser = true;
extraGroups = [ "wheel"];
};
home-manager.users.i97henka = { pkgs, ... }: {
home.stateVersion = "22.11";
home.packages = [ pkgs.jq pkgs.ripgrep pkgs.gh ];
nixpkgs.config.allowUnfree = true;
programs.bash = {
enable = true;
shellAliases = {
ll = "ls -l";
".." = "cd ..";
gst = "git status";
glo = "git log --oneline";
gfa = "git fetch --all";
ggfl = "git push --force-with-lease";
};
};
programs.git.enable = true;
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
programs.fzf.enable = true;
programs.bat.enable = true;
programs.vscode.enable = true;
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
};
};
environment.systemPackages = with pkgs; [
bat
git
vim
wget
];
programs.nix-ld.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "curses";
};
system.stateVersion = "22.11";
}
What is very interesting and unexpected about this for me - it's running the linux version of vscode, so "pure wsl", rather than running a server and hosting the gui in the windows instance. I hope that it gets clearer what I mean when I post a screenshot in the next step.
| 09:06:17 |
henrik-ch | More of a curiousity than a real problem: After deactivating nativeSystemd, the prompt to launch the shell changed.
Previously, it worked to launch like this:
C:\WINDOWS\system32\wsl.exe -d NixOS -u i97henka
and now the user has to be omitted like this:
C:\WINDOWS\system32\wsl.exe -d NixOS
In both cases I land in a prompt logged in as i97henka, I assume because of the defaultUser = "i97henka"; setting in the configuration file.
| 09:32:27 |
K900 | Yes, that is normal | 10:04:39 |
K900 | Also, I think I have an idea of why that's happening | 10:04:55 |
K900 | Though I'm not sure how to fix that automatically | 10:05:01 |
| pbsds joined the room. | 13:10:23 |
Arson Copperflame | In reply to @k900:0upti.me You could also set them manually, but generally it might be a better idea to run unstable, as that's what nixos-wsl is mostly tested against Is it? All the tests run against stable and that's what I'm running as well. It's probably true for anything related to nativeSystemd though, because we can't run the tests against that (yet) | 16:26:50 |
Sandro 🐧 | We should disable udev again. It draws in a lot https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/hardware/udev.nix#L355-L455 | 16:27:18 |