From a7b4a999ec55a6d6515947a06636a7fc84377369 Mon Sep 17 00:00:00 2001 From: K900 Date: Tue, 9 Jan 2024 10:03:23 +0300 Subject: [PATCH] protontricks: 1.10.1 -> 1.11.0 --- .../protontricks/default.nix | 21 +- .../protontricks/steam-run.patch | 433 +----------------- 2 files changed, 29 insertions(+), 425 deletions(-) diff --git a/pkgs/tools/package-management/protontricks/default.nix b/pkgs/tools/package-management/protontricks/default.nix index b8689fdf9966..55392eaad833 100644 --- a/pkgs/tools/package-management/protontricks/default.nix +++ b/pkgs/tools/package-management/protontricks/default.nix @@ -4,7 +4,9 @@ , setuptools-scm , setuptools , vdf -, bash +, pillow +, substituteAll +, writeShellScript , steam-run , winetricks , yad @@ -14,18 +16,24 @@ buildPythonApplication rec { pname = "protontricks"; - version = "1.10.1"; + version = "1.11.0"; src = fetchFromGitHub { owner = "Matoking"; repo = pname; rev = version; - sha256 = "sha256-gKrdUwX5TzeHHXuwhUyI4REPE6TNiZ6lhonyMCHcBCA="; + sha256 = "sha256-5FpcIaQodvNjdqUfD9hvXlrdhszr98j0zm3MCCpZFoc="; }; patches = [ # Use steam-run to run Proton binaries - ./steam-run.patch + (substituteAll { + src = ./steam-run.patch; + steamRun = lib.getExe steam-run; + bash = writeShellScript "steam-run-bash" '' + exec ${lib.getExe steam-run} bash "$@" + ''; + }) ]; SETUPTOOLS_SCM_PRETEND_VERSION = version; @@ -35,15 +43,16 @@ buildPythonApplication rec { propagatedBuildInputs = [ setuptools # implicit dependency, used to find data/icon_placeholder.png vdf + pillow ]; makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ - bash - steam-run winetricks yad ]}" + # Steam Runtime does not work outside of steam-run, so don't use it + "--set STEAM_RUNTIME 0" ]; nativeCheckInputs = [ pytestCheckHook ]; diff --git a/pkgs/tools/package-management/protontricks/steam-run.patch b/pkgs/tools/package-management/protontricks/steam-run.patch index bcc1fc989836..3c865746377a 100644 --- a/pkgs/tools/package-management/protontricks/steam-run.patch +++ b/pkgs/tools/package-management/protontricks/steam-run.patch @@ -1,470 +1,65 @@ -diff --git a/src/protontricks/cli/main.py b/src/protontricks/cli/main.py -index c77d287..236c2a9 100755 ---- a/src/protontricks/cli/main.py -+++ b/src/protontricks/cli/main.py -@@ -17,8 +17,7 @@ from ..flatpak import (FLATPAK_BWRAP_COMPATIBLE_VERSION, - get_running_flatpak_version) - from ..gui import (prompt_filesystem_access, select_steam_app_with_gui, - select_steam_installation) --from ..steam import (find_legacy_steam_runtime_path, find_proton_app, -- find_steam_installations, get_steam_apps, -+from ..steam import (find_proton_app, find_steam_installations, get_steam_apps, - get_steam_lib_paths) - from ..util import run_command - from ..winetricks import get_winetricks_path -@@ -67,8 +66,7 @@ def main(args=None, steam_path=None, steam_root=None): - "WINE: path to a custom 'wine' executable\n" - "WINESERVER: path to a custom 'wineserver' executable\n" - "STEAM_RUNTIME: 1 = enable Steam Runtime, 0 = disable Steam " -- "Runtime, valid path = custom Steam Runtime path, " -- "empty = enable automatically (default)\n" -+ "Runtime, empty = enable automatically (default)\n" - "PROTONTRICKS_GUI: GUI provider to use, accepts either 'yad' " - "or 'zenity'" - ), -@@ -204,17 +202,9 @@ def main(args=None, steam_path=None, steam_root=None): - if not steam_path: - exit_("No Steam installation was selected.") - -- # 2. Find the pre-installed legacy Steam Runtime if enabled -- legacy_steam_runtime_path = None -- use_steam_runtime = True -- -+ # 2. Use Steam Runtime if enabled - if os.environ.get("STEAM_RUNTIME", "") != "0" and not args.no_runtime: -- legacy_steam_runtime_path = find_legacy_steam_runtime_path( -- steam_root=steam_root -- ) -- -- if not legacy_steam_runtime_path: -- exit_("Steam Runtime was enabled but couldn't be found!") -+ use_steam_runtime = True - else: - use_steam_runtime = False - logger.info("Steam Runtime disabled.") -@@ -281,7 +271,6 @@ def main(args=None, steam_path=None, steam_root=None): - proton_app=proton_app, - steam_app=steam_app, - use_steam_runtime=use_steam_runtime, -- legacy_steam_runtime_path=legacy_steam_runtime_path, - command=[str(winetricks_path), "--gui"], - use_bwrap=use_bwrap, - start_wineserver=start_background_wineserver -@@ -361,7 +350,6 @@ def main(args=None, steam_path=None, steam_root=None): - proton_app=proton_app, - steam_app=steam_app, - use_steam_runtime=use_steam_runtime, -- legacy_steam_runtime_path=legacy_steam_runtime_path, - use_bwrap=use_bwrap, - start_wineserver=start_background_wineserver, - command=[str(winetricks_path)] + args.winetricks_command -@@ -373,7 +361,6 @@ def main(args=None, steam_path=None, steam_root=None): - steam_app=steam_app, - command=args.command, - use_steam_runtime=use_steam_runtime, -- legacy_steam_runtime_path=legacy_steam_runtime_path, - use_bwrap=use_bwrap, - start_wineserver=start_background_wineserver, - # Pass the command directly into the shell *without* diff --git a/src/protontricks/data/scripts/bwrap_launcher.sh b/src/protontricks/data/scripts/bwrap_launcher.sh -index b5552e1..b11bc99 100644 +index 922c59d..54742a4 100644 --- a/src/protontricks/data/scripts/bwrap_launcher.sh +++ b/src/protontricks/data/scripts/bwrap_launcher.sh @@ -1,4 +1,4 @@ -#!/bin/bash -+#!/usr/bin/env bash ++#!@bash@ # Helper script set -o errexit -@@ -80,6 +80,8 @@ done - log_info "Following directories will be mounted inside container: ${mount_dirs[*]}" - log_info "Using temporary directory: $PROTONTRICKS_TEMP_PATH" - --exec "$STEAM_RUNTIME_PATH"/run --share-pid --launcher \ -+exec steam-run "$STEAM_RUNTIME_PATH"/pressure-vessel/bin/pressure-vessel-wrap \ -+--variable-dir="${PRESSURE_VESSEL_VARIABLE_DIR:-$STEAM_RUNTIME_PATH/var}" \ -+--share-pid --launcher \ - "${mount_params[@]}" -- \ - --bus-name="com.github.Matoking.protontricks.App${STEAM_APPID}_${PROTONTRICKS_SESSION_ID}" diff --git a/src/protontricks/data/scripts/wine_launch.sh b/src/protontricks/data/scripts/wine_launch.sh -index 1f8a432..2d82f2b 100644 +index 1b0a0ce..127f13e 100644 --- a/src/protontricks/data/scripts/wine_launch.sh +++ b/src/protontricks/data/scripts/wine_launch.sh @@ -1,4 +1,4 @@ -#!/bin/bash -+#!/usr/bin/env -S steam-run bash ++#!@bash@ # Helper script created by Protontricks to run Wine binaries using Steam Runtime set -o errexit -@@ -158,8 +158,8 @@ if [[ -n "$PROTONTRICKS_INSIDE_STEAM_RUNTIME" - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PROTON_LD_LIBRARY_PATH" - log_info "Appending to LD_LIBRARY_PATH: $PROTON_LD_LIBRARY_PATH" - elif [[ "$PROTONTRICKS_STEAM_RUNTIME" = "legacy" ]]; then -- export LD_LIBRARY_PATH="$PROTON_LD_LIBRARY_PATH" -- log_info "LD_LIBRARY_PATH set to $LD_LIBRARY_PATH" -+ export LD_LIBRARY_PATH="$PROTON_LD_LIBRARY_PATH":"$LD_LIBRARY_PATH" -+ log_info "Inserting to head of LD_LIBRARY_PATH: $PROTON_LD_LIBRARY_PATH" - fi - exec "$PROTON_DIST_PATH"/bin/@@name@@ "$@" || : - elif [[ "$PROTONTRICKS_STEAM_RUNTIME" = "bwrap" ]]; then diff --git a/src/protontricks/data/scripts/wineserver_keepalive.sh b/src/protontricks/data/scripts/wineserver_keepalive.sh -index 8168dae..559de33 100644 +index 8168dae..cb3e7d9 100644 --- a/src/protontricks/data/scripts/wineserver_keepalive.sh +++ b/src/protontricks/data/scripts/wineserver_keepalive.sh @@ -1,4 +1,4 @@ -#!/bin/bash -+#!/usr/bin/env bash ++#!@bash@ # A simple keepalive script that will ensure a wineserver process is kept alive # for the duration of the Protontricks session. # This is accomplished by launching a simple Windows batch script that will -diff --git a/src/protontricks/steam.py b/src/protontricks/steam.py -index c39b51d..79de098 100644 ---- a/src/protontricks/steam.py -+++ b/src/protontricks/steam.py -@@ -14,9 +14,8 @@ from .util import lower_dict - - __all__ = ( - "COMMON_STEAM_DIRS", "SteamApp", "find_steam_installations", -- "find_steam_path", "find_legacy_steam_runtime_path", -- "iter_appinfo_sections", "get_appinfo_sections", "get_tool_appid", -- "find_steam_compat_tool_app", "find_appid_proton_prefix", -+ "find_steam_path", "iter_appinfo_sections", "get_appinfo_sections", -+ "get_tool_appid", "find_steam_compat_tool_app", "find_appid_proton_prefix", - "find_proton_app", "get_steam_lib_paths", "get_compat_tool_dirs", - "get_custom_compat_tool_installations_in_dir", - "get_custom_compat_tool_installations", "find_current_steamid3", -@@ -393,37 +392,6 @@ def find_steam_path(): - return None, None - - --def find_legacy_steam_runtime_path(steam_root): -- """ -- Find the legacy Steam Runtime either using the STEAM_RUNTIME env or -- steam_root -- """ -- env_steam_runtime = os.environ.get("STEAM_RUNTIME", "") -- -- if env_steam_runtime == "0": -- # User has disabled Steam Runtime -- logger.info("STEAM_RUNTIME is 0. Disabling Steam Runtime.") -- return None -- elif env_steam_runtime and Path(env_steam_runtime).is_dir(): -- # User has a custom Steam Runtime -- logger.info( -- "Using custom Steam Runtime at %s", env_steam_runtime) -- return Path(env_steam_runtime) -- elif env_steam_runtime in ["1", ""]: -- # User has enabled Steam Runtime or doesn't have STEAM_RUNTIME set; -- # default to enabled Steam Runtime in either case -- steam_runtime_path = steam_root / "ubuntu12_32" / "steam-runtime" -- -- logger.info( -- "Using default Steam Runtime at %s", str(steam_runtime_path)) -- return steam_runtime_path -- -- logger.error( -- "Path in STEAM_RUNTIME doesn't point to a valid Steam Runtime!") -- -- return None -- -- - APPINFO_STRUCT_HEADER = "<4sL" - APPINFO_V27_STRUCT_SECTION = "