Nix on Windows?

Image of Windows with installed native Nix is at
magnet:?xt=urn:btih:8124507E71C42E5496F922589B3FB79D7C9A90F0& (login Administrator, password Abc123)

Note that it is in early alpha and many things do not work as well as on Linux (for example, Nix Store is not protected from writing)


I made a #nix-windows IRC channel on Freenode, BTW.


I got up to half, but I gave up because it was too big. I hope the official version of nix for windows will be released someday.
Of course it sounds ridiculous. It might be faster to @volth join ms and make ㅡ.ㅡ. hehe

1 Like

Hi @volth, are you still around? I’ve missed you on GitHub, and interestingly GitHub knows that you had some branches that were ahead of their nix-windows counterpart-forks. I was curious if you’re still working on Nix for Windows, if you could send those commits to us somehow, etc. (I can be reached at or in #nix-windows too if thats better).


My last commits are here: Commits · nix-windows/nix · GitHub

GitHub - nix-windows/nix: Nix, the purely functional package manager has 2 working branches, mine and Ericsson2314 which get merged eventually


BTW, Rakudo (Perl 6) might be a good candidate for the language of imperative builders (in place where we use bash on Linux).
It is:

  • more expressive than Bash (and Perl 5)
  • has a lot of features from Haskell to make FP people happy
  • has excellent Unicode support
  • and (what is rare among scripting languages, because most of them were quickly ported from Unix land) it works well with Windows paths, including symlinks

How big is its closure?

1 Like

Who cares? The biggest is stdenv, which includes 14GB of Visual C++.
All the rest are tiny compared to that behemoth.


I shouldn’t be too surprised given that it’s Windows but still…

I was more curious about it as a replacement for bash elsewhere too because I’m not a huge fan of Nixpkgs being glued together with such a primitive and ancient scripting language.

What would you replace it with? It’s easy to bash…bash…

bash itself might be no so bad, but it can do nothing: it calls external programs for every simple task.
and there is (at least was 2 years ago) no programs on Windows to do ln -s or cp -r (neither copy not xcopy not robocopy nor mingw’s coreutils were able to, for example, cp -r of llvm’s source tree with all their dangling symlinks and unicode symbols in filenames)

What’s the test case for that @volth? I spent several hours playing with the vm image a month or two ago. Got something built even. But I think I was doing something pretty different.

If I fire up msys2, and run pacman -Syu; pacman -S git; git clone; cp -a llvm-project{,2}, it all completes successfully.

The problem was not compile llvm successfully but to calculate sha256 for fetchurl and friends without losing files. In llvm case those dangling links are among test cases (and that is why they are so weird intentionally), their disappearance does not hurt the build. But affects hashes.

1 Like

Also GitHub - google/zx: A tool for writing better scripts

apparently there are posix shells that work on windows: GitHub - AdaCore/gsh: A POSIX shell for Windows.

1 Like

May I add Lua to the list?
It is very small
It is very fast
It is easy to bootstrap
Its syntax could be better, if that’s a deal-breaker stuff like moon/yue script exist (GitHub - hengestone/lua-languages: Languages that compile to Lua)


Last time I seen Lua, it was compiled for Windows using MinGW.
So the same problem as Python and Perl (when without special Windows libs): no paths longer than 255 chars and bad symlink support.

I am a fan of Lua for this too. GitHub - rjpcomputing/luaforwindows: Lua for Windows is a 'batteries included environment' for the Lua scripting language on Windows. NOTICE: Looking for maintainer. shows MSVC lua is no problem.

Absence of function to get size of a set in both Nix and Lua reveals some influence :slight_smile:

There is no problems with MSVC. Perl, Python (and probably even Bash) can be compiled by MSVC.

The problem is the filesystem library must support long file names and symlinks (including dangling and recursive).

Remember, there is no reliable cp -r on Windows. All software I tested: from built-in copy and xcopy through MinGW bash and coreutils, to 3-rd party robocopy do fail on doing cp -r with real-world directory structure which has both long filenames, recursive symlinks and non-printable characters (such as checked out LLVM and Chromium monorepos), so cp -r, ln -s, … have been written in Perl with some external modules (and even this choice required patches in C code of those modules).

The test question for Lua, Rakudo, NodeJs, … is as such: can it be used to write cp -r and ln -s which won’t fail on long filenames, recursive symlinks and non-printable characters ?


On Linux, I am currently on stripped Nixpkgs with only ~3000 packages to ease maintainability.
Anyway, it has lost compatibility with mainstream Nix (it small nuances, like { name = "xx"; = "yy"; } is verboten). I will try to replace bash with something else, keeping in mind eventual merging that Nixpkgs-lite/Linux with Nixpkgs/Window. So far, Rakudo is the cutest but a bit exotic option. JavaScript is more practical.

1 Like