# Use Per Screen DPI on X11 PerScreenDPI=False # Force font DPI on Wayland ForceWaylandDPI=0 # Enable fractional scale under Wayland EnableFractionalScale=True
# Font Font="Sans Serif 20"# 默认10号字,20大约等于200%缩放 # Use Per Screen DPI on X11 PerScreenDPI=False# 关闭x11自动缩放 # Force font DPI on Wayland ForceWaylandDPI=48# 系统200%缩放会导致在Wayland过大,把100%系统下对应的96缩小一半则刚刚好 # Enable fractional scale under Wayland EnableFractionalScale=False# 关闭Wayland自动缩放
If you have WSL version 2.4.4 or later installed, you can open (double-click) the .wsl file to install it. It is also possible to perform the installation from a PowerShell:
1
wsl --install --from-file nixos.wsl
nixos.wsl must be the path to the file you just downloaded if you’re running the command in another directory.
You can use the --name and --location flags to change the name the distro is registered under (default: NixOS) and the location of the disk image (default: %localappdata%\wsl\{some random GUID}). For a full list of options, refer to wsl --help
To open a shell in your NixOS environment, run wsl -d NixOS, select NixOS from the profile dropdown in Windows Terminal or run it from your Start Menu. (Adjust the name accordingly if you changed it)
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:
1 2 3
environment.systemPackages = [ pkgs.wget ];
Option 1: Set up nix-ld
nix-ld is a program that provides /lib64/ld-linux-x86-64.so.2, allowing foreign binaries to run on NixOS.
To set it up, add the following to your configuration:
Instead of using the Nix profile /nix/var/nix/profiles/system to keep track of the current and previous system configurations, use /nix/var/nix/profiles/system-profiles/name. When you use GRUB 2, for every system profile created with this flag, NixOS will create a submenu named “NixOS - Profile 'name'” in GRUB’s boot menu, containing the current and previous configurations of this profile.
For instance, if you want to test a configuration file named test.nix without affecting the default system profile, you would do:
$ nixos-rebuild switch -p test -I nixos-config=./test.nix
The new configuration will appear in the GRUB 2 submenu “NixOS - Profile 'test'”.