anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / tools / package-management / protontricks / default.nix
blob13b7158e79697fe3891aacddf9f5ed98c95b4714
2   lib,
3   buildPythonApplication,
4   fetchFromGitHub,
5   substituteAll,
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 ? "",
20 buildPythonApplication rec {
21   pname = "protontricks";
22   version = "1.12.0";
24   src = fetchFromGitHub {
25     owner = "Matoking";
26     repo = "protontricks";
27     rev = "refs/tags/${version}";
28     hash = "sha256-dCb8mcwXoxD4abJjLEwk5tGp65XkvepmOX+Kc9Dl7fQ=";
29   };
31   patches = [
32     # Use steam-run to run Proton binaries
33     (substituteAll {
34       src = ./steam-run.patch;
35       steamRun = lib.getExe steam-run;
36       bash = writeShellScript "steam-run-bash" ''
37         exec ${lib.getExe steam-run} bash "$@"
38       '';
39     })
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     })
48     # Fix test_run_no_args test
49     (fetchpatch2 {
50       url = "https://github.com/Matoking/protontricks/commit/ff2381ad379a612e73f0d4604f1c9c3a012b3355.patch";
51       hash = "sha256-aiafLbiqS6TBBiQpfTYPVqhQs2OXYg/4yCtbuTv6Ug8=";
52     })
53   ];
55   nativeBuildInputs = [ setuptools-scm ];
57   propagatedBuildInputs = [
58     setuptools # implicit dependency, used to find data/icon_placeholder.png
59     vdf
60     pillow
61   ];
63   makeWrapperArgs =
64     [
65       "--prefix PATH : ${
66         lib.makeBinPath [
67           winetricks
68           yad
69         ]
70       }"
71       # Steam Runtime does not work outside of steam-run, so don't use it
72       "--set STEAM_RUNTIME 0"
73     ]
74     ++ lib.optional (extraCompatPaths != "") "--set STEAM_EXTRA_COMPAT_TOOLS_PATHS ${extraCompatPaths}";
76   nativeCheckInputs = [ pytestCheckHook ];
78   # From 1.6.0 release notes (https://github.com/Matoking/protontricks/releases/tag/1.6.0):
79   # In most cases the script is unnecessary and should be removed as part of the packaging process.
80   postInstall = ''
81     rm "$out/bin/protontricks-desktop-install"
82   '';
84   pythonImportsCheck = [ "protontricks" ];
86   passthru.updateScript = nix-update-script { };
88   meta = with lib; {
89     description = "Simple wrapper for running Winetricks commands for Proton-enabled games";
90     homepage = "https://github.com/Matoking/protontricks";
91     license = licenses.gpl3Only;
92     maintainers = with maintainers; [ kira-bruneau ];
93     platforms = [
94       "x86_64-linux"
95       "i686-linux"
96     ];
97   };