1{
2 lib,
3 buildPythonApplication,
4 fetchFromGitHub,
5 replaceVars,
6 writeShellScript,
7 steam-run,
8 fetchpatch2,
9 setuptools-scm,
10 vdf,
11 pillow,
12 winetricks,
13 yad,
14 pytestCheckHook,
15 nix-update-script,
16 extraCompatPaths ? "",
17}:
18
19buildPythonApplication rec {
20 pname = "protontricks";
21 version = "1.13.0";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "Matoking";
26 repo = "protontricks";
27 tag = version;
28 hash = "sha256-6z6J31EBXf0FU3fWjjg3dX7OAOiN9Z3ONdKIweJiZBY=";
29 };
30
31 patches = [
32 # Use steam-run to run Proton binaries
33 (replaceVars ./steam-run.patch {
34 steamRun = lib.getExe steam-run;
35 bash = writeShellScript "steam-run-bash" ''
36 exec ${lib.getExe steam-run} bash "$@"
37 '';
38 })
39
40 # Revert vendored vdf since our vdf includes `appinfo.vdf` v29 support
41 (fetchpatch2 {
42 url = "https://github.com/Matoking/protontricks/commit/4198b7ea82369a91e3084d6e185f9b370f78eaec.patch";
43 revert = true;
44 hash = "sha256-1U/LiAliKtk3ygbIBsmoavXN0RSykiiegtml+bO8CnI=";
45 })
46 ];
47
48 build-system = [ setuptools-scm ];
49
50 dependencies = [
51 vdf
52 pillow
53 ];
54
55 makeWrapperArgs = [
56 "--prefix PATH : ${
57 lib.makeBinPath [
58 winetricks
59 yad
60 ]
61 }"
62 # Steam Runtime does not work outside of steam-run, so don't use it
63 "--set STEAM_RUNTIME 0"
64 ]
65 ++ lib.optional (extraCompatPaths != "") "--set STEAM_EXTRA_COMPAT_TOOLS_PATHS ${extraCompatPaths}";
66
67 nativeCheckInputs = [ pytestCheckHook ];
68
69 # From 1.6.0 release notes (https://github.com/Matoking/protontricks/releases/tag/1.6.0):
70 # In most cases the script is unnecessary and should be removed as part of the packaging process.
71 postInstall = ''
72 rm "$out/bin/protontricks-desktop-install"
73 '';
74
75 pythonImportsCheck = [ "protontricks" ];
76
77 passthru.updateScript = nix-update-script { };
78
79 meta = with lib; {
80 description = "Simple wrapper for running Winetricks commands for Proton-enabled games";
81 homepage = "https://github.com/Matoking/protontricks";
82 changelog = "https://github.com/Matoking/protontricks/blob/${src.tag}/CHANGELOG.md";
83 license = licenses.gpl3Only;
84 maintainers = with maintainers; [ kira-bruneau ];
85 platforms = [
86 "x86_64-linux"
87 "i686-linux"
88 ];
89 };
90}