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