nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python3Packages,
4 fetchFromGitHub,
5 wrapGAppsHook3,
6 gtk3,
7 gobject-introspection,
8 libappindicator-gtk3,
9 librsvg,
10 bluez,
11 linuxHeaders,
12 libX11,
13 libXext,
14 libXfixes,
15 libusb1,
16 udev,
17 udevCheckHook,
18 gtk-layer-shell,
19}:
20
21python3Packages.buildPythonApplication rec {
22 pname = "sc-controller";
23 version = "0.5.5";
24 format = "setuptools";
25
26 src = fetchFromGitHub {
27 owner = "C0rn3j";
28 repo = "sc-controller";
29 tag = "v${version}";
30 hash = "sha256-IQxHa0bR8FWad9v5DfvXHskwayCgzbJm5ekzf1sjfiQ=";
31 };
32
33 nativeBuildInputs = [
34 wrapGAppsHook3
35 gobject-introspection
36 udevCheckHook
37 ];
38
39 buildInputs = [
40 gtk3
41 libappindicator-gtk3
42 librsvg
43 ];
44
45 dependencies =
46 with python3Packages;
47 [
48 evdev
49 pygobject3
50 pylibacl
51 vdf
52 ioctl-opt
53 ]
54 ++ [
55 gtk-layer-shell
56 python3Packages.libusb1
57 ];
58
59 nativeCheckInputs = [
60 python3Packages.pytestCheckHook
61 python3Packages.libusb1
62 python3Packages.toml
63 ];
64
65 patches = [ ./scc_osd_keyboard.patch ];
66
67 postPatch = ''
68 substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
69 substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
70 substituteInPlace scc/device_monitor.py --replace "find_library('bluetooth')" "'libbluetooth.so.3'"
71 '';
72
73 LD_LIBRARY_PATH = lib.makeLibraryPath [
74 libX11
75 libXext
76 libXfixes
77 libusb1
78 udev
79 bluez
80 ];
81
82 preFixup = ''
83 gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
84 '';
85
86 postFixup = ''
87 (
88 # scc runs these scripts as programs. (See find_binary() in scc/tools.py.)
89 cd $out/lib/python*/site-packages/scc/x11
90 patchPythonScript scc-autoswitch-daemon.py
91 patchPythonScript scc-osd-daemon.py
92 )
93 '';
94
95 doInstallCheck = true;
96
97 meta = {
98 homepage = "https://github.com/C0rn3j/sc-controller";
99 # donations: https://www.patreon.com/kozec
100 description = "User-mode driver and GUI for Steam Controller and other controllers";
101 license = lib.licenses.gpl2Only;
102 platforms = lib.platforms.linux;
103 maintainers = with lib.maintainers; [
104 rnhmjoj
105 ];
106 };
107}