From 10e5b931ebcc243badc4678c194aaa04be3f7ab1 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 8 Jul 2020 15:19:32 +0200 Subject: [PATCH 1/5] python3.pkgs.libevdev: hardcode path --- .../python-modules/libevdev/default.nix | 15 ++++++++++++- .../python-modules/libevdev/fix-paths.patch | 22 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/libevdev/fix-paths.patch diff --git a/pkgs/development/python-modules/libevdev/default.nix b/pkgs/development/python-modules/libevdev/default.nix index 220d60663a3..92875660de8 100644 --- a/pkgs/development/python-modules/libevdev/default.nix +++ b/pkgs/development/python-modules/libevdev/default.nix @@ -1,4 +1,10 @@ -{ stdenv, buildPythonPackage, isPy27, fetchPypi }: +{ stdenv +, buildPythonPackage +, isPy27 +, fetchPypi +, substituteAll +, pkgs +}: buildPythonPackage rec { pname = "libevdev"; @@ -10,6 +16,13 @@ buildPythonPackage rec { sha256 = "17agnigmzscmdjqmrylg1lza03hwjhgxbpf4l705s6i7p7ndaqrs"; }; + patches = [ + (substituteAll { + src = ./fix-paths.patch; + libevdev = stdenv.lib.getLib pkgs.libevdev; + }) + ]; + doCheck = false; meta = with stdenv.lib; { diff --git a/pkgs/development/python-modules/libevdev/fix-paths.patch b/pkgs/development/python-modules/libevdev/fix-paths.patch new file mode 100644 index 00000000000..e73c360b146 --- /dev/null +++ b/pkgs/development/python-modules/libevdev/fix-paths.patch @@ -0,0 +1,22 @@ +diff --git a/libevdev/_clib.py b/libevdev/_clib.py +index 6e4ab2c..9db54d1 100644 +--- a/libevdev/_clib.py ++++ b/libevdev/_clib.py +@@ -120,7 +120,7 @@ class Libevdev(_LibraryWrapper): + + @staticmethod + def _cdll(): +- return ctypes.CDLL("libevdev.so.2", use_errno=True) ++ return ctypes.CDLL("@libevdev@/lib/libevdev.so.2", use_errno=True) + + _api_prototypes = { + # const char *libevdev_event_type_get_name(unsigned int type); +@@ -910,7 +910,7 @@ class UinputDevice(_LibraryWrapper): + + @staticmethod + def _cdll(): +- return ctypes.CDLL("libevdev.so.2", use_errno=True) ++ return ctypes.CDLL("@libevdev@/lib/libevdev.so.2", use_errno=True) + + _api_prototypes = { + # int libevdev_uinput_create_from_device(const struct libevdev *, int, struct libevdev_uinput **) From 7c75c1ed56f208c7556e9dcf38ed13c688c982ca Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 8 Jul 2020 15:22:42 +0200 Subject: [PATCH 2/5] python3.pkgs.libevdev: enable tests --- pkgs/development/python-modules/libevdev/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/libevdev/default.nix b/pkgs/development/python-modules/libevdev/default.nix index 92875660de8..a17612c79cb 100644 --- a/pkgs/development/python-modules/libevdev/default.nix +++ b/pkgs/development/python-modules/libevdev/default.nix @@ -4,6 +4,7 @@ , fetchPypi , substituteAll , pkgs +, pytestCheckHook }: buildPythonPackage rec { @@ -23,7 +24,7 @@ buildPythonPackage rec { }) ]; - doCheck = false; + checkInputs = [ pytestCheckHook ]; meta = with stdenv.lib; { description = "Python wrapper around the libevdev C library"; From 6cf81102647a1fcfb5f704c82de1b45deffbb9a2 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 8 Jul 2020 15:06:33 +0200 Subject: [PATCH 3/5] libinput: fix subcommands Running subcommands like `libinput measure` requires python and some python modules. I previously added the dependencies in [1] but [2] accidentally moved them to checkInputs so they are not available at runtime by patchShebangs (especially since tests are disabled). Additionally, the tools were ported from evdev python module to python-libevdev in libinput 1.14, which was missed [3] during upgrade. Finally, other python modules are needed so let's add them as well. [1]: https://github.com/NixOS/nixpkgs/pull/51304 [2]: https://github.com/NixOS/nixpkgs/commit/de14f0c6e1247aa48b0d77c4a3390a61e020bebf [3]: https://github.com/NixOS/nixpkgs/commit/b291f2a9953d48d6edc5c73776db9ba289ccf213 --- .../development/libraries/libinput/default.nix | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libinput/default.nix b/pkgs/development/libraries/libinput/default.nix index f490dfbd23a..148d334b946 100644 --- a/pkgs/development/libraries/libinput/default.nix +++ b/pkgs/development/libraries/libinput/default.nix @@ -47,10 +47,23 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkgconfig meson ninja ] ++ optionals documentationSupport [ doxygen graphviz sphinx-build ]; - buildInputs = [ libevdev mtdev libwacom ] + buildInputs = [ + libevdev + mtdev + libwacom + (python3.withPackages (pp: with pp; [ + pp.libevdev # already in scope + pyudev + pyyaml + setuptools + ])) + ] ++ optionals eventGUISupport [ cairo glib gtk3 ]; - checkInputs = [ (python3.withPackages (pkgs: with pkgs; [ evdev ])) check valgrind ]; + checkInputs = [ + check + valgrind + ]; propagatedBuildInputs = [ udev ]; @@ -60,6 +73,7 @@ stdenv.mkDerivation rec { patchShebangs tools/helper-copy-and-exec-from-tmp.sh patchShebangs test/symbols-leak-test patchShebangs test/check-leftover-udev-rules.sh + patchShebangs test/helper-copy-and-exec-from-tmp.sh ''; doCheck = testsSupport && stdenv.hostPlatform == stdenv.buildPlatform; From d9f416313a36d5df8883725ec35233f779088636 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 8 Jul 2020 16:25:53 +0200 Subject: [PATCH 4/5] python3.pkgs.pyudev: do not propagate systemd It is not linked against so there is no need to include it in build inputs, much less propagate it. This removes systemd.dev from the runtime closure of packages using pyudev. --- pkgs/development/python-modules/pyudev/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/pyudev/default.nix b/pkgs/development/python-modules/pyudev/default.nix index c26f9bcabe6..c0a401a1b2a 100644 --- a/pkgs/development/python-modules/pyudev/default.nix +++ b/pkgs/development/python-modules/pyudev/default.nix @@ -17,7 +17,7 @@ buildPythonPackage rec { ''; checkInputs = [ pytest mock hypothesis docutils ]; - propagatedBuildInputs = [ systemd six ]; + propagatedBuildInputs = [ six ]; checkPhase = '' py.test From f83c9a7561696422a00776065033af35477dba58 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 15 Jul 2020 06:02:54 +0200 Subject: [PATCH 5/5] libevdev: fix aarch64 support --- pkgs/development/libraries/libevdev/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libevdev/default.nix b/pkgs/development/libraries/libevdev/default.nix index 9b1184f1c0b..c769006e0bf 100644 --- a/pkgs/development/libraries/libevdev/default.nix +++ b/pkgs/development/libraries/libevdev/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, python3 }: +{ stdenv, fetchurl, fetchpatch, python3 }: stdenv.mkDerivation rec { pname = "libevdev"; @@ -9,6 +9,15 @@ stdenv.mkDerivation rec { sha256 = "17pb5375njb1r05xmk0r57a2j986ihglh2n5nqcylbag4rj8mqg7"; }; + patches = [ + # Fix libevdev-python tests on aarch64 + # https://gitlab.freedesktop.org/libevdev/libevdev/merge_requests/63 + (fetchpatch { + url = "https://gitlab.freedesktop.org/libevdev/libevdev/commit/66113fe84f62bab3a672a336eb10b255d2aa5ce7.patch"; + sha256 = "gZKr/P+/OqU69IGslP8CQlcGuyzA/ulcm+nGwHdis58="; + }) + ]; + nativeBuildInputs = [ python3 ]; meta = with stdenv.lib; {