From b2182b9130c18c8d8527b86e2e8a2cb749c115fa Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Mon, 5 Feb 2024 23:21:29 +0100 Subject: [PATCH] wine: cleanup Wayland Makes base.nix less Wayland-centric. This means: - Don't specify support in the meta.description (since even regular Wine supports it, it's specified everywhere) - `x11Support` and `waylandSupport` are now set in `wine-packages.nix`, like every other flag (they are also now disabled on minimal) - Disable Darwin in supported platforms if an incompatible supportFlag is true (not just `waylandSupport`) - Add wineRelease name for every release other than "stable" or "unstable", instead of just "wayland" - This also fixes an inconsistency on wine-staging, where "-staging" was written after the version --- pkgs/applications/emulators/wine/base.nix | 8 +++++--- pkgs/applications/emulators/wine/default.nix | 4 ++-- pkgs/applications/emulators/wine/staging.nix | 4 +--- pkgs/top-level/wine-packages.nix | 6 ++++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/emulators/wine/base.nix b/pkgs/applications/emulators/wine/base.nix index 08bf9a630682..fc6d08556091 100644 --- a/pkgs/applications/emulators/wine/base.nix +++ b/pkgs/applications/emulators/wine/base.nix @@ -23,6 +23,8 @@ let mingwGccsSuffixSalts = map (gcc: gcc.suffixSalt) mingwGccs; }; } ./setup-hook-darwin.sh; + darwinUnsupportedFlags = [ "alsaSupport" "cairoSupport" "dbusSupport" "fontconfigSupport" "gtkSupport" "netapiSupport" "pulseaudioSupport" "udevSupport" "v4lSupport" "vaSupport" "waylandSupport" "x11Support" "xineramaSupport" ]; + darwinUnsupported = builtins.any (name: builtins.getAttr name supportFlags) darwinUnsupportedFlags; in stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { builder = buildScript; @@ -47,7 +49,7 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { }) // rec { inherit version src; - pname = prevName + lib.optionalString (wineRelease == "wayland") "-wayland"; + pname = prevName + lib.optionalString (wineRelease != "stable" && wineRelease != "unstable") "-${wineRelease}"; # Fixes "Compiler cannot create executables" building wineWow with mingwSupport strictDeps = true; @@ -209,8 +211,8 @@ stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) { binaryNativeCode # mono, gecko ]; broken = stdenv.isDarwin && !supportFlags.mingwSupport; - description = if supportFlags.waylandSupport then "An Open Source implementation of the Windows API on top of OpenGL and Unix (with experimental Wayland support)" else "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix"; - platforms = if supportFlags.waylandSupport then (lib.remove "x86_64-darwin" prevPlatforms) else prevPlatforms; + description = "An Open Source implementation of the Windows API on top of X, OpenGL, and Unix"; + platforms = if darwinUnsupported then (lib.remove "x86_64-darwin" prevPlatforms) else prevPlatforms; maintainers = with lib.maintainers; [ avnik raskin bendlas jmc-figueira reckenrode ]; inherit mainProgram; }; diff --git a/pkgs/applications/emulators/wine/default.nix b/pkgs/applications/emulators/wine/default.nix index 7e3514fa720a..69706dcfd720 100644 --- a/pkgs/applications/emulators/wine/default.nix +++ b/pkgs/applications/emulators/wine/default.nix @@ -36,8 +36,8 @@ sdlSupport ? false, usbSupport ? false, mingwSupport ? false, - waylandSupport ? stdenv.isLinux, - x11Support ? stdenv.isLinux, + waylandSupport ? false, + x11Support ? false, embedInstallers ? false, # The Mono and Gecko MSI installers moltenvk ? darwin.moltenvk # Allow users to override MoltenVK easily }: diff --git a/pkgs/applications/emulators/wine/staging.nix b/pkgs/applications/emulators/wine/staging.nix index 9e9a03ebfc59..0a99e6d42a87 100644 --- a/pkgs/applications/emulators/wine/staging.nix +++ b/pkgs/applications/emulators/wine/staging.nix @@ -7,12 +7,10 @@ let patch = (callPackage ./sources.nix {}).staging; (mkBuildInputs wineUnstable.pkgArches pkgNames) ++ extra; in assert lib.versions.majorMinor wineUnstable.version == lib.versions.majorMinor patch.version; -(lib.overrideDerivation wineUnstable (self: { +(lib.overrideDerivation (wineUnstable.override { wineRelease = "staging"; }) (self: { buildInputs = build-inputs [ "perl" "util-linux" "autoconf" "gitMinimal" ] self.buildInputs; nativeBuildInputs = [ autoconf hexdump perl python3 ] ++ self.nativeBuildInputs; - name = "${self.name}-staging"; - prePatch = self.prePatch or "" + '' patchShebangs tools cp -r ${patch}/patches ${patch}/staging . diff --git a/pkgs/top-level/wine-packages.nix b/pkgs/top-level/wine-packages.nix index 7cf5533da7f2..18596f21014e 100644 --- a/pkgs/top-level/wine-packages.nix +++ b/pkgs/top-level/wine-packages.nix @@ -25,6 +25,8 @@ rec { sdlSupport = true; mingwSupport = true; usbSupport = true; + waylandSupport = stdenv.isLinux; + x11Support = stdenv.isLinux; }; full = base.override { @@ -50,6 +52,6 @@ rec { staging = base.override { wineRelease = "staging"; }; stagingFull = full.override { wineRelease = "staging"; }; - wayland = base.override { wineRelease = "wayland"; }; - waylandFull = full.override { wineRelease = "wayland"; }; + wayland = base.override { wineRelease = "wayland"; waylandSupport = true; }; + waylandFull = full.override { wineRelease = "wayland"; waylandSupport = true; }; }