Request for libfprint port for 2808:a658

Ah, I think I somewhat understand what you meant, there this file /lib/pkgconfig/libfprint-2.pc in libfprint derivation which had the following contents

$ cat /nix/store/48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6/lib/pkgconfig/libfprint-2.pc
prefix=/nix/store/48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6
includedir=/nix/store/48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6/include
libdir=${prefix}/lib

Name: libfprint-2
Description: Generic C API for fingerprint reader access
Version: 1.94.6
Requires: gio-unix-2.0 >= 2.56, gobject-2.0 >= 2.56
Libs: -L${libdir} -lfprint-2
Cflags: -I${includedir}/libfprint-2

Yes, the location is hardcoded in this, and copying it directly to my our derivation won’'t change it. I’ll test this out and let you know.
Let me know if that is what you were referring to.

Ah, I meant to look at the difference between those files. The unix CLI utility to do that is diff (I prefer diff -u) which is why that’s the colloquial term used to describe looking at the difference between two files.

Sorry to be unclear, I meant to ask which two files to diff. :sweat:

The respective pkg-config files. Upstream distributes one and apparently the fprintd drv can’t make use of it (that’s what the error message implies).

Okay, so I updated the install phase to correctly add pkg-config file, the custome derivation didn’t contain one. I ensured that the paths lead to the custom derivation and not libfprint (which was the case when I simply copied all the files from libfprint derivation.

This time the libfprint-2 not found error didn’t show up. Instead a python module error was there, which I solved by adding the lib/girepository-1.0 from libfprint derivation. Also lib/pkgconfig/libfprint-2.pc file mentioned the header libraries include/ so I directly copied that to the custom derivation (along with libexec because it looked important (update: error message is same without libexec)).

Running nixos-rebuild switch, this time python error was also absent, but it hit an error during later in fprintd derivation.

[108/109] Linking target src/fprintd
FAILED: src/fprintd 
gcc  -o src/fprintd src/fprintd.p/meson-generated_.._fprintd-enums.c.o src/fprintd.p/meson-generated_.._fprintd-dbus-interactive.c.o src/fprintd.p/file_storage.c.o src/fprintd.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group src/libfprintd-private.a /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libglib-2.0.so /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgio-2.0.so /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgobject-2.0.so -Wl,--export-dynamic /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgmodule-2.0.so -pthread -L/nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib -L/nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/include -lfprint-2 /nix/store/yv61rp99d3qzdlbx6x6z5n3ll7ksx744-polkit-124/lib/libpolkit-gobject-1.so -L/nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib -L/nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/include -lfprint-2 -Wl,--end-group
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_subclass@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_protocol@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_device_get_interfaces@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_number@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_device_get_release@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_class@LIBGUSB_0.1.0'
collect2: error: ld returned 1 exit status
[109/109] Linking target utils/fprintd-enroll
ninja: build stopped: subcommand failed.

which is mainly a bunch of reference errors to symbol g_usb_{some_variable_name}@LIBGUSB_0.1.0


Here is the diffoscope of the two derivations (libfprint and the custom one) generated with --exclude 'libfprint-2*' flag. This would exclude the .so library and some files in libexec. They are too verbose and I don’t believe are relevant. (diff file size is 3.3mb when zipped, 27mb unpacked)

Link to gist (due to message limit constraint):

The diff of pkg-config file.

--- 48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6/lib/pkgconfig/libfprint-2.pc	1970-01-01 05:30:01.000000000 +0530
+++ plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib/pkgconfig/libfprint-2.pc	1970-01-01 05:30:01.000000000 +0530
@@ -1,10 +1,11 @@
-prefix=/nix/store/48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6
-includedir=/nix/store/48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6/include
-libdir=${prefix}/lib
+prefix=/nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4
+includedir=/nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/include
+libdir=/nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/lib

 Name: libfprint-2
 Description: Generic C API for fingerprint reader access
 Version: 1.94.6
 Requires: gio-unix-2.0 >= 2.56, gobject-2.0 >= 2.56
-Libs: -L${libdir} -lfprint-2
-Cflags: -I${includedir}/libfprint-2
+Libs: -L/nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/include -lfprint-2
+Cflags: -I/nix/store/plrykn52156rg4aw7bx6vv8mp7rp1f0k-libfprint-ft9366-1.94.4/include/libfprint-2
+

Here is the current version of derivation:

{ stdenv, lib, fetchurl, dpkg, autoPatchelfHook, glib, gusb, pixman, libgudev, nss, tree, libfprint, cairo, pkg-config, coreutils }:

stdenv.mkDerivation rec {
  pname = "libfprint-ft9366";
  version = "1.94.4";

  src = fetchurl {
    url = "https://github.com/ftfpteams/RTS5811-FT9366-fingerprint-linux-driver-with-VID-2808-and-PID-a658/raw/b040ccd953c27e26c1285c456b4264e70b36bc3f/libfprint-2-2_1.94.4+tod1-0ubuntu1~22.04.2_amd64_rts5811.deb";
    hash = "sha256-vH1SbJ+/Uro7IQKM/SNUo44ySZqMwj+SgmmzOmwAgpw=";
  };

  nativeBuildInputs = [
    autoPatchelfHook
    dpkg
    pkg-config
  ];

  # LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;

  buildInputs = [
    stdenv.cc.cc
    glib
    gusb
    pixman
    nss
    libgudev
    libfprint
    cairo
  ];

  unpackPhase = ''
    dpkg-deb -x $src .
  '';

  installPhase = ''
    cp -r . $out/

    # move out to correct dir
    mv $out/usr/lib/x86_64-linux-gnu/libfprint-2.so.2.0.0 $out/lib
    mv $out/usr/lib/x86_64-linux-gnu/libfprint-2.so.2 $out/lib

    # create this symlink as it was there in libfprint
    ln -s -T $out/lib/libfprint-2.so.2.0.0 $out/lib/libfprint-2.so

    # this .so was not marked executable by default
    chmod +x $out/lib/libfprint-2.so.2.0.0

    mkdir $out/lib/pkgconfig
    echo -e "prefix=$out\nincludedir=$out/include\nlibdir=$out/lib\n\nName: libfprint-2\nDescription: Generic C API for fingerprint reader access\nVersion: 1.94.6\nRequires: gio-unix-2.0 >= 2.56, gobject-2.0 >= 2.56\nLibs: -L$out/include -lfprint-2 \nCflags: -I$out/include/libfprint-2\n" > $out/lib/pkgconfig/libfprint-2.pc

    # get files from libfprint required to build the package
    cp -r ${libfprint}/lib/girepository-1.0 $out/lib
    cp -r ${libfprint}/include $out
    cp -r ${libfprint}/libexec $out
  '';
}

Update: Same error even if I don’t copy libexec directory.

The -L needs to point at the libdir, not the includedir. Just make this the same as the original, it uses variables and will work.

That also explains your symptom: the linker can’t find the .so and therefore the symbols aren’t present.

Uh, sorry about that, I made a typo. What you said is logical and resonable, but unfortunately the error persists.

New diff:

--- 48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6/lib/pkgconfig/libfprint-2.pc	1970-01-01 05:30:01.000000000 +0530
+++ q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/pkgconfig/libfprint-2.pc	1970-01-01 05:30:01.000000000 +0530
@@ -1,10 +1,11 @@
-prefix=/nix/store/48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6
-includedir=/nix/store/48b5w5isr70y14vx38nmbpjfz8ww3i5c-libfprint-1.94.6/include
-libdir=${prefix}/lib
+prefix=/nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4
+includedir=/nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/include
+libdir=/nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib

 Name: libfprint-2
 Description: Generic C API for fingerprint reader access
 Version: 1.94.6
 Requires: gio-unix-2.0 >= 2.56, gobject-2.0 >= 2.56
-Libs: -L${libdir} -lfprint-2
-Cflags: -I${includedir}/libfprint-2
+Libs: -L/nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib -lfprint-2
+Cflags: -I/nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/include/libfprint-2
+

Here is the error log:

[109/109] Linking target src/fprintd
FAILED: src/fprintd 
gcc  -o src/fprintd src/fprintd.p/meson-generated_.._fprintd-enums.c.o src/fprintd.p/meson-generated_.._fprintd-dbus-interactive.c.o src/fprintd.p/file_storage.c.o src/fprintd.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group src/libfprintd-private.a /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libglib-2.0.so /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgio-2.0.so /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgobject-2.0.so -Wl,--export-dynamic /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgmodule-2.0.so -pthread /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so /nix/store/yv61rp99d3qzdlbx6x6z5n3ll7ksx744-polkit-124/lib/libpolkit-gobject-1.so -Wl,--end-group
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_subclass@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_protocol@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_device_get_interfaces@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_number@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_device_get_release@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_class@LIBGUSB_0.1.0'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Full logs
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/xg9nw7ic88c7dnbwfx2avd38yjc7fcf7-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
applying patch /nix/store/hszpvhcafv7wx31z160vjw6k8h3w3pq9-ae04fa989720279e5558c3b8ff9ebe1959b1cf36.patch
patching file tests/pam/test_pam_fprintd.py
patching file tests/test_fprintd_utils.py
patching script interpreter paths in po/check-translations.sh tests/unittest_inspector.py
po/check-translations.sh: interpreter directive changed from "#!/bin/bash" to "/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash"
tests/unittest_inspector.py: interpreter directive changed from "#! /usr/bin/env python3" to "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3"
substituteStream() in derivation fprintd-1.94.2: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. (file 'tests/fprintd.py')
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
mesonConfigurePhase flags: --prefix=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2 --libdir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib --libexecdir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/libexec --bindir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/bin --sbindir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/sbin --includedir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/include --mandir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/man --infodir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/info --localedir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/locale -Dauto_features=enabled -Dwrap_mode=nodownload --buildtype=plain -Dgtk_doc=true -Dpam_modules_dir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib/security -Dsysconfdir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/etc -Ddbus_service_dir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/dbus-1/system-services -Dsystemd_system_unit_dir=/nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib/systemd/system
e[1mThe Meson build systeme[0m
Version: 1.4.2
Source dir: e[1m/build/sourcee[0m
Build dir: e[1m/build/source/builde[0m
Build type: e[1mnative builde[0m
Project name: e[1mfprintde[0m
Project version: e[1m1.94.2e[0m
C compiler for the host machine: e[1mgcce[0m (gcc 13.2.0 "gcc (GCC) 13.2.0")
C linker for the host machine: e[1mgcce[0m ld.bfd 2.41
Host machine cpu family: e[1mx86_64e[0m
Host machine cpu: e[1mx86_64e[0m
Compiler for C supports arguments -fno-strict-aliasing: e[1;32mYESe[0m 
Compiler for C supports arguments -Wcast-align: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=address: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=array-bounds: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=empty-body: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=implicit: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=init-self: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=int-to-pointer-cast: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=main: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=missing-braces: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=nonnull: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=pointer-to-int-cast: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=redundant-decls: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=return-type: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=sequence-point: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=trigraphs: e[1;32mYESe[0m 
Compiler for C supports arguments -Werror=write-strings: e[1;32mYESe[0m 
Compiler for C supports arguments -Wformat-nonliteral: e[1;32mYESe[0m 
Compiler for C supports arguments -Wformat-security: e[1;32mYESe[0m 
Compiler for C supports arguments -Wformat=2: e[1;32mYESe[0m 
Compiler for C supports arguments -Wignored-qualifiers: e[1;32mYESe[0m 
Compiler for C supports arguments -Wimplicit-function-declaration: e[1;32mYESe[0m 
Compiler for C supports arguments -Wlogical-op: e[1;32mYESe[0m 
Compiler for C supports arguments -Wmissing-declarations: e[1;32mYESe[0m 
Compiler for C supports arguments -Wmissing-format-attribute: e[1;32mYESe[0m 
Compiler for C supports arguments -Wmissing-include-dirs: e[1;32mYESe[0m 
Compiler for C supports arguments -Wmissing-noreturn: e[1;32mYESe[0m 
Compiler for C supports arguments -Wmissing-prototypes: e[1;32mYESe[0m 
Compiler for C supports arguments -Wnested-externs: e[1;32mYESe[0m 
Compiler for C supports arguments -Wold-style-definition: e[1;32mYESe[0m 
Compiler for C supports arguments -Wpointer-arith: e[1;32mYESe[0m 
Compiler for C supports arguments -Wshadow: e[1;32mYESe[0m 
Compiler for C supports arguments -Wstrict-prototypes: e[1;32mYESe[0m 
Compiler for C supports arguments -Wtype-limits: e[1;32mYESe[0m 
Compiler for C supports arguments -Wundef: e[1;32mYESe[0m 
Compiler for C supports arguments -Wunused: e[1;32mYESe[0m 
Compiler for C supports arguments -Wno-unused-parameter: e[1;32mYESe[0m 
Compiler for C supports arguments -Wno-pedantic: e[1;32mYESe[0m 
Compiler for C supports arguments -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56: e[1;32mYESe[0m 
Compiler for C supports arguments -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_56: e[1;32mYESe[0m 
Found pkg-config: e[1;32mYESe[0m e[1m(/nix/store/4lssw6pk59r654j0yrfydv0kngk8zrqp-pkg-config-wrapper-0.29.2/bin/pkg-config)e[0m e[1;34m0.29.2e[0m
Run-time dependency e[1mglib-2.0e[0m found: e[1;32mYESe[0m e[36m2.80.2e[0m
Run-time dependency e[1mgio-2.0e[0m found: e[1;32mYESe[0m e[36m2.80.2e[0m
Run-time dependency e[1mgio-unix-2.0e[0m found: e[1;32mYESe[0m e[36m2.80.2e[0m
Run-time dependency e[1mgmodule-2.0e[0m found: e[1;32mYESe[0m e[36m2.80.2e[0m
Run-time dependency e[1mlibfprint-2e[0m found: e[1;32mYESe[0m e[36m1.94.6e[0m
Run-time dependency e[1mpolkit-gobject-1e[0m found: e[1;32mYESe[0m e[36m124e[0m
Run-time dependency e[1mdbus-1e[0m found: e[1;32mYESe[0m e[36m1.14.10e[0m
Run-time dependency e[1mlibsystemde[0m found: e[1;32mYESe[0m e[36m255e[0m
Has header "e[1msecurity/pam_modules.he[0m" : e[1;32mYESe[0m 
Library e[1mpame[0m found: e[1;32mYESe[0m
Program e[1mpod2mane[0m found: e[1;32mYESe[0m (/nix/store/5ydyzdwlar4ssmhfjg154dy2s2bbyhj3-perl-5.38.2/bin/pod2man)
Program e[1mxsltproce[0m found: e[1;32mYESe[0m (/nix/store/jb02zq14sa5fn52xcb82fhpwpnrv59rh-libxslt-1.1.39-bin/bin/xsltproc)
Run-time dependency e[1msystemde[0m found: e[1;32mYESe[0m e[36m255e[0m
Run-time dependency e[1mpam_wrappere[0m found: e[1;32mYESe[0m e[36m1.1.3e[0m
Program e[1mxmllinte[0m found: e[1;31mNOe[0m
Program e[1mpython3e[0m found: e[1;32mYESe[0m (/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/bin/python3)
e[1;33mWARNING:e[0m You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.
         See also: https://github.com/mesonbuild/meson/issues/9300
Configuring e[1mconfig.he[0m using configuration
Program e[1mbashe[0m found: e[1;32mYESe[0m (/nix/store/516kai7nl5dxr792c0nzq0jp8m4zvxpi-bash-5.2p32/bin/bash)
Dependency e[1mgio-2.0e[0m found: e[1;32mYESe[0m e[36m2.80.2e[0m e[1;34m(cached)e[0m
Program e[1m/nix/store/f8y44c3k32piprp8wj999cdlakpz86kz-glib-2.80.2-dev/bin/gdbus-codegene[0m found: e[1;32mYESe[0m (/nix/store/f8y44c3k32piprp8wj999cdlakpz86kz-glib-2.80.2-dev/bin/gdbus-codegen)
Program e[1mpatche[0m found: e[1;32mYESe[0m (/nix/store/cjjaglbcsg30bc7rf6xajpp73fkna2mk-patch-2.7.6/bin/patch)
Dependency e[1mglib-2.0e[0m found: e[1;32mYESe[0m e[36m2.80.2e[0m e[1;34m(cached)e[0m
Program e[1m/nix/store/f8y44c3k32piprp8wj999cdlakpz86kz-glib-2.80.2-dev/bin/glib-mkenumse[0m found: e[1;32mYESe[0m (/nix/store/f8y44c3k32piprp8wj999cdlakpz86kz-glib-2.80.2-dev/bin/glib-mkenums)
Dependency e[1mglib-2.0e[0m found: e[1;32mYESe[0m e[36m2.80.2e[0m e[1;34m(cached)e[0m
Program e[1m/nix/store/f8y44c3k32piprp8wj999cdlakpz86kz-glib-2.80.2-dev/bin/glib-mkenumse[0m found: e[1;32mYESe[0m (/nix/store/f8y44c3k32piprp8wj999cdlakpz86kz-glib-2.80.2-dev/bin/glib-mkenums)
Configuring e[1mnet.reactivated.Fprint.servicee[0m using configuration
Configuring e[1mfprintd.servicee[0m using configuration
Program e[1mmsgfmte[0m found: e[1;32mYESe[0m (/nix/store/zz3kckpl8ag09cr4qrlwi2q691ckqvgj-gettext-0.21.1/bin/msgfmt)
pam/meson.build:24: e[1;31mDEPRECATION:e[0m Project uses feature that was always broken, and is now deprecated since '1.3.0': str.format: Value other than strings, integers, bools, options, dictionaries and lists thereof..
Configuring e[1mversion.xmle[0m using configuration
Program e[1mgtkdoc-scane[0m found: e[1;32mYESe[0m (/nix/store/xgnn2g97kx2hynl1l7j9aspcjia6afcm-gtk-doc-1.34.0/bin/gtkdoc-scan)
Program e[1mgtkdoc-scangobje[0m found: e[1;32mYESe[0m (/nix/store/xgnn2g97kx2hynl1l7j9aspcjia6afcm-gtk-doc-1.34.0/bin/gtkdoc-scangobj)
Program e[1mgtkdoc-mkdbe[0m found: e[1;32mYESe[0m (/nix/store/xgnn2g97kx2hynl1l7j9aspcjia6afcm-gtk-doc-1.34.0/bin/gtkdoc-mkdb)
Program e[1mgtkdoc-mkhtmle[0m found: e[1;32mYESe[0m (/nix/store/xgnn2g97kx2hynl1l7j9aspcjia6afcm-gtk-doc-1.34.0/bin/gtkdoc-mkhtml)
Program e[1mgtkdoc-fixxrefe[0m found: e[1;32mYESe[0m (/nix/store/xgnn2g97kx2hynl1l7j9aspcjia6afcm-gtk-doc-1.34.0/bin/gtkdoc-fixxref)
Configuring e[1mfprintd-pam-teste[0m using configuration
e[1mMessage:e[0m Found library pam_wrapper as /nix/store/krs8ai3q6ki5jp69w6anz49f0l4hppvx-libpam-wrapper-1.1.3/lib/libpam_wrapper.so
tests/pam/meson.build:30: e[1;31mDEPRECATION:e[0m Project uses feature that was always broken, and is now deprecated since '1.3.0': str.format: Value other than strings, integers, bools, options, dictionaries and lists thereof..
Program e[1munittest_inspector.pye[0m found: e[1;32mYESe[0m (/build/source/tests/unittest_inspector.py)
Program e[1mvalgrinde[0m found: e[1;31mNOe[0m
Program e[1mmsginite[0m found: e[1;32mYESe[0m (/nix/store/zz3kckpl8ag09cr4qrlwi2q691ckqvgj-gettext-0.21.1/bin/msginit)
Program e[1mmsgmergee[0m found: e[1;32mYESe[0m (/nix/store/zz3kckpl8ag09cr4qrlwi2q691ckqvgj-gettext-0.21.1/bin/msgmerge)
Program e[1mxgettexte[0m found: e[1;32mYESe[0m (/nix/store/zz3kckpl8ag09cr4qrlwi2q691ckqvgj-gettext-0.21.1/bin/xgettext)
Program e[1mcheck-translations.she[0m found: e[1;32mYESe[0m (/build/source/po/check-translations.sh)
e[1mMessage:e[0m 
System paths:
  prefix: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2
  fprintd daemon directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/libexec
  fprintd modules directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib/fprintd/modules
  fprintd prints storage directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/var/lib/fprint
  DBus configuration directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/dbus-1/system.d
  DBus service directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/dbus-1/system-services
  DBus interfaces directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/dbus-1/interfaces
  Polkit policy directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/polkit-1/actions
  Systemd service directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib/systemd/system
  PAM module directory: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib/security

Optional features:

  PAM module: true
  Manuals: true
  GTK Doc: true
  XML Linter false

Test setup:

  With address sanitizer: false

Build targets in project: e[1m97e[0m
e[1mNOTICE:e[0m Future-deprecated features used:
 * 0.56.0: {'dependency.get_pkgconfig_variable', 'meson.build_root', 'meson.source_root'}
e[1;33mWARNING:e[0m Broken features used:
 * 1.3.0: {'str.format: Value other than strings, integers, bools, options, dictionaries and lists thereof.'}

fprintd e[36m1.94.2e[0m

  e[1mUser defined optionse[0m
    auto_features          : enabled
    bindir                 : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/bin
    buildtype              : plain
    includedir             : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/include
    infodir                : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/info
    libdir                 : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib
    libexecdir             : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/libexec
    localedir              : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/locale
    mandir                 : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/man
    prefix                 : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2
    sbindir                : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/sbin
    sysconfdir             : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/etc
    wrap_mode              : nodownload
    dbus_service_dir       : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/share/dbus-1/system-services
    gtk_doc                : true
    pam_modules_dir        : /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib/security
    systemd_system_unit_dir: /nix/store/vny62l4vb85im29nxv7zkaz17iiybs0x-fprintd-1.94.2/lib/systemd/system

Found ninja-1.11.1 at /nix/store/j8ly6xc733w2wz98mz9avhy2bmibbcg9-ninja-1.11.1/bin/ninja
mesonConfigurePhase: enabled\ parallel\ building
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
build flags: -j16
[1/109] Building translation po/af/LC_MESSAGES/fprintd-af.mo
[2/109] Building translation po/ar/LC_MESSAGES/fprintd-ar.mo
[3/109] Building translation po/as/LC_MESSAGES/fprintd-as.mo
[4/109] Building translation po/ast/LC_MESSAGES/fprintd-ast.mo
[5/109] Building translation po/az/LC_MESSAGES/fprintd-az.mo
[6/109] Building translation po/be/LC_MESSAGES/fprintd-be.mo
[7/109] Building translation po/bg/LC_MESSAGES/fprintd-bg.mo
[8/109] Building translation po/bn_IN/LC_MESSAGES/fprintd-bn_IN.mo
[9/109] Building translation po/ca/LC_MESSAGES/fprintd-ca.mo
[10/109] Building translation po/ca@valencia/LC_MESSAGES/fprintd-ca@valencia.mo
[11/109] Building translation po/cs/LC_MESSAGES/fprintd-cs.mo
[12/109] Building translation po/cy/LC_MESSAGES/fprintd-cy.mo
[13/109] Building translation po/da/LC_MESSAGES/fprintd-da.mo
[14/109] Building translation po/de/LC_MESSAGES/fprintd-de.mo
[15/109] Building translation po/en_GB/LC_MESSAGES/fprintd-en_GB.mo
[16/109] Building translation po/el/LC_MESSAGES/fprintd-el.mo
[17/109] Building translation po/eo/LC_MESSAGES/fprintd-eo.mo
[18/109] Building translation po/es/LC_MESSAGES/fprintd-es.mo
[19/109] Building translation po/et/LC_MESSAGES/fprintd-et.mo
[20/109] Building translation po/eu/LC_MESSAGES/fprintd-eu.mo
[21/109] Building translation po/fa/LC_MESSAGES/fprintd-fa.mo
[22/109] Building translation po/fi/LC_MESSAGES/fprintd-fi.mo
[23/109] Building translation po/fo/LC_MESSAGES/fprintd-fo.mo
[24/109] Building translation po/fr/LC_MESSAGES/fprintd-fr.mo
[25/109] Building translation po/ga/LC_MESSAGES/fprintd-ga.mo
[26/109] Building translation po/fur/LC_MESSAGES/fprintd-fur.mo
[27/109] Building translation po/gl/LC_MESSAGES/fprintd-gl.mo
[28/109] Building translation po/gu/LC_MESSAGES/fprintd-gu.mo
[29/109] Building translation po/he/LC_MESSAGES/fprintd-he.mo
[30/109] Building translation po/hi/LC_MESSAGES/fprintd-hi.mo
[31/109] Building translation po/hr/LC_MESSAGES/fprintd-hr.mo
[32/109] Building translation po/hu/LC_MESSAGES/fprintd-hu.mo
[33/109] Building translation po/ia/LC_MESSAGES/fprintd-ia.mo
[34/109] Building translation po/id/LC_MESSAGES/fprintd-id.mo
[35/109] Building translation po/it/LC_MESSAGES/fprintd-it.mo
[36/109] Building translation po/ja/LC_MESSAGES/fprintd-ja.mo
[37/109] Building translation po/ka/LC_MESSAGES/fprintd-ka.mo
[38/109] Building translation po/kk/LC_MESSAGES/fprintd-kk.mo
[39/109] Building translation po/kn/LC_MESSAGES/fprintd-kn.mo
[40/109] Building translation po/ko/LC_MESSAGES/fprintd-ko.mo
[41/109] Building translation po/ky/LC_MESSAGES/fprintd-ky.mo
[42/109] Building translation po/lt/LC_MESSAGES/fprintd-lt.mo
[43/109] Building translation po/lv/LC_MESSAGES/fprintd-lv.mo
[44/109] Building translation po/ml/LC_MESSAGES/fprintd-ml.mo
[45/109] Building translation po/mr/LC_MESSAGES/fprintd-mr.mo
[46/109] Building translation po/ms/LC_MESSAGES/fprintd-ms.mo
[47/109] Building translation po/nb/LC_MESSAGES/fprintd-nb.mo
[48/109] Building translation po/nl/LC_MESSAGES/fprintd-nl.mo
[49/109] Building translation po/nn/LC_MESSAGES/fprintd-nn.mo
[50/109] Building translation po/oc/LC_MESSAGES/fprintd-oc.mo
[51/109] Building translation po/or/LC_MESSAGES/fprintd-or.mo
[52/109] Building translation po/pa/LC_MESSAGES/fprintd-pa.mo
[53/109] Building translation po/pl/LC_MESSAGES/fprintd-pl.mo
[54/109] Building translation po/pt/LC_MESSAGES/fprintd-pt.mo
[55/109] Building translation po/pt_BR/LC_MESSAGES/fprintd-pt_BR.mo
[56/109] Building translation po/ro/LC_MESSAGES/fprintd-ro.mo
[57/109] Building translation po/ru/LC_MESSAGES/fprintd-ru.mo
[58/109] Building translation po/sk/LC_MESSAGES/fprintd-sk.mo
[59/109] Building translation po/sl/LC_MESSAGES/fprintd-sl.mo
[60/109] Building translation po/sq/LC_MESSAGES/fprintd-sq.mo
[61/109] Building translation po/sr/LC_MESSAGES/fprintd-sr.mo
[62/109] Building translation po/sr@latin/LC_MESSAGES/fprintd-sr@latin.mo
[63/109] Building translation po/sv/LC_MESSAGES/fprintd-sv.mo
[64/109] Building translation po/ta/LC_MESSAGES/fprintd-ta.mo
[65/109] Building translation po/te/LC_MESSAGES/fprintd-te.mo
[66/109] Building translation po/th/LC_MESSAGES/fprintd-th.mo
[67/109] Building translation po/tr/LC_MESSAGES/fprintd-tr.mo
[68/109] Building translation po/uk/LC_MESSAGES/fprintd-uk.mo
[69/109] Building translation po/vi/LC_MESSAGES/fprintd-vi.mo
[70/109] Building translation po/wa/LC_MESSAGES/fprintd-wa.mo
[71/109] Building translation po/zh_HK/LC_MESSAGES/fprintd-zh_HK.mo
[72/109] Building translation po/zh_CN/LC_MESSAGES/fprintd-zh_CN.mo
[73/109] Building translation po/zh_TW/LC_MESSAGES/fprintd-zh_TW.mo
[74/109] Generating data/man_pam_fprintd.8 with a custom command
[75/109] Generating doc/dbus/docbook_xml_header with a custom command (wrapped by meson because command contains newlines, to capture output)
[76/109] Generating data/man_fprintd.1 with a custom command
[77/109] Generating gdbus header src/fprintd-dbus.h
[78/109] Generating gdbus source src/fprintd-dbus.c
[79/109] Generating src/fprintd-dbus-interactive with a custom command
patching file src/fprintd-dbus-interactive.c (read from src/fprintd-dbus.c)
[80/109] Merging translations for data/net.reactivated.fprint.device.policy
[81/109] Generating GObject enum file src/fprintd-enums.h (wrapped by meson because command contains newlines, to capture output)
[82/109] Generating GObject enum file src/fprintd-enums.c (wrapped by meson because command contains newlines, to capture output)
[83/109] Generating doc/dbus/net.reactivated.Fprint.Manager_ref with a custom command (wrapped by meson to capture output)
[84/109] Generating doc/dbus/net.reactivated.Fprint.Device_ref with a custom command (wrapped by meson to capture output)
[85/109] Compiling C object pam/pam_fprintd.so.p/pam_fprintd.c.o
[86/109] Compiling C object src/libfprintd-private.a.p/meson-generated_.._fprintd-enums.c.o
[87/109] Compiling C object utils/fprintd-list.p/list.c.o
[88/109] Compiling C object utils/fprintd-verify.p/verify.c.o
[89/109] Compiling C object utils/fprintd-delete.p/delete.c.o
[90/109] Compiling C object utils/fprintd-enroll.p/enroll.c.o
[91/109] Compiling C object src/fprintd.p/meson-generated_.._fprintd-enums.c.o
[92/109] Linking target pam/pam_fprintd.so
[93/109] Generating tests/pam/services/pam_test_service_file with a custom command
[94/109] Compiling C object src/fprintd.p/file_storage.c.o
[95/109] Compiling C object src/libfprintd-private.a.p/manager.c.o
[96/109] Compiling C object src/fprintd.p/main.c.o
[97/109] Compiling C object src/libfprintd-private.a.p/device.c.o
[98/109] Compiling C object utils/fprintd-verify.p/meson-generated_.._.._src_fprintd-dbus-interactive.c.o
[99/109] Compiling C object utils/fprintd-delete.p/meson-generated_.._.._src_fprintd-dbus-interactive.c.o
[100/109] Compiling C object utils/fprintd-enroll.p/meson-generated_.._.._src_fprintd-dbus-interactive.c.o
[101/109] Compiling C object src/libfprintd-private.a.p/meson-generated_.._fprintd-dbus-interactive.c.o
[102/109] Linking static target src/libfprintd-private.a
[103/109] Compiling C object utils/fprintd-list.p/meson-generated_.._.._src_fprintd-dbus-interactive.c.o
[104/109] Compiling C object src/fprintd.p/meson-generated_.._fprintd-dbus-interactive.c.o
[105/109] Linking target utils/fprintd-enroll
[106/109] Linking target utils/fprintd-verify
[107/109] Linking target utils/fprintd-delete
[108/109] Linking target utils/fprintd-list
[109/109] Linking target src/fprintd
FAILED: src/fprintd 
gcc  -o src/fprintd src/fprintd.p/meson-generated_.._fprintd-enums.c.o src/fprintd.p/meson-generated_.._fprintd-dbus-interactive.c.o src/fprintd.p/file_storage.c.o src/fprintd.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group src/libfprintd-private.a /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libglib-2.0.so /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgio-2.0.so /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgobject-2.0.so -Wl,--export-dynamic /nix/store/sr6skahp2mvi6y8d4g89a9vwk4yh4z0p-glib-2.80.2/lib/libgmodule-2.0.so -pthread /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so /nix/store/yv61rp99d3qzdlbx6x6z5n3ll7ksx744-polkit-124/lib/libpolkit-gobject-1.so -Wl,--end-group
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_subclass@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_protocol@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_device_get_interfaces@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_number@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_device_get_release@LIBGUSB_0.1.0'
/nix/store/q3sm4x963a996qc3d6baw54609ryifak-binutils-2.41/bin/ld: /nix/store/q528qpiby9fxlzf0f2y21885fsmdgyc8-libfprint-ft9366-1.94.4/lib/libfprint-2.so: undefined reference to `g_usb_interface_get_class@LIBGUSB_0.1.0'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

This is slightly tangential to what we have discussed till now.

I noticed the word ā€œtodā€ on the github repo of debian file from which I’m building. Which made me think maybe I should refer other tod libfprint derivations. I referred to libfprint-2-tod1-elan

I went to its build source and got to know it is working just by copying a bare OEM .so shared object library file into its derivation (library file is already downloaded and unpacked from zip after fetch). And as per nix docs, all they need to do is in their configuration.nix file. NixOS Search

https://wiki.nixos.org/wiki/Fingerprint_scanner

# Start the driver at boot
systemd.services.fprintd = {
  wantedBy = [ "multi-user.target" ];
  serviceConfig.Type = "simple";
};

{
  # Install the driver
  services.fprintd.enable = true;
  # If simply enabling fprintd is not enough, try enabling fprintd.tod...
  services.fprintd.tod.enable = true;
  # ...and use one of the next four drivers
  services.fprintd.tod.driver = pkgs.libfprint-2-tod1-elan;
}

I tried to implement this as well. Here is my attempt

fp.nix

{ stdenv, lib, fetchurl, dpkg, glib, gusb, pixman, libgudev, nss, libfprint, cairo, pkg-config, libfprint-tod, autoPatchelfHook, openssl }:

stdenv.mkDerivation rec {
  pname = "libfprint-2-tod1-focaltech";
  version = "0.0.1";

  src = fetchurl {
    url = "https://github.com/ftfpteams/RTS5811-FT9366-fingerprint-linux-driver-with-VID-2808-and-PID-a658/raw/b040ccd953c27e26c1285c456b4264e70b36bc3f/libfprint-2-2_1.94.4+tod1-0ubuntu1~22.04.2_amd64_rts5811.deb";
    hash = "sha256-vH1SbJ+/Uro7IQKM/SNUo44ySZqMwj+SgmmzOmwAgpw=";
  };

  nativeBuildInputs = [
    dpkg
    pkg-config
    autoPatchelfHook
  ];

  buildInputs = [
    openssl
    stdenv.cc.cc
    glib
    gusb
    pixman
    nss
    libgudev
    libfprint
    cairo
  ];

  unpackPhase = ''
    dpkg-deb -x $src .
  '';

  installPhase = ''
    runHook preInstall
    install -Dm444 usr/lib/x86_64-linux-gnu/libfprint-2.so.2.0.0 -t $out/lib/libfprint-2/tod-1/
    runHook postInstall
  '';

  passthru.driverPath = "/lib/libfprint-2/tod-1/";
}

configuration.nix

{
  nixpkgs.overlays = [
    (self: super: {
      libfprint-2-tod1-focaltech = super.callPackage ./fp.nix {};
    })
  ];

  systemd.services.fprintd = {
    wantedBy = [ "multi-user.target" ];
    serviceConfig.Type = "simple";
  };

  services.fprintd = {
    enable = true;
    tod = {
      enable = true;
      driver = pkgs.libfprint-2-tod1-focaltech;
    };
  };
}

This builds just fine but doesn’t work.

$ sudo fprintd-enroll 
Impossible to enroll: GDBus.Error:net.reactivated.Fprint.Error.NoSuchDevice: No devices available

It feels like I’ve done something wrong in my life.

Update: Okay, that’s on the library, after inspecting journalctl -e | rg fprint here is what I found.

The error is libfprint-2-tod1-focaltech.so doesn't expose the required entry point symbol

nix-config on ī‚  main [$!?]
āÆ journalctl -e | rg fprint
Nov 07 20:06:05 seattle systemd[1]: fprintd.service: Deactivated successfully.

nix-config on ī‚  main [$!?]
āÆ sudo fprintd-enroll
[sudo] password for seattle:
Impossible to enroll: GDBus.Error:net.reactivated.Fprint.Error.NoSuchDevice: No devices available

nix-config on ī‚  main [$!?] took 2s
āÆ journalctl -e | rg fprint
Nov 07 20:06:05 seattle systemd[1]: fprintd.service: Deactivated successfully.
Nov 07 20:06:50 seattle dbus-daemon[1458]: [system] Activating via systemd: service name='net.reactivated.Fprint' unit='fprintd.service' requested by ':1.61' (uid=1000 pid=3135 comm="/run/current-system/sw/bin/systemsettings" label="kernel")
Nov 07 20:06:50 seattle fprintd[3258]: Library /nix/store/s0xznywyzrwyc9r9rmazh48cvaiigbbj-libfprint-2-tod1-focaltech-0.0.1/lib/libfprint-2/tod-1/libfprint-2-tod1-focaltech.so doesn't expose the required entry point symbol
Nov 07 20:06:59 seattle sudo[3290]:  seattle : TTY=pts/0 ; PWD=/home/seattle/nix-config ; USER=root ; COMMAND=/run/current-system/sw/bin/fprintd-enroll

tldr (of whole discourse): I’m too dumb. Sorry for so much trouble. Thank you for all the help. Here is the derivation which should work.

Apparently the derivation obtained at Request for libfprint port for 2808:a658 - #28 by imsick was totally fine. I didn’t notice the amd64 in downloaded debian file name, and worked under assumption that it is for my system. I updated the download link and hash to that of rpm file in the given download git repo, and now fingerprint sensor work as expected! :tada:

fp.nix

{ stdenv, lib, fetchurl, rpm, cpio, glib, gusb, pixman, libgudev, nss, libfprint, cairo, pkg-config, autoPatchelfHook }:

stdenv.mkDerivation rec {
  pname = "libfprint-focaltech-2808-a658";
  libso = "libfprint-2.so.2.0.0";
  version = "0.0.1";

  src = fetchurl {
    url = "https://github.com/ftfpteams/RTS5811-FT9366-fingerprint-linux-driver-with-VID-2808-and-PID-a658/raw/refs/heads/main/libfprint-2-2-1.94.4+tod1-FT9366_20240627.x86_64.rpm";
    hash = "sha256-MRWHwBievAfTfQqjs1WGKBnht9cIDj9aYiT3YJ0/CUM=";
  };

  nativeBuildInputs = [
    rpm cpio
    pkg-config
    autoPatchelfHook
  ];

  buildInputs = [
    stdenv.cc.cc
    glib
    gusb
    pixman
    nss
    libgudev
    libfprint
    cairo
  ];

  unpackPhase = ''
    rpm2cpio $src | cpio -idmv
  '';

  installPhase = ''
    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

    mkdir $out/lib/pkgconfig
    echo -e "prefix=$out\nincludedir=$out/include\nlibdir=$out/lib\n\nName: libfprint-2\nDescription: Generic C API for fingerprint reader access\nVersion: 1.94.6\nRequires: gio-unix-2.0 >= 2.56, gobject-2.0 >= 2.56\nLibs: -L$out/lib -lfprint-2 \nCflags: -I$out/include/libfprint-2\n" > $out/lib/pkgconfig/libfprint-2.pc

    # get files from libfprint required to build the package
    cp -r ${libfprint}/lib/girepository-1.0 $out/lib
    cp -r ${libfprint}/include $out
  '';
}

configuration.nix

{
  nixpkgs.overlays = [
    (self: super: {
      libfprint-focaltech = super.callPackage ./fp.nix {};
    })
  ];

  services.fprintd = {
    enable = true;
    # Replace the default libfprint package with our custom one
    package = pkgs.fprintd.override { libfprint = pkgs.libfprint-focaltech; };
  };
  services.udev.packages = [ pkgs.libfprint-focaltech ];
}

I tried the tod method, but that didn’t work. But okay, I find this message to be much more cleaner and better, and everything is good when it works.

Thank you!

Update:
I created a nixpkgs pull request for this to be included. libfprint-focaltech-2808-a658: init at 1.94.4 by dvishal485 Ā· Pull Request #354311 Ā· NixOS/nixpkgs Ā· GitHub
This will also close my previous github issue for package request.

2 Likes

I am 7 months too late to discover this…

@imsick I tried the derivation from nixpkgs on my Vivobook

services.fprintd = {
    enable = true;
    package = pkgs.fprintd.override {
        libfprint = pkgs.libfprint-focaltech-2808-a658;
    };
};

services.udev.packages = [pkgs.libfprint-focaltech-2808-a658];

got the following error:

Compiler for C supports arguments -Wtype-limits: YES 
Compiler for C supports arguments -Wundef: YES 
Compiler for C supports arguments -Wunused: YES 
Compiler for C supports arguments -Wno-unused-parameter: YES 
Compiler for C supports arguments -Wno-pedantic: YES 
Compiler for C supports arguments -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_64: YES 
Compiler for C supports arguments -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_64: YES 
Found pkg-config: YES (/nix/store/2crk9xnq5x9v7yf0r2nwkgj8qsmxr4ly-pkg-config-wrapper-0.29.2/bin/pkg-config) 0.29.2
Run-time dependency glib-2.0 found: YES 2.84.1
Run-time dependency gio-2.0 found: YES 2.84.1
Run-time dependency gio-unix-2.0 found: YES 2.84.1
Run-time dependency gmodule-2.0 found: YES 2.84.1
Dependency libfprint-2 found: NO. Found 1.94.4 but need: '>=1.94.9'
Did not find CMake 'cmake'
Found CMake: NO
Run-time dependency libfprint-2 found: NO 

meson.build:91:16: ERROR: Dependency lookup for libfprint-2 with method 'pkgconfig' failed: Invalid version, need 'libfprint-2' ['>=1.94.9'] found '1.94.4'.

pardon me if i am doing anything wrong, i dunno how this works.

This ā€œerrorā€ is due to the fact that fprintd version in NixOS-25.05 was updated to v1.94.5, and the newer version of fprintd is not compatible with libfprint version <1.94.9

The compiled library which the developer of this focaltech fingerprint library provided is compiled against libfprint v1.94.4, hence the fprintd compilation fails here.

If you want to use fingerprint on NixOS-25.05 (or above), you will need either upgrade the package provided by dev (which is not straightforward as we don’t have the source code) or downgrade the libfprint version.

On a flake based system, you can achieve this by

# flake.nix
{
  inputs = {
    pinned-pkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
  };
  # in output pass this as `specialArgs`
};
# configuration.nix
{
  pinned-pkgs,
  pkgs,
  ...
}:
let
  patched-fprintd = pinned-pkgs.fprintd.override {
    libfprint = pinned-pkgs.libfprint-focaltech-2808-a658; # or pkgs.libfprint-focaltech-2808-a658
  };
in
{
  services.fprintd = {
    enable = true;
    package = patched-fprintd;
  };
}

for non-flake setup something like this could work

of course adapt it, and use nixos-24.11 as rev

We should mark the package as broken and backport to 25.05 @imsick

1 Like

thank you very much!

1 Like