at 25.11-pre 154 lines 3.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitLab, 5 gitUpdater, 6 pkg-config, 7 meson, 8 ninja, 9 libevdev, 10 mtdev, 11 udev, 12 libwacom, 13 documentationSupport ? false, 14 doxygen, 15 graphviz, 16 runCommand, 17 eventGUISupport ? false, 18 cairo, 19 glib, 20 gtk3, 21 testsSupport ? false, 22 check, 23 valgrind, 24 python3, 25 nixosTests, 26 wayland-scanner, 27}: 28 29let 30 mkFlag = optSet: flag: "-D${flag}=${lib.boolToString optSet}"; 31 32 sphinx-build = 33 let 34 env = python3.withPackages ( 35 pp: with pp; [ 36 sphinx 37 recommonmark 38 sphinx-rtd-theme 39 ] 40 ); 41 in 42 # Expose only the sphinx-build binary to avoid contaminating 43 # everything with Sphinx’s Python environment. 44 runCommand "sphinx-build" { } '' 45 mkdir -p "$out/bin" 46 ln -s "${env}/bin/sphinx-build" "$out/bin" 47 ''; 48in 49 50stdenv.mkDerivation rec { 51 pname = "libinput"; 52 version = "1.27.1"; 53 54 outputs = [ 55 "bin" 56 "out" 57 "dev" 58 ]; 59 60 src = fetchFromGitLab { 61 domain = "gitlab.freedesktop.org"; 62 owner = "libinput"; 63 repo = "libinput"; 64 rev = version; 65 hash = "sha256-3U+2a/uSoSj1t34uz7xO2QQtJExygKOhBL7BUGP0Fbo="; 66 }; 67 68 patches = [ 69 ./udev-absolute-path.patch 70 ]; 71 72 nativeBuildInputs = 73 [ 74 pkg-config 75 meson 76 ninja 77 ] 78 ++ lib.optionals documentationSupport [ 79 doxygen 80 graphviz 81 sphinx-build 82 ]; 83 84 buildInputs = 85 [ 86 libevdev 87 mtdev 88 libwacom 89 (python3.withPackages ( 90 pp: with pp; [ 91 pp.libevdev # already in scope 92 pyudev 93 pyyaml 94 setuptools 95 ] 96 )) 97 ] 98 ++ lib.optionals eventGUISupport [ 99 # GUI event viewer 100 cairo 101 glib 102 gtk3 103 wayland-scanner 104 ]; 105 106 propagatedBuildInputs = [ 107 udev 108 ]; 109 110 nativeCheckInputs = [ 111 check 112 valgrind 113 ]; 114 115 mesonFlags = [ 116 (mkFlag documentationSupport "documentation") 117 (mkFlag eventGUISupport "debug-gui") 118 (mkFlag testsSupport "tests") 119 "--sysconfdir=/etc" 120 "--libexecdir=${placeholder "bin"}/libexec" 121 ]; 122 123 doCheck = testsSupport && stdenv.hostPlatform == stdenv.buildPlatform; 124 125 postPatch = '' 126 patchShebangs \ 127 test/symbols-leak-test \ 128 test/check-leftover-udev-rules.sh \ 129 test/helper-copy-and-exec-from-tmp.sh 130 131 # Don't create an empty directory under /etc. 132 sed -i "/install_emptydir(dir_etc \/ 'libinput')/d" meson.build 133 ''; 134 135 passthru = { 136 tests = { 137 libinput-module = nixosTests.libinput; 138 }; 139 updateScript = gitUpdater { 140 patchlevel-unstable = true; 141 }; 142 }; 143 144 meta = with lib; { 145 description = "Handles input devices in Wayland compositors and provides a generic X.Org input driver"; 146 mainProgram = "libinput"; 147 homepage = "https://www.freedesktop.org/wiki/Software/libinput/"; 148 license = licenses.mit; 149 platforms = platforms.linux; 150 maintainers = with maintainers; [ codyopel ]; 151 teams = [ teams.freedesktop ]; 152 changelog = "https://gitlab.freedesktop.org/libinput/libinput/-/releases/${version}"; 153 }; 154}