Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkgs/applications/emulators/wine/sources.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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}
Expand Down
22 changes: 17 additions & 5 deletions pkgs/development/haskell-modules/configuration-windows.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 16 additions & 6 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
haskellLib,
iserv-proxy,
nodejs,
windows,
writeShellScriptBin,
}:

Expand All @@ -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="$!"
Expand Down Expand Up @@ -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);
Expand Down