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