From 8e67b23d40ba2f3fdbc068dbcff5f4742abad35b Mon Sep 17 00:00:00 2001 From: dvishal485 <26341736+dvishal485@users.noreply.github.com> Date: Sat, 9 Nov 2024 02:20:07 +0530 Subject: [PATCH] libfprint-focaltech-2808-a658: init at 1.94.4 Signed-off-by: dvishal485 <26341736+dvishal485@users.noreply.github.com> --- .../libfprint-focaltech-2808-a658/package.nix | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 pkgs/by-name/li/libfprint-focaltech-2808-a658/package.nix diff --git a/pkgs/by-name/li/libfprint-focaltech-2808-a658/package.nix b/pkgs/by-name/li/libfprint-focaltech-2808-a658/package.nix new file mode 100644 index 000000000000..41b7b3129ce3 --- /dev/null +++ b/pkgs/by-name/li/libfprint-focaltech-2808-a658/package.nix @@ -0,0 +1,104 @@ +{ + stdenv, + lib, + fetchurl, + rpm, + cpio, + glib, + gusb, + pixman, + libgudev, + nss, + libfprint, + cairo, + pkg-config, + autoPatchelfHook, + makePkgconfigItem, + copyPkgconfigItems, +}: + +# https://discourse.nixos.org/t/request-for-libfprint-port-for-2808-a658/55474 +let + # The provided `.so`'s name in the binary package we fetch and unpack + libso = "libfprint-2.so.2.0.0"; +in +stdenv.mkDerivation rec { + pname = "libfprint-focaltech-2808-a658"; + version = "1.94.4"; + # https://gitlab.freedesktop.org/libfprint/libfprint/-/merge_requests/413#note_2476573 + src = fetchurl { + url = "https://github.com/ftfpteams/RTS5811-FT9366-fingerprint-linux-driver-with-VID-2808-and-PID-a658/raw/b040ccd953c27e26c1285c456b4264e70b36bc3f/libfprint-2-2-${version}+tod1-FT9366_20240627.x86_64.rpm"; + hash = "sha256-MRWHwBievAfTfQqjs1WGKBnht9cIDj9aYiT3YJ0/CUM="; + }; + + nativeBuildInputs = [ + rpm + cpio + pkg-config + autoPatchelfHook + copyPkgconfigItems + ]; + + buildInputs = [ + stdenv.cc.cc + glib + gusb + pixman + nss + libgudev + libfprint + cairo + ]; + + unpackPhase = '' + runHook preUnpack + + rpm2cpio $src | cpio -idmv + + runHook postUnpack + ''; + + # custom pkg-config based on libfprint's pkg-config + pkgconfigItems = [ + (makePkgconfigItem rec { + name = "libfprint-2"; + inherit version; + inherit (meta) description; + cflags = [ "-I${variables.includedir}/libfprint-2" ]; + libs = [ + "-L${variables.libdir}" + "-lfprint-2" + ]; + variables = rec { + prefix = "${placeholder "out"}"; + includedir = "${prefix}/include"; + libdir = "${prefix}/lib"; + }; + }) + ]; + + installPhase = '' + runHook preInstall + + install -Dm444 usr/lib64/${libso} -t $out/lib + + # create this symlink as it was there in libfprint + ln -s -T $out/lib/${libso} $out/lib/libfprint-2.so + ln -s -T $out/lib/${libso} $out/lib/libfprint-2.so.2 + + # get files from libfprint required to build the package + cp -r ${libfprint}/lib/girepository-1.0 $out/lib + cp -r ${libfprint}/include $out + + runHook postInstall + ''; + + meta = { + description = "Focaltech Fingerprint driver for focaltech 0x2808:0xa658"; + homepage = "https://github.com/ftfpteams/RTS5811-FT9366-fingerprint-linux-driver-with-VID-2808-and-PID-a658"; + license = lib.licenses.unfree; + maintainers = [ lib.maintainers.imsick ]; + platforms = [ "x86_64-linux" ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +}