DEV Community

Michael "notriddle" Howell
Michael "notriddle" Howell

Posted on • Edited on

9 4

Installing Nix under WSL1

I'm administering Linux servers while using Windows as my desktop, and am working on a test deployment using NixOS. I ran into a few problems trying to run it locally.

Before trying to run the Nix Package Manager installer script, make a directory /etc/nix and write the following text into /etc/nix/nix.conf:

# Work around missing cgroups support https://github.com/Microsoft/WSL/issues/994
sandbox = false
# Work around incorrect file locking https://github.com/Microsoft/WSL/issues/2395
use-sqlite-wal = false
Enter fullscreen mode Exit fullscreen mode

Work around missing cgroups support

The Nix sandbox relies on container functionality that Windows doesn't implement yet for the Linux personality. If you don't turn off the sandbox, you'll get this error.

error: cloning builder process: Invalid argument
error: unable to start build process
Enter fullscreen mode Exit fullscreen mode

Work around incorrect file locking

The lock handling in Windows NT doesn't perfectly match Linux's. While SQLite works fine under the Win32 personality, it produces deadlocks when you try to install Nix, producing this infinite warning loop:

warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
warning: SQLite database '/nix/var/nix/db/db.sqlite' is busy (SQLITE_PROTOCOL)
Enter fullscreen mode Exit fullscreen mode

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (3)

Collapse
 
veslav3 profile image
Roy Honders

Damn, this actually worked, thanks! :)

Collapse
 
supersandro2000 profile image
Sandro

Windows 10 20.04 Supports sandboxing and it is required to install some packages like bash-language-server.

Collapse
 
brightone profile image
Oleksii Filonenko

Thanks, helped a lot!

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay