nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchurl, pkgconfig, meson, ninja
2, libevdev, mtdev, udev, libwacom
3, documentationSupport ? false, doxygen ? null, graphviz ? null # Documentation
4, eventGUISupport ? false, cairo ? null, glib ? null, gtk3 ? null # GUI event viewer support
5, testsSupport ? false, check ? null, valgrind ? null, python3 ? null
6}:
7
8assert documentationSupport -> doxygen != null && graphviz != null && python3 != null;
9assert eventGUISupport -> cairo != null && glib != null && gtk3 != null;
10assert testsSupport -> check != null && valgrind != null && python3 != null;
11
12let
13 mkFlag = optSet: flag: "-D${flag}=${stdenv.lib.boolToString optSet}";
14
15 sphinx-build = if documentationSupport then
16 python3.pkgs.sphinx.overrideAttrs (super: {
17 propagatedBuildInputs = super.propagatedBuildInputs ++ (with python3.pkgs; [ recommonmark sphinx_rtd_theme ]);
18
19 postFixup = super.postFixup or "" + ''
20 # Do not propagate Python
21 rm $out/nix-support/propagated-build-inputs
22 '';
23 })
24 else null;
25in
26
27with stdenv.lib;
28stdenv.mkDerivation rec {
29 pname = "libinput";
30 version = "1.15.0";
31
32 src = fetchurl {
33 url = "https://www.freedesktop.org/software/libinput/${pname}-${version}.tar.xz";
34 sha256 = "1qa3b2fd4pv8ysf0mgwnyhqv9v48zgy3sy0q3a3vxcmwcvpizgxz";
35 };
36
37 outputs = [ "bin" "out" "dev" ];
38
39 mesonFlags = [
40 (mkFlag documentationSupport "documentation")
41 (mkFlag eventGUISupport "debug-gui")
42 (mkFlag testsSupport "tests")
43 "--sysconfdir=/etc"
44 "--libexecdir=${placeholder "bin"}/libexec"
45 ];
46
47 nativeBuildInputs = [ pkgconfig meson ninja ]
48 ++ optionals documentationSupport [ doxygen graphviz sphinx-build ]
49 ++ optionals testsSupport [ valgrind ];
50
51 buildInputs = [ libevdev mtdev libwacom (python3.withPackages (pkgs: with pkgs; [ evdev ])) ]
52 ++ optionals eventGUISupport [ cairo glib gtk3 ]
53 ++ optionals testsSupport [ check ];
54
55 propagatedBuildInputs = [ udev ];
56
57 patches = [ ./udev-absolute-path.patch ];
58
59 postPatch = ''
60 patchShebangs tools/helper-copy-and-exec-from-tmp.sh
61 patchShebangs test/symbols-leak-test
62 patchShebangs test/check-leftover-udev-rules.sh
63 '';
64
65 doCheck = testsSupport && stdenv.hostPlatform == stdenv.buildPlatform;
66
67 meta = {
68 description = "Handles input devices in Wayland compositors and provides a generic X.Org input driver";
69 homepage = http://www.freedesktop.org/wiki/Software/libinput;
70 license = licenses.mit;
71 platforms = platforms.unix;
72 maintainers = with maintainers; [ codyopel ];
73 };
74}