nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, buildPythonApplication, fetchFromGitHub, wrapGAppsHook
2, pytestCheckHook
3, gtk3, gobject-introspection, libappindicator-gtk3, librsvg
4, evdev, pygobject3, pylibacl, bluez, vdf
5, linuxHeaders
6, libX11, libXext, libXfixes, libusb1, udev
7}:
8
9buildPythonApplication rec {
10 pname = "sc-controller";
11 version = "0.4.8.6";
12
13 src = fetchFromGitHub {
14 owner = "Ryochan7";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "1fgizgzm79zl9r2kkwvh1gf9lnxaix15283xxk6bz843inr8b88k";
18 };
19
20 # see https://github.com/NixOS/nixpkgs/issues/56943
21 strictDeps = false;
22
23 nativeBuildInputs = [ wrapGAppsHook ];
24
25 buildInputs = [ gtk3 gobject-introspection libappindicator-gtk3 librsvg ];
26
27 propagatedBuildInputs = [ evdev pygobject3 pylibacl vdf ];
28
29 checkInputs = [ pytestCheckHook ];
30
31 postPatch = ''
32 substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
33 substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
34 substituteInPlace scc/device_monitor.py --replace "find_library('bluetooth')" "'libbluetooth.so.3'"
35 '';
36
37 LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 udev bluez ];
38
39 preFixup = ''
40 gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
41 '';
42
43 postFixup = ''
44 (
45 # scc runs these scripts as programs. (See find_binary() in scc/tools.py.)
46 cd $out/lib/python*/site-packages/scc/x11
47 patchPythonScript scc-autoswitch-daemon.py
48 patchPythonScript scc-osd-daemon.py
49 )
50 '';
51
52 meta = with lib; {
53 homepage = "https://github.com/Ryochan7/sc-controller";
54 # donations: https://www.patreon.com/kozec
55 description = "User-mode driver and GUI for Steam Controller and other controllers";
56 license = licenses.gpl2;
57 platforms = platforms.linux;
58 maintainers = with maintainers; [ orivej rnhmjoj ];
59 };
60}