This is my NixOS configuration for Windows Subsystem for Linux (WSL).
Why NixOS on WSL?
Using NixOS-WSL gives me a consistent NixOS experience on Windows machines, with the same dotfiles and tooling as my Linux systems.
Configuration
Key WSL-specific settings:
{ inputs, ... }:
{
wsl.enable = true;
wsl.defaultUser = "gab";
wsl.startMenuLaunchers = true;
wsl.interop.register = true;
wsl.interop.includePath = false;
systemd.settings.Manager = {
DefaultTimeoutStopSec= "10s";
};
systemd.services.systemd-udev-trigger.enable = false;
systemd.services.systemd-udevd.enable = false;
boot.tmp.useTmpfs = true;
boot.kernelParams = [ "systemd.unified_cgroup_hierarchy=0" ];
}
Usage
This configuration is primarily used on Windows machines where I need a Linux development environment but can’t run a full Linux installation.