summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/li/libei/package.nix
blob: 24630a775a9ca74f8d5fa0f16ea7b48b3f866fcd (plain)
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
87
88
89
90
91
92
93
94
95
96
97
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchFromGitLab,
  fetchpatch,
  libevdev,
  libxkbcommon,
  meson,
  ninja,
  pkg-config,
  protobuf,
  protobufc,
  systemdSupport ? stdenv.hostPlatform.isLinux,
  systemdLibs,
  buildPackages,
  epoll-shim,
  basu,
  evdev-proto,
}:
let
  munit = fetchFromGitHub {
    owner = "nemequ";
    repo = "munit";
    rev = "fbbdf1467eb0d04a6ee465def2e529e4c87f2118";
    hash = "sha256-qm30C++rpLtxBhOABBzo+6WILSpKz2ibvUvoe8ku4ow=";
  };
in
stdenv.mkDerivation (finalAttrs: {
  pname = "libei";
  version = "1.6.0";

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "libinput";
    repo = "libei";
    rev = finalAttrs.version;
    hash = "sha256-fUeMdRK7uoRvgvY3INMorwnTleLrLA5xOeYBFp1qXeI=";
  };

  patches = lib.optionals stdenv.hostPlatform.isBSD [
    # From https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/357
    (fetchpatch {
      name = "peercred-bsd.patch";
      url = "https://gitlab.freedesktop.org/libinput/libei/-/commit/4f11112be0c0a89e8f078c0b4bcc103dbc6ac875.patch";
      hash = "sha256-Z6oZphzyfHMdAQninbUvEtxr738sx/SQV8o0fkF25iI=";
    })
  ];

  buildInputs = [
    libevdev
    libxkbcommon
    protobuf
    protobufc
  ]
  ++ lib.optionals systemdSupport [
    systemdLibs
  ]
  ++ lib.optionals stdenv.hostPlatform.isFreeBSD [
    basu
    epoll-shim
    evdev-proto
  ];
  nativeBuildInputs = [
    meson
    ninja
    pkg-config
    (buildPackages.python3.withPackages (
      ps: with ps; [
        attrs
        jinja2
        pytest
        python-dbusmock
        strenum
        structlog
      ]
    ))
  ];

  mesonFlags = lib.optionals stdenv.hostPlatform.isFreeBSD [
    "-Dsd-bus-provider=basu"
  ];

  postPatch = ''
    ln -s "${munit}" ./subprojects/munit
    patchShebangs ./proto/ei-scanner
  '';

  meta = {
    description = "Library for Emulated Input";
    mainProgram = "ei-debug-events";
    homepage = "https://gitlab.freedesktop.org/libinput/libei";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.pedrohlc ];
    platforms = lib.platforms.linux ++ lib.platforms.freebsd;
  };
})