WSL — Windows Subsystem for Linux integration and fixes
Purpose
Make the NixOS host behave correctly inside WSL: default user, Windows interop, graphics library paths, nix-ld, and Start Menu launcher syncing.
Entry Point
- Main file: wsl.nix
Architecture / Services / Scope
Base layer (always applied when enabled):
- allows passwordless login,
- installs
wslu, - enables
nix-ldwith a C toolchain library for VS Code Remote WSL compatibility, - sets session variables for WSL graphics and library paths,
- enables
hardware.graphicswith the configured graphics packages andlibvdpau-va-gl, and - when NVIDIA graphics are present, appends CUDA and NVIDIA library paths.
If the wsl module exists in the option tree, module additionally:
- enables WSL with
core.wsl.useras default user, - enables Start Menu launchers and Windows driver usage,
- enables Windows interop and PATH appending,
- exposes
dirname,readlink, andunamethroughwsl.extraBinfor VS Code Remote WSL compatibility, and - copies per-user Home Manager
applicationsandiconsinto/usr/shareduring activation so launchers appear in the Windows Start Menu.
Operational Notes / Assumptions
core.wsl.useris required when WSL integration is enabled.- Extra binaries
dirname,readlink, andunameare exposed for VS Code Remote WSL compatibility. - Behavior is conditional on the separate
wslmodule being available inoptions.