Nix NixOS is my go-to Linux distribution, providing a Functional approach to packaging & configuration management.

There are a couple of steps to enable NixOS on top of the Windows Subsystem for Linux 2. Running native NixOS is a better approach then to use Nix on Windows (using Ubuntu).


An earlier version was published as Nix on Windows 10 in 2019.

Enable WSL if you haven’t done so.

wsl --install --no-distribution

The --no-distribution just activates wsl2, see wsl docs.

Reboot your pc.

Import & Install NixOS on WSL2

We are going to use the nix-community/NixOS-WSL base.

  1. Download the latest release

  2. Import the image to WSL

     wsl --import NixOS %userprofile%\AppData\Local\WSL\NixOS .\Downloads\NixOS\nixos-wsl.tar.gz

    %userprofile%\AppData\Local\WSL\NixOS is an arbitrary location, adjust to your needs.

  3. Run NixOS

     wsl -d NixOS
  4. Optionally make NixOS the default

     wsl -s NixOS

Our first run

  1. Run a nix-channel update as root

     sudo nix-channel --update
  2. You can start using NixOS

    e.g. nix-shell -p htop

Definitely check