October 12, 2025
NixOS on WSL: The Best of Both Worlds
How I went from Windows → NixOS → Windows (again) and finally found peace with both.

By Piyush Kumar Singh
2 min read
A while ago, I wrote about my big move from Windows to NixOS chasing that dream of a perfectly declarative, reproducible setup. Everything defined, everything version-controlled, everything mine.
And it worked beautifully… until I wanted to relax.
🎮 Reality Check: Games, Xbox, and the Cost of Purity
Let's be honest I didn't leave Windows because I hated it. I left because I loved control.
But when it came to gaming, NixOS made me work for it. My Xbox wireless controller was a coin toss away from connecting properly. Bluetooth quirks, driver quirks you name it.
Sure, I could have fixed it. But I didn't want my evenings to turn into a Linux troubleshooting marathon when actually what I want to do is just relax.
Dual-booting didn't help either. Every time I needed to jump back into Windows, it felt like a chore saving work, rebooting, logging in again, just to use an app or play a game.
That's when it clicked: I didn't actually want to quit Windows. I just wanted pure Nix inside it.
💡 The Pivot: NixOS, Natively on WSL
So I did what any pragmatic engineer would do I stopped overcomplicating things.
Instead of running Ubuntu + Nix, I installed the official NixOS image directly inside WSL. No layers. No compromise. Just real NixOS running in Windows.
And it's beautifully seamless.
✅ Real NixOS user space ⚙️ Flakes, Home Manager, and full declarative configs 🚀 Lightning-fast inside Windows Terminal
Now I get the exact same reproducible environments I had on bare metal NixOS but with working Xbox wireless, GPU acceleration, and all my games intact.
🧩 My Setup
If you're on WSL 2.4.4 or later, just download the .wsl file from the latest release and double-click it — that's it.
Or do it from PowerShell:
wsl --install --from-file nixos.wslwsl --install --from-file nixos.wslYou can customize the distro name and install path using the --name and --location flags.
Once installed, open your new NixOS environment with:
wsl -d NixOSwsl -d NixOSFor older WSL versions:
wsl --import NixOS $env:USERPROFILE\NixOS nixos.wsl --version 2wsl --import NixOS $env:USERPROFILE\NixOS nixos.wsl --version 2Then update the Nix channels:
sudo nix-channel --updatesudo nix-channel --updateFull instructions are here: 🔗 NixOS-WSL Installation Guide (Official)
From there, I drop in my flake.nix and rebuild.
A few seconds later my entire development environment is ready, declaratively.
No dual-boot, No driver hunts, No "let me just fix this one thing."
Just productivity.
⚙️ Why It Works So Well
WSL2 has matured it's fast, supports systemd, and integrates tightly with Windows now. NixOS-on-WSL isn't a hack anymore; it's a legit, supported way to run a pure Nix environment inside Windows.
It's the perfect hybrid:
- 🧱 Windows → for games, tools, and media
- 🧬 NixOS (WSL) → for reproducible dev work, scripting, and pet projects.
No trade-offs. No second-guessing.
🪶 The Windows Side
Let's be real Windows still feels bloated out of the box. But you can fix that.
A few PowerShell de-bloat scripts later, and it feels snappy again no telemetry, no preloaded junk, just a clean base system.
That's when the combo really shines: Windows stays light, Nix stays powerful.
💭 Closing Thoughts
Switching back to Windows wasn't defeat it was evolution.
The power of Nix isn't tied to the distro. It's in the mindset reproducibility, control, and declarative design.
Now I get all of that inside a system that handles both work and play without compromise.
So yeah:
I game on Windows, I build on NixOS and they live happily ever after in one machine.
Do you know of any different way, let me know in the comments 🫡