Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 63 lines 2.0 kB view raw
1{ lib, buildPythonApplication, fetchFromGitHub, wrapGAppsHook 2, gtk3, gobject-introspection, libappindicator-gtk3, librsvg 3, evdev, pygobject3, pylibacl, pytest, bluez 4, linuxHeaders 5, libX11, libXext, libXfixes, libusb1, udev 6}: 7 8buildPythonApplication rec { 9 pname = "sc-controller"; 10 version = "0.4.7"; 11 12 src = fetchFromGitHub { 13 owner = "kozec"; 14 repo = pname; 15 rev = "v${version}"; 16 sha256 = "1dskjh5qcjf4x21n4nk1zvdfivbgimsrc2lq1id85bibzps29499"; 17 }; 18 19 nativeBuildInputs = [ wrapGAppsHook ]; 20 21 buildInputs = [ gtk3 gobject-introspection libappindicator-gtk3 librsvg ]; 22 23 propagatedBuildInputs = [ evdev pygobject3 pylibacl ]; 24 25 checkInputs = [ pytest ]; 26 27 postPatch = '' 28 substituteInPlace scc/paths.py --replace sys.prefix "'$out'" 29 substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include 30 substituteInPlace scc/device_monitor.py --replace "find_library('bluetooth')" "'libbluetooth.so.3'" 31 ''; 32 33 LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 udev bluez ]; 34 35 preFixup = '' 36 gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH") 37 # gdk-pixbuf setup hook can not choose between propagated librsvg 38 # and our librsvg with GObject introspection. 39 GDK_PIXBUF_MODULE_FILE=$(echo ${librsvg}/lib/gdk-pixbuf-2.0/*/loaders.cache) 40 ''; 41 42 postFixup = '' 43 ( 44 # scc runs these scripts as programs. (See find_binary() in scc/tools.py.) 45 cd $out/lib/python*/site-packages/scc/x11 46 patchPythonScript scc-autoswitch-daemon.py 47 patchPythonScript scc-osd-daemon.py 48 ) 49 ''; 50 51 checkPhase = '' 52 PYTHONPATH=. py.test 53 ''; 54 55 meta = with lib; { 56 homepage = https://github.com/kozec/sc-controller; 57 # donations: https://www.patreon.com/kozec 58 description = "User-mode driver and GUI for Steam Controller and other controllers"; 59 license = licenses.gpl2; 60 platforms = platforms.linux; 61 maintainers = with maintainers; [ orivej rnhmjoj ]; 62 }; 63}