Nix on Microsoft Windows 10
Using nix, the functional package manager on the Windows Subsystem for Linux is fairly easy, however a couple of additional steps need to be done.
WARNING
An update is published, using wsl2 & NixOS in December 2023.
- Enable WSL, see Windows Subsystem for Linux Installation Guide for Windows 10
- Pick Ubuntu inside the Microsoft Store
- Update Ubuntu
1 2
sudo apt update sudo apt upgrade
- Create the
/etc/nix
directory1
mkdir -p /etc/nix
- Create & edit
/etc/nix/nix.conf
, add following items:1 2
sandbox = false use-sqlite-wal = false
Unfortunately there are still some things that require this workaround:
sandbox = false
is following bug: NixOS/nix#2651: Installing Nix fails on Ubuntu 18.04.1 LTS Error: cloning builder process: Invalid argumentuse-sqlite-wal = false
are following bugs: NixOS/nix#2292: WSL Nix installation db.sqlite is busy and NixOS/nix#1203: nix-shell under Windows WSL is broken
- Install nix:
1
curl -L https://nixos.org/nix/install | sh
You are done, let’s test it:
1
nix-shell -p busybox --run 'echo $PATH'
Some extra useful links: