From 20415cbfe0bd44d668f0234eae890d4f7933d583 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Wed, 18 Feb 2026 14:54:56 -0500 Subject: [PATCH] libei: fix build on FreeBSD --- pkgs/by-name/li/libei/package.nix | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/li/libei/package.nix b/pkgs/by-name/li/libei/package.nix index 6a47e6bc0f54..93e90b41467c 100644 --- a/pkgs/by-name/li/libei/package.nix +++ b/pkgs/by-name/li/libei/package.nix @@ -3,6 +3,7 @@ stdenv, fetchFromGitHub, fetchFromGitLab, + fetchpatch, libevdev, libxkbcommon, meson, @@ -12,6 +13,9 @@ protobufc, systemd, buildPackages, + epoll-shim, + basu, + evdev-proto, }: let munit = fetchFromGitHub { @@ -33,12 +37,28 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-PqQpJz88tDzjwsBuwxpWcGAWz6Gp6A/oAOS87uxGOGs="; }; + 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 stdenv.hostPlatform.isLinux [ systemd + ] + ++ lib.optionals stdenv.hostPlatform.isFreeBSD [ + basu + epoll-shim + evdev-proto ]; nativeBuildInputs = [ meson @@ -56,6 +76,10 @@ stdenv.mkDerivation (finalAttrs: { )) ]; + mesonFlags = lib.optionals stdenv.hostPlatform.isFreeBSD [ + "-Dsd-bus-provider=basu" + ]; + postPatch = '' ln -s "${munit}" ./subprojects/munit patchShebangs ./proto/ei-scanner @@ -67,6 +91,6 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://gitlab.freedesktop.org/libinput/libei"; license = lib.licenses.mit; maintainers = [ lib.maintainers.pedrohlc ]; - platforms = lib.platforms.linux; + platforms = lib.platforms.linux ++ lib.platforms.freebsd; }; })