mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
sc-controller: fix udev for NixOS
This commit is contained in:
parent
81b681c0f5
commit
5914624410
2 changed files with 26 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
, gtk3, gobjectIntrospection, libappindicator-gtk3, librsvg
|
, gtk3, gobjectIntrospection, libappindicator-gtk3, librsvg
|
||||||
, evdev, pygobject3, pylibacl, pytest
|
, evdev, pygobject3, pylibacl, pytest
|
||||||
, linuxHeaders
|
, linuxHeaders
|
||||||
, libX11, libXext, libXfixes, libusb1
|
, libX11, libXext, libXfixes, libusb1, libudev
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonApplication rec {
|
buildPythonApplication rec {
|
||||||
|
@ -24,12 +24,14 @@ buildPythonApplication rec {
|
||||||
|
|
||||||
checkInputs = [ pytest ];
|
checkInputs = [ pytest ];
|
||||||
|
|
||||||
|
patches = [ ./fix-udev.patch ];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
|
substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
|
||||||
substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
|
substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
|
||||||
'';
|
'';
|
||||||
|
|
||||||
LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 ];
|
LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 libudev ];
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
|
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
|
||||||
|
|
22
pkgs/misc/drivers/sc-controller/fix-udev.patch
Normal file
22
pkgs/misc/drivers/sc-controller/fix-udev.patch
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
diff --git a/scc/lib/eudevmonitor.py b/scc/lib/eudevmonitor.py
|
||||||
|
index 6c1bd18..182eff2 100644
|
||||||
|
--- a/scc/lib/eudevmonitor.py
|
||||||
|
+++ b/scc/lib/eudevmonitor.py
|
||||||
|
@@ -28,12 +28,11 @@ class Eudev:
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self._ctx = None
|
||||||
|
- self._lib = ctypes.CDLL(find_library(self.LIB_NAME))
|
||||||
|
- if self._lib is None:
|
||||||
|
- # Alternative approach for NixOS
|
||||||
|
- try:
|
||||||
|
- self._lib = ctypes.cdll.LoadLibrary("libudev.so")
|
||||||
|
- except OSError:
|
||||||
|
+ try:
|
||||||
|
+ self._lib = ctypes.cdll.LoadLibrary("libudev.so")
|
||||||
|
+ except OSError:
|
||||||
|
+ self._lib = ctypes.CDLL(find_library(self.LIB_NAME))
|
||||||
|
+ if self._lib is None:
|
||||||
|
raise ImportError("No library named udev")
|
||||||
|
Eudev._setup_lib(self._lib)
|
||||||
|
self._ctx = self._lib.udev_new()
|
Loading…
Reference in a new issue