1 { lib, stdenv, fetchFromGitLab, pkg-config, 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
8 assert documentationSupport -> doxygen != null && graphviz != null && python3 != null;
9 assert eventGUISupport -> cairo != null && glib != null && gtk3 != null;
10 assert testsSupport -> check != null && valgrind != null && python3 != null;
13 mkFlag = optSet: flag: "-D${flag}=${lib.boolToString optSet}";
15 sphinx-build = if documentationSupport then
16 python3.pkgs.sphinx.overrideAttrs (super: {
17 propagatedBuildInputs = super.propagatedBuildInputs ++ (with python3.pkgs; [ recommonmark sphinx_rtd_theme ]);
19 postFixup = super.postFixup or "" + ''
20 # Do not propagate Python
21 rm $out/nix-support/propagated-build-inputs
28 stdenv.mkDerivation rec {
32 src = fetchFromGitLab {
33 domain = "gitlab.freedesktop.org";
37 sha256 = "1c81429kh9av9fanxmnjw5rvsjbzcyi7d0dx0gkyq5yysmpmrppi";
40 outputs = [ "bin" "out" "dev" ];
43 (mkFlag documentationSupport "documentation")
44 (mkFlag eventGUISupport "debug-gui")
45 (mkFlag testsSupport "tests")
47 "--libexecdir=${placeholder "bin"}/libexec"
50 nativeBuildInputs = [ pkg-config meson ninja ]
51 ++ optionals documentationSupport [ doxygen graphviz sphinx-build ];
57 (python3.withPackages (pp: with pp; [
58 pp.libevdev # already in scope
64 ++ optionals eventGUISupport [ cairo glib gtk3 ];
71 propagatedBuildInputs = [ udev ];
73 patches = [ ./udev-absolute-path.patch ];
76 patchShebangs tools/helper-copy-and-exec-from-tmp.sh
77 patchShebangs test/symbols-leak-test
78 patchShebangs test/check-leftover-udev-rules.sh
79 patchShebangs test/helper-copy-and-exec-from-tmp.sh
82 doCheck = testsSupport && stdenv.hostPlatform == stdenv.buildPlatform;
85 description = "Handles input devices in Wayland compositors and provides a generic X.Org input driver";
86 homepage = "https://www.freedesktop.org/wiki/Software/libinput/";
87 license = licenses.mit;
88 platforms = platforms.unix;
89 maintainers = with maintainers; [ codyopel ];