summaryrefslogtreecommitdiffstats
path: root/pkgs/misc/drivers/sc-controller
diff options
context:
space:
mode:
authorOrivej Desh <orivej@gmx.fr>2018-01-03 00:01:37 +0000
committerOrivej Desh <orivej@gmx.fr>2018-01-03 03:27:34 +0000
commit24d61a48b30bb53b4b1720f215f613879e6d1037 (patch)
treee77ffb77516fa159eab729551111e5f7021f58d9 /pkgs/misc/drivers/sc-controller
parentaa241aed14a76a87b04819ac7a6bee645c7a5e70 (diff)
sc-controller: init at 0.4.0.1
Diffstat (limited to 'pkgs/misc/drivers/sc-controller')
-rw-r--r--pkgs/misc/drivers/sc-controller/default.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/misc/drivers/sc-controller/default.nix b/pkgs/misc/drivers/sc-controller/default.nix
new file mode 100644
index 000000000000..bbb0d1523dfe
--- /dev/null
+++ b/pkgs/misc/drivers/sc-controller/default.nix
@@ -0,0 +1,62 @@
+{ lib, buildPythonApplication, fetchFromGitHub, wrapGAppsHook
+, gtk3, gobjectIntrospection, libappindicator-gtk3, librsvg
+, evdev, pygobject3, pylibacl, pytest
+, linuxHeaders
+, libX11, libXext, libXfixes, libusb1
+}:
+
+buildPythonApplication rec {
+ pname = "sc-controller";
+ version = "0.4.0.1";
+
+ src = fetchFromGitHub {
+ owner = "kozec";
+ repo = "sc-controller";
+ rev = "v${version}";
+ sha256 = "0vhgiqg4r4bnn004ql80rvi23y05wlax80sj8qsr91pvqsxwv3yl";
+ };
+
+ nativeBuildInputs = [ wrapGAppsHook ];
+
+ buildInputs = [ gtk3 gobjectIntrospection libappindicator-gtk3 librsvg ];
+
+ propagatedBuildInputs = [ evdev pygobject3 pylibacl ];
+
+ checkInputs = [ pytest ];
+
+ postPatch = ''
+ substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
+ substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
+ '';
+
+ LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 ];
+
+ preFixup = ''
+ gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
+ # gdk-pixbuf setup hook can not choose between propagated librsvg
+ # and our librsvg with GObject introspection.
+ GDK_PIXBUF_MODULE_FILE=$(echo ${librsvg}/lib/gdk-pixbuf-2.0/*/loaders.cache)
+ '';
+
+ 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
+ )
+ '';
+
+ checkPhase = ''
+ PYTHONPATH=. py.test
+ '';
+
+ meta = with lib; {
+ homepage = https://github.com/kozec/sc-controller;
+ # 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 = [ maintainers.orivej ];
+ };
+}