2020-04-24 23:36:52 +00:00
|
|
|
{ lib, buildPythonApplication, fetchFromGitHub, wrapGAppsHook
|
2021-09-18 10:52:07 +00:00
|
|
|
, pytestCheckHook
|
2022-10-21 18:38:19 +00:00
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
, gtk3, gobject-introspection, libappindicator-gtk3, librsvg
|
2021-09-18 10:52:07 +00:00
|
|
|
, evdev, pygobject3, pylibacl, bluez, vdf
|
2020-04-24 23:36:52 +00:00
|
|
|
, linuxHeaders
|
|
|
|
, libX11, libXext, libXfixes, libusb1, udev
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonApplication rec {
|
|
|
|
pname = "sc-controller";
|
2022-10-21 18:38:19 +00:00
|
|
|
version = "0.4.8.9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-09-18 10:52:07 +00:00
|
|
|
owner = "Ryochan7";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-10-21 18:38:19 +00:00
|
|
|
sha256 = "sha256-ym5fkOTRhibBaUqT0+p/jyqqKOVsyMz5INgfkoz0IJA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
# see https://github.com/NixOS/nixpkgs/issues/56943
|
|
|
|
strictDeps = false;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ wrapGAppsHook ];
|
|
|
|
|
|
|
|
buildInputs = [ gtk3 gobject-introspection libappindicator-gtk3 librsvg ];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
propagatedBuildInputs = [ evdev pygobject3 pylibacl vdf ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
patches = [
|
|
|
|
# Fix a broken test
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/Ryochan7/sc-controller/pull/73.patch";
|
|
|
|
sha256 = "sha256-qU8hIReZE3cEPCMOFc4RCUCIhiS0gJ3PushMkfDlPns=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
|
|
|
|
substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
|
|
|
|
substituteInPlace scc/device_monitor.py --replace "find_library('bluetooth')" "'libbluetooth.so.3'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 udev bluez ];
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
(
|
|
|
|
# scc runs these scripts as programs. (See find_binary() in scc/tools.py.)
|
|
|
|
cd $out/lib/python*/site-packages/scc/x11
|
|
|
|
patchPythonScript scc-autoswitch-daemon.py
|
|
|
|
patchPythonScript scc-osd-daemon.py
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2021-09-18 10:52:07 +00:00
|
|
|
homepage = "https://github.com/Ryochan7/sc-controller";
|
2020-04-24 23:36:52 +00:00
|
|
|
# donations: https://www.patreon.com/kozec
|
|
|
|
description = "User-mode driver and GUI for Steam Controller and other controllers";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ orivej rnhmjoj ];
|
|
|
|
};
|
|
|
|
}
|