19 jul 2024
status of native windows nix using MinGW from my series libnix
we also cover these topics:
making nix work native on windows there are a few options, here are a few updates reaching out to these communities:
tvix is a rust reimplementation of the c++ nix implementation, recent news:
too early for considering tvix to ‘building software using nix’ on windows. tvix is amazing, i hope one day this code base replaces the c++ one.
cosmopolitan developers on discord mentioned to me that they had tried porting nix with cosmopolitan:
ariel nunez: Bash on windows was only possible last year, after a lot of work by jart and contributors, and now Windows Terminal Preview can use it. I read my logs and last attempt to compile Nix was on August 2023, at that point in time we found out Nix used Boost and that was a blocker at the time.
the cosmopolitan idea has a lot of potential. i’m uncertain of OS specific traits and how well they map to this POSIX generalization. for instance, when normalizing paths with std::filesystem it is decided on compile time for which platform the paths resolve. cosmopolitan runs on all systems, so std::filesystem would have to make this choice a runtime resolution instead.
but for now i probably follow the john ericson / volth path with MinGW.
MinGW cross compiler setup:
mingw cross compiler from nixos-wsl
to build nix
for windowsthe https://www.mingw-w64.org/ toolchain is neatly done! in particular we want to use https://github.com/mstorsjo/llvm-mingw instead of gcc/ld.
so lld/clang will be used:
here is a list of things which need to be done still, see https://github.com/NixOS/nix/labels/windows for detailed tickets.
nix
evaluate on windows use the store on
c:\
andrunProgram
working to execute tools like
git
for fetchUrl
minimal nixpkgs like abstraction
stdenv
with mingw
to show how to use
itbash
and unix favoring build systems into a
windows worldcreate an installer for nix
create a nix channel
rust/cargo
on linux to make it work with
nix as backend, see https://github.com/NixOS/nix/pull/8699 for thisthese items need to be done outside of the libnix funding but are still worth mentioning.
nix-build
,
see https://learn.microsoft.com/de-de/virtualization/windowscontainers/manage-containers/hyperv-container#process-isolationsource $HOME/.nix-profile/etc/profile.d/nix.sh
for
powershellnix-daemon
nix-build
(with different UID/GID)systemd
like windows abstractionsystemd
targets on
linux and it would be nice if we had something similar for windows, see
systemd
equivalent on windows/nix/store
vs. c:\nix\store
nix repl
man pages
in nix build --help
this is a short summary of libnix topics what we are aiming for till the end of 2024.
additional we think that llvm-mingw is a potent toolchain for windows which enables us to use fixPath.