nixpkgs/pkgs/development/libraries/libinput/default.nix

92 lines
2.5 KiB
Nix
Raw Normal View History

2021-08-03 08:53:10 +00:00
{ lib, stdenv, fetchurl, pkg-config, meson, ninja
, libevdev, mtdev, udev, libwacom
2021-08-05 14:49:10 +00:00
, documentationSupport ? false, doxygen, graphviz # Documentation
, eventGUISupport ? false, cairo, glib, gtk3 # GUI event viewer support
, testsSupport ? false, check, valgrind, python3
2021-11-15 11:46:20 +00:00
, nixosTests
}:
2014-10-17 21:26:05 +00:00
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";
2021-09-21 14:35:22 +00:00
version = "1.19.1";
2021-08-03 08:53:10 +00:00
src = fetchurl {
url = "https://www.freedesktop.org/software/libinput/libinput-${version}.tar.xz";
2021-09-21 14:35:22 +00:00
sha256 = "sha256-C9z1sXg7c3hUt68coi32e8Nqb+fJz6cfAekUn5IgRG0=";
2014-10-17 21:26:05 +00:00
};
outputs = [ "bin" "out" "dev" ];
2016-04-25 11:51:41 +00:00
2017-09-18 10:34:10 +00:00
mesonFlags = [
(mkFlag documentationSupport "documentation")
2017-09-18 10:34:10 +00:00
(mkFlag eventGUISupport "debug-gui")
(mkFlag testsSupport "tests")
"--sysconfdir=/etc"
"--libexecdir=${placeholder "bin"}/libexec"
];
nativeBuildInputs = [ pkg-config meson ninja ]
2021-08-05 14:49:10 +00:00
++ lib.optionals documentationSupport [ doxygen graphviz sphinx-build ];
2014-10-17 21:26:05 +00:00
buildInputs = [
libevdev
mtdev
libwacom
(python3.withPackages (pp: with pp; [
pp.libevdev # already in scope
pyudev
pyyaml
setuptools
]))
2021-08-05 14:49:10 +00:00
] ++ lib.optionals eventGUISupport [ cairo glib gtk3 ];
checkInputs = [
check
valgrind
];
2017-09-18 10:34:10 +00:00
2016-04-08 20:11:46 +00:00
propagatedBuildInputs = [ udev ];
patches = [ ./udev-absolute-path.patch ];
postPatch = ''
2021-08-05 14:49:10 +00:00
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
2021-08-03 08:53:10 +00:00
# Don't create an empty /etc directory.
sed -i "/install_subdir('libinput', install_dir : dir_etc)/d" meson.build
'';
doCheck = testsSupport && stdenv.hostPlatform == stdenv.buildPlatform;
2021-11-15 11:46:20 +00:00
passthru.tests = {
libinput-module = nixosTests.libinput;
};
2021-08-05 14:49:10 +00:00
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 ];
2014-10-17 21:26:05 +00:00
};
}