From 965c4299171c8af08554ff0b5a0f957e4a5830af Mon Sep 17 00:00:00 2001 From: Daniel Hill Date: Mon, 18 Sep 2023 19:26:04 +1200 Subject: [PATCH 1/3] wine: Fix missing X11 libraries for Wayland build The Wayland build provides both Wayland and X11 support Wine still prioritizes X11 over Wayland by default, without these support libraries some things don't work, including causing some games to crash. --- pkgs/applications/emulators/wine/base.nix | 4 ++-- pkgs/applications/emulators/wine/default.nix | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/emulators/wine/base.nix b/pkgs/applications/emulators/wine/base.nix index 8b1b4966ddab..c49fe9f1de54 100644 --- a/pkgs/applications/emulators/wine/base.nix +++ b/pkgs/applications/emulators/wine/base.nix @@ -78,7 +78,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { ++ lib.optional fontconfigSupport pkgs.fontconfig ++ lib.optional alsaSupport pkgs.alsa-lib ++ lib.optional pulseaudioSupport pkgs.libpulseaudio - ++ lib.optional (xineramaSupport && !waylandSupport) pkgs.xorg.libXinerama + ++ lib.optional (xineramaSupport && x11Support) pkgs.xorg.libXinerama ++ lib.optional udevSupport pkgs.udev ++ lib.optional vulkanSupport (if stdenv.isDarwin then moltenvk else pkgs.vulkan-loader) ++ lib.optional sdlSupport pkgs.SDL2 @@ -93,7 +93,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { CoreServices Foundation ForceFeedback AppKit OpenGL IOKit DiskArbitration PCSC Security ApplicationServices AudioToolbox CoreAudio AudioUnit CoreMIDI OpenCL Cocoa Carbon ]) - ++ lib.optionals (stdenv.isLinux && !waylandSupport) (with pkgs.xorg; [ + ++ lib.optionals (x11Support) (with pkgs.xorg; [ libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext ]) ++ lib.optionals waylandSupport (with pkgs; [ diff --git a/pkgs/applications/emulators/wine/default.nix b/pkgs/applications/emulators/wine/default.nix index d3b285f36d78..2dc9b2625bf4 100644 --- a/pkgs/applications/emulators/wine/default.nix +++ b/pkgs/applications/emulators/wine/default.nix @@ -37,6 +37,7 @@ usbSupport ? false, mingwSupport ? wineRelease != "stable", waylandSupport ? wineRelease == "wayland", + x11Support ? stdenv.isLinux, embedInstallers ? false, # The Mono and Gecko MSI installers moltenvk ? darwin.moltenvk # Allow users to override MoltenVK easily }: @@ -51,7 +52,7 @@ let wine-build = build: release: v4lSupport saneSupport gphoto2Support krb5Support fontconfigSupport alsaSupport pulseaudioSupport xineramaSupport gtkSupport openclSupport tlsSupport openglSupport gstreamerSupport udevSupport vulkanSupport - sdlSupport usbSupport mingwSupport waylandSupport embedInstallers; + sdlSupport usbSupport mingwSupport waylandSupport x11Support embedInstallers; }; inherit moltenvk; }); From 07a24f168dcef415dd3bde0ec5d660b320556b11 Mon Sep 17 00:00:00 2001 From: Daniel Hill Date: Mon, 18 Sep 2023 21:13:21 +1200 Subject: [PATCH 2/3] wine: add libXfixes Upstream recommends using this library. --- pkgs/applications/emulators/wine/base.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/emulators/wine/base.nix b/pkgs/applications/emulators/wine/base.nix index c49fe9f1de54..9878d1ec8bf0 100644 --- a/pkgs/applications/emulators/wine/base.nix +++ b/pkgs/applications/emulators/wine/base.nix @@ -94,7 +94,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { ApplicationServices AudioToolbox CoreAudio AudioUnit CoreMIDI OpenCL Cocoa Carbon ]) ++ lib.optionals (x11Support) (with pkgs.xorg; [ - libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext + libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext libXfixes ]) ++ lib.optionals waylandSupport (with pkgs; [ wayland libxkbcommon wayland-protocols wayland.dev libxkbcommon.dev From 0ddfdc7c1a70510db19cf2e75b4b278d074d17f0 Mon Sep 17 00:00:00 2001 From: Daniel Hill Date: Tue, 19 Sep 2023 19:50:26 +1200 Subject: [PATCH 3/3] wine: sort supportFlags --- pkgs/applications/emulators/wine/base.nix | 2 +- pkgs/applications/emulators/wine/default.nix | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pkgs/applications/emulators/wine/base.nix b/pkgs/applications/emulators/wine/base.nix index 9878d1ec8bf0..2e84a8f2091c 100644 --- a/pkgs/applications/emulators/wine/base.nix +++ b/pkgs/applications/emulators/wine/base.nix @@ -94,7 +94,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { ApplicationServices AudioToolbox CoreAudio AudioUnit CoreMIDI OpenCL Cocoa Carbon ]) ++ lib.optionals (x11Support) (with pkgs.xorg; [ - libX11 libXi libXcursor libXrandr libXrender libXxf86vm libXcomposite libXext libXfixes + libX11 libXcomposite libXcursor libXext libXfixes libXi libXrandr libXrender libXxf86vm ]) ++ lib.optionals waylandSupport (with pkgs; [ wayland libxkbcommon wayland-protocols wayland.dev libxkbcommon.dev diff --git a/pkgs/applications/emulators/wine/default.nix b/pkgs/applications/emulators/wine/default.nix index 2dc9b2625bf4..06c2b7486cd2 100644 --- a/pkgs/applications/emulators/wine/default.nix +++ b/pkgs/applications/emulators/wine/default.nix @@ -47,12 +47,14 @@ let wine-build = build: release: wineRelease = release; supportFlags = { inherit - cupsSupport gettextSupport dbusSupport cairoSupport - odbcSupport netapiSupport cursesSupport vaSupport pcapSupport - v4lSupport saneSupport gphoto2Support krb5Support fontconfigSupport - alsaSupport pulseaudioSupport xineramaSupport gtkSupport openclSupport - tlsSupport openglSupport gstreamerSupport udevSupport vulkanSupport - sdlSupport usbSupport mingwSupport waylandSupport x11Support embedInstallers; + alsaSupport cairoSupport cupsSupport cursesSupport dbusSupport + embedInstallers fontconfigSupport gettextSupport gphoto2Support + gstreamerSupport gtkSupport krb5Support mingwSupport netapiSupport + odbcSupport openclSupport openglSupport pcapSupport + pulseaudioSupport saneSupport sdlSupport tlsSupport udevSupport + usbSupport v4lSupport vaSupport vulkanSupport waylandSupport + x11Support xineramaSupport + ; }; inherit moltenvk; });