-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #406 from nix-community/docs
- Loading branch information
Showing
10 changed files
with
94 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# How-To | ||
|
||
This section contains guides for some common things you might want to do with your NixOS-WSL installation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# How to change the username | ||
|
||
If you want to change the default username to something other than `nixos`, use the `wsl.defaultUser` option. | ||
When building your own tarball, this should be sufficient. A user with the name specified in that option will be created automatically. | ||
|
||
Changing the username on an already installed system is possible as well. | ||
Follow these instructions to make sure, the change gets applied correctly: | ||
|
||
1. Change the `wsl.defaultUser` setting in your configuration to the desired username. | ||
2. Apply the configuration:\ | ||
`sudo nixos-rebuild boot`\ | ||
Do not use `nixos-rebuild switch`! It may lead to the new user account being misconfigured. | ||
3. Exit the WSL shell and stop your NixOS distro:\ | ||
`wsl -t NixOS`. | ||
4. Start a shell inside NixOS and immediately exit it to apply the new generation:\ | ||
`wsl -d NixOS --user root exit` | ||
5. Stop the distro again:\ | ||
`wsl -t NixOS` | ||
6. Open a WSL shell. Your new username should be applied now! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Setup VSCode Remote | ||
|
||
The VSCode Remote server can not be run as-is on NixOS, because it downloads a nodejs binary that | ||
requires `/lib64/ld-linux-x86-64.so.2` to be present, which isn't the case on NixOS. | ||
|
||
There are two options to get the server to run. | ||
Option 1 is more robust but might impact other programs. Option 2 is a little bit more brittle and sometimes breaks on updates but doesn't influence other programs. | ||
Both options require `wget` to be installed: | ||
|
||
```nix | ||
environment.systemPackages = [ | ||
pkgs.wget | ||
]; | ||
``` | ||
|
||
## Option 1: Set up nix-ld | ||
|
||
[nix-ld](https://github.com/Mic92/nix-ld) is a program that provides `/lib64/ld-linux-x86-64.so.2`, | ||
allowing foreign binaries to run on NixOS. | ||
|
||
Running the VSCode server on NixOS-WSL requires using [nix-ld-rs](https://github.com/nix-community/nix-ld-rs), instead of the regular nix-ld. | ||
|
||
To set it up, add the following to your configuration: | ||
|
||
```nix | ||
programs.nix-ld = { | ||
enable = true; | ||
package = pkgs.nix-ld-rs; | ||
}; | ||
``` | ||
|
||
## Option 2: Patch the server | ||
|
||
The other option is to replace the nodejs binary that ships with the vscode server with one from the nodejs nixpkgs package. | ||
[This module will set up everything that is required to get it running](https://github.com/K900/vscode-remote-workaround/blob/main/vscode.nix). | ||
If you are [using flakes](./nix-flakes.md), you can add that repo as a flake input and include it from there. | ||
Otherwise, copy the file to your configuration and add it to your imports. | ||
|
||
Add the following to your configuration to enable the module: | ||
|
||
```nix | ||
vscode-remote-workaround.enable = true; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
# Troubleshooting | ||
|
||
This section contains information on how to debug your NixOS-WSL installation. | ||
## General Tips | ||
|
||
- Try fully restarting WSL by running `wsl --shutdown`. This will close all your terminal windows. Then just restart wsl in your terminal. \ | ||
Please keep in mind that this will also end any process you might have running in other WSL distros. | ||
If that is currently not an option, you may try `wsl -t nixos`, which will just stop the `nixos` distro. | ||
(You may need to change that if you imported the distro under some other name). However, some issues will only be resolved after a _full_ restart of WSL. | ||
- Make sure that you are using the [Microsoft Store version](https://www.microsoft.com/store/productId/9P9TQF7MRM4R) of WSL | ||
- Update WSL2 to the latest version | ||
- To update, run: `wsl --update` | ||
- To check which version you currently have installed, run `wsl --version` | ||
- The latest version can be found on the [Microsoft/WSL](https://github.com/microsoft/WSL/releases/latest) repo | ||
- If this command does not work, you are probably not using the Microsoft Store version of WSL! |