To Nix/NixOS or Not?

2 min read

Ignore the fact that there’s yet another Linux distribution. Nix is a very compelling way to install development tools without destroying your Linux/Mac setup. It’s like various language version managers, but for a wide variety of development tools. There is a complete Linux distribution (NixOS), but I’d suggest most people would rather install Nix, the package manager. It works on Windows using WSL version 2 only (which should be what you’re running if you’ve kept your Windows computer up to date).

If you have WSL installed as part of a Windows 10 upgrade, it’s possible that systemd install instructions for Ubuntu (or Debian based distros) may not work. I encountered this.

If wsl --version doesn’t work from a Windows command prompt, this suggests you’ll need to update the WSL utility to the current version. From a Windows command line I had to:

console
wsl --status

That reported I needed to manually update (or turn on a Windows update feature which was already active)

Then,

console
wsl --update

Then, from within the Ubuntu distribution, I added the file, /etc/wsl.conf and this configuration:

console
[boot]
systemd=true

You do need be sure the distribution is completely shutdown (and Docker Desktop if it’s installed).

console
wsl --shutdown

Once I did that and waited “8 seconds” which Microsoft’s documentation recommends minimally, when I restarted WSL, systemd was going and the Nix install worked flawlessly.

nix
[nix-shell:~]$ cowsay Hello AcornTalks! | lolcat

Results:

console
 ___________________
< Hello AcornTalks! >
 -------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||