Got NixOS running in WSL (Windows Subsystem for Linux)

#1

As apart of my journey to learn what Nix can do, I’ve created a Nix rootfs that can be loaded into WSL (Windows Subsystem for Linux). I’m keeping instructions here:

Feel free to try it out, provide experiences, correct me on things.

7 Likes

#2

Great work! Note that this is just installing the Nix package manager. NixOS is not installed so you won’t be able to use nixos-rebuild / etc. to manage it. It’s still useful and an easy way to get Nix installed. But we definitely could use a WSL module in NixOS to generate this stuff. We already have something similar through boot.isContainer but adding stuff to generate the rootfs.tar.gz would be nice. Ideally we could get all of this on the Microsoft Store as well.

3 Likes

#3

See also this previous effort:

Which is apparently blocked by

It is likely your setup is, too, affected by this; and possible that you haven’t been hit by it yet.

0 Likes

#4

Yeah it looks like WSL has issues if you have question mark ‘?’ characters in your path names. In my setup I didn’t have any so I’ve dodged that issue for now.

Thanks for the pointers into what’s already been done, I’ll have to take a look.

1 Like