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