diff --git a/pkgs/applications/emulators/wine/sources.nix b/pkgs/applications/emulators/wine/sources.nix index 698b386300dba..c395bc91b81ee 100644 --- a/pkgs/applications/emulators/wine/sources.nix +++ b/pkgs/applications/emulators/wine/sources.nix @@ -92,6 +92,14 @@ let }) ]; + patches-add-dll-accept-device-paths-wine-older-than-11_1 = [ + (pkgs.fetchpatch { + name = "add-dll-accept-device-paths"; + url = "https://gitlab.winehq.org/wine/wine/-/commit/401910ae25a11032f2da7baa1666d71e8bca2496.patch"; + hash = "sha256-2726u9/vhhx39Tq7vOw24hslmeyZZEbxRRqe7JMFvCU"; + }) + ]; + inherit (pkgs) writeShellScript; in rec { @@ -123,7 +131,8 @@ rec { patches = [ # Also look for root certificates at $NIX_SSL_CERT_FILE ./cert-path.patch - ]; + ] + ++ patches-add-dll-accept-device-paths-wine-older-than-11_1; updateScript = writeShellScript "update-wine-stable" '' ${updateScriptPreamble} diff --git a/pkgs/development/haskell-modules/configuration-windows.nix b/pkgs/development/haskell-modules/configuration-windows.nix index 3dd93aa5c17f8..2072fb9fe1bb4 100644 --- a/pkgs/development/haskell-modules/configuration-windows.nix +++ b/pkgs/development/haskell-modules/configuration-windows.nix @@ -8,11 +8,23 @@ with haskellLib; (self: super: { # cabal2nix doesn't properly add dependencies conditional on os(windows) - network = - if pkgs.stdenv.hostPlatform.isWindows then - addBuildDepends [ self.temporary ] super.network - else - super.network; + network = lib.pipe super.network [ + (addBuildDepends [ self.temporary ]) + + # https://github.com/haskell/network/pull/605 + (appendPatch (fetchpatch { + name = "dont-frag-wine.patch"; + url = "https://github.com/haskell/network/commit/ecd94408696117d34d4c13031c30d18033504827.patch"; + sha256 = "sha256-8LtAkBmgMMMIW6gPYDVuwYck/4fcOf08Hp2zLmsRW2w="; + })) + ]; + + # Workaround for + # Mingw-w64 runtime failure: + # 32 bit pseudo relocation at 00000001400EB99E out of range, targeting 00006FFFFFEB8170, yielding the value 00006FFEBFDCC7CE. + # Root cause seems to be undefined references to libffi as shown by linking errors if we instead use "-Wl,--disable-auto-import" + # See https://github.com/rust-lang/rust/issues/132226#issuecomment-2445100058 + iserv-proxy = appendConfigureFlag "--ghc-option=-optl=-Wl,--disable-runtime-pseudo-reloc" super.iserv-proxy; # Avoids a cycle by disabling use of the external interpreter for the packages that are dependencies of iserv-proxy. # See configuration-nix.nix, where iserv-proxy and network are handled. diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 955c0a4381848..4e3617e7efab8 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -13,6 +13,7 @@ haskellLib, iserv-proxy, nodejs, + windows, writeShellScriptBin, }: @@ -36,11 +37,14 @@ let enableExecutableProfiling = enableProfiling; }; buildProxy = lib.getExe' iserv-proxy.build "iserv-proxy"; - hostProxy = lib.getExe' (overrides iserv-proxy.host) "iserv-proxy-interpreter"; + hostProxy = lib.getExe' (overrides iserv-proxy.host) ( + "iserv-proxy-interpreter" + stdenv.hostPlatform.extensions.executable + ); in buildPackages.writeShellScriptBin ("iserv-wrapper" + lib.optionalString enableProfiling "-prof") '' set -euo pipefail PORT=$((5000 + $RANDOM % 5000)) + ${lib.optionalString stdenv.hostPlatform.isWindows "export WINEDEBUG=-all WINEPREFIX=$TMP"} (>&2 echo "---> Starting interpreter on port $PORT") ${emulator} ${hostProxy} tmp $PORT & RISERV_PID="$!" @@ -355,11 +359,17 @@ let ++ optional (allPkgconfigDepends != [ ]) "--with-pkg-config=${pkg-config.targetPrefix}pkg-config" ++ optionals enableExternalInterpreter ( - map (opt: "--ghc-option=${opt}") [ - "-fexternal-interpreter" - "-pgmi" - crossSupport.iservWrapper - ] + map (opt: "--ghc-option=${opt}") ( + [ + "-fexternal-interpreter" + "-pgmi" + crossSupport.iservWrapper + ] + ++ lib.optionals stdenv.hostPlatform.isWindows [ + "-L${windows.pthreads}/bin" + "-L${windows.pthreads}/lib" + ] + ) ); makeGhcOptions = opts: lib.concatStringsSep " " (map (opt: "--ghc-option=${opt}") opts);