protontricks: support proton wine with steam-run

This commit is contained in:
MetaDark
2020-12-12 20:52:00 -05:00
committed by Kira Bruneau
parent 58cb538386
commit 56b35d8859
3 changed files with 232 additions and 27 deletions
@@ -1,13 +1,12 @@
{ stdenv
, lib
{ lib
, buildPythonApplication
, fetchFromGitHub
, setuptools_scm
, vdf
, wine
, steam-run
, winetricks
, zenity
, pytest
, pytestCheckHook
}:
buildPythonApplication rec {
@@ -21,11 +20,10 @@ buildPythonApplication rec {
sha256 = "0ri4phi1rna9snrxa6gl23walyack09mgax7zpjqfpxivwls3ach";
};
# Fix interpreter in mock run.sh for tests
postPatch = ''
substituteInPlace tests/conftest.py \
--replace '#!/bin/bash' '#!${stdenv.shell}' \
'';
patches = [
# Use steam-run to run Proton binaries
./steam-run.patch
];
preBuild = ''
export SETUPTOOLS_SCM_PRETEND_VERSION="${version}"
@@ -34,22 +32,21 @@ buildPythonApplication rec {
nativeBuildInputs = [ setuptools_scm ];
propagatedBuildInputs = [ vdf ];
# The wine install shipped with Proton must run under steam's
# chrootenv, but winetricks and zenity break when running under
# it. See https://github.com/NixOS/nix/issues/902.
#
# The current workaround is to use wine from nixpkgs
makeWrapperArgs = [
"--set STEAM_RUNTIME 0"
"--set-default WINE ${wine}/bin/wine"
"--set-default WINESERVER ${wine}/bin/wineserver"
"--prefix PATH : ${lib.makeBinPath [ winetricks zenity ]}"
"--prefix PATH : ${lib.makeBinPath [
steam-run
winetricks
zenity
]}"
];
checkInputs = [ pytest ];
checkPhase = "pytest";
checkInputs = [ pytestCheckHook ];
disabledTests = [
# Steam runtime is hard-coded with steam-run.patch and can't be configured
"test_run_steam_runtime_not_found"
];
meta = with stdenv.lib; {
meta = with lib; {
description = "A simple wrapper for running Winetricks commands for Proton-enabled games";
homepage = "https://github.com/Matoking/protontricks";
license = licenses.gpl3;