Skip to content

nix: init at 2.33.0#22499

Draft
puffnfresh wants to merge 18 commits intomsys2:masterfrom
nix-windows:package/nix
Draft

nix: init at 2.33.0#22499
puffnfresh wants to merge 18 commits intomsys2:masterfrom
nix-windows:package/nix

Conversation

@puffnfresh
Copy link
Contributor

I haven't done a build in a chroot so hopefully I got all the dependencies.

The output executable is not useful at the moment. If you try to run this package, it will crash, because the Nix codebase currently has lots of problems with handling Windows paths. Even after the big task of fixing paths, we'll have to handle process management, making a useful Windows standard environment, adding tests, and lots of other things.

I think it makes sense to not merge this package, until Nix has a minimal working Windows release. What do you think @Ericson2314?

Fixes #22459.

@Ericson2314
Copy link
Contributor

Yeah fine with me just keeping this draft for now.

@puffnfresh puffnfresh marked this pull request as draft November 12, 2024 01:43
@ognevny
Copy link
Collaborator

ognevny commented Nov 12, 2024

CLANG64 fails with:

Details
FAILED: src/libutil/libnixutil.dll.p/windows_environment-variables.cc.obj 
  "clang++" "-Isrc/libutil/libnixutil.dll.p" "-Isrc/libutil" "-I../nix-2.25.0/src/libutil" "-Isrc/libutil/windows" "-I../nix-2.25.0/src/libutil/windows" "-fdiagnostics-color=always" "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-std=c++2a" "-include" "config-util.hh" "-Wdeprecated-copy" "-Werror=suggest-override" "-Werror=switch" "-Werror=switch-enum" "-Werror=unused-result" "-Wignored-qualifiers" "-Wimplicit-fallthrough" "-Wno-deprecated-declarations" "-D_WIN32_WINNT=0x0602" "-march=nocona" "-msahf" "-mtune=generic" "-O2" "-pipe" "-Wp,-D_FORTIFY_SOURCE=2" "-fstack-protector-strong" "-Wp,-D__USE_MINGW_ANSI_STDIO=1" "-DBOOST_CONTEXT_DYN_LINK=1" "-DBOOST_COROUTINES_DYN_LINK=1" "-DBOOST_ALL_NO_LIB" "-pthread" -MD -MQ src/libutil/libnixutil.dll.p/windows_environment-variables.cc.obj -MF "src/libutil/libnixutil.dll.p/windows_environment-variables.cc.obj.d" -o src/libutil/libnixutil.dll.p/windows_environment-variables.cc.obj "-c" ../nix-2.25.0/src/libutil/windows/environment-variables.cc
  ../nix-2.25.0/src/libutil/windows/environment-variables.cc:16:31: error: non-constant-expression cannot be narrowed from type 'DWORD' (aka 'unsigned long') to 'wchar_t' in initializer list [-Wc++11-narrowing]
     16 |     std::wstring value{L'\0', bufferSize};
        |                               ^~~~~~~~~~
  ../nix-2.25.0/src/libutil/windows/environment-variables.cc:16:31: note: insert an explicit cast to silence this issue
  
     16 |     std::wstring value{L'\0', bufferSize};
  
        |                               ^~~~~~~~~~
  
        |                               static_cast<wchar_t>( )
  
  1 error generated.

Ericson2314 added a commit to nix-windows/nix that referenced this pull request Nov 12, 2024
Ericson2314 added a commit to nix-windows/nix that referenced this pull request Nov 12, 2024
Co-authored-by: Maksim Bondarenkov <119937608+ognevny@users.noreply.github.com>
mergify bot pushed a commit to NixOS/nix that referenced this pull request Nov 12, 2024
See the build failure in msys2/MINGW-packages#22499

(cherry picked from commit 355f08a)

# Conflicts:
#	src/libutil/windows/environment-variables.cc
@Ericson2314
Copy link
Contributor

NixOS/nix#11856 OK this would fix the one build failure.

@MehdiChinoune MehdiChinoune added the new-package Pull request which adds new package(s) label May 16, 2025
@Ericson2314
Copy link
Contributor

We should be able to bump this to the latest release and then it will pass for all platforms.

@ognevny
Copy link
Collaborator

ognevny commented Aug 8, 2025

We should be able to bump this to the latest release and then it will pass for all platforms.

you may create a branch in your fork if needed

@Ericson2314
Copy link
Contributor

I have access to the org repo this is coming from, so I will just try to rebase it.

@Ericson2314
Copy link
Contributor

I need to get my VM working, so this is an untested push, but CI will let me know.

@Ericson2314
Copy link
Contributor

Ericson2314 commented Aug 8, 2025

Hmm, looks like boost regex isn't yet part of the boost package?

   Run-time dependency Boost (found: container | missing: regex) found: NO (tried system)
  
  nix-2.30.2/src/libstore/meson.build:97:8: ERROR: Dependency "boost" not found, tried system

@Eveeifyeve
Copy link

Eveeifyeve commented Aug 30, 2025

I know the issue, libboost needs to be pkg-config based and we could look into shipping pkg-config-lite to windows.

@Eveeifyeve Eveeifyeve force-pushed the package/nix branch 3 times, most recently from d87cfb4 to 537f8be Compare December 17, 2025 00:46
@Eveeifyeve Eveeifyeve force-pushed the package/nix branch 3 times, most recently from 8bb62ff to 4e0e87b Compare December 17, 2025 04:14
@Ericson2314
Copy link
Contributor

@Eveeifyeve please add the CFLAG -Wno-error=sign-compare when the compiler is clang. That will fix the build failure. There are hopefully some other examples of this in this repo you can use to figure out how to do that.

@Ericson2314
Copy link
Contributor

@Ericson2314
Copy link
Contributor

NixOS/nix#14817 this will fix the build, once it is backported to 2.33.

@Eveeifyeve Eveeifyeve force-pushed the package/nix branch 4 times, most recently from 62a2d19 to 5bca905 Compare December 18, 2025 06:23
@Eveeifyeve
Copy link

Eveeifyeve commented Dec 18, 2025

@ognevny Could you please rerun the CLANGARM64 github action? There seems to be some werid edgecase.

@ognevny
Copy link
Collaborator

ognevny commented Dec 18, 2025

sometimes we have such network issues

@Eveeifyeve
Copy link

It builds, but doesn't function.

@ognevny
Copy link
Collaborator

ognevny commented Dec 18, 2025

It builds, but doesn't function.

and it wasn't tested before..?

@Eveeifyeve
Copy link

It builds, but doesn't function.

and it wasn't tested before..?

Yes it was working in the previous version, but something now we messed up with loading dlls.

@Ericson2314
Copy link
Contributor

Overall it's really nice to see this finally all green in CI, but yes Nix is pretty busted when compiling with mingw right now in terms of actual behavior.

We are also pursuing building Nix with Cygwin and with the MSVC ABI in parallel. The Cygwin one is going to be actually usable first, and we could look at packaging that in MSYS-PACKAGES likewise, though some deps might be missing in there that makes this harder.

(Also now that we have native Cygwin builds happening, I'm hoping to follow the MSYS playbook and cross compile Cygwin->Mingw in Nixpkgs.)

@Eveeifyeve
Copy link

Overall it's really nice to see this finally all green in CI, but yes Nix is pretty busted when compiling with mingw right now in terms of actual behavior.

We are also pursuing building Nix with Cygwin and with the MSVC ABI in parallel. The Cygwin one is going to be actually usable first, and we could look at packaging that in MSYS-PACKAGES likewise, though some deps might be missing in there that makes this harder.

(Also now that we have native Cygwin builds happening, I'm hoping to follow the MSYS playbook and cross compile Cygwin->Mingw in Nixpkgs.)

The biggest problem right now is that MSYS2 doesn't even work right now due to an absolute path issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-package Pull request which adds new package(s)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Nix

6 participants