From 694be470126e676682e536b6678898083b8b8caf Mon Sep 17 00:00:00 2001 From: Sandeep Patel <96694484+sandptel@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:46:45 +0530 Subject: [PATCH] nixos/fprintd: add elanmoc2 support Added services.fprintd.elanmoc2.enable that uses an overlay to add support for the ELAN 04f3:0c00 fingerprint sensor. --- nixos/modules/services/security/fprintd.nix | 34 +++++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/security/fprintd.nix b/nixos/modules/services/security/fprintd.nix index 87c3f1f6f9e42..c81ededf84726 100644 --- a/nixos/modules/services/security/fprintd.nix +++ b/nixos/modules/services/security/fprintd.nix @@ -3,15 +3,30 @@ with lib; let - cfg = config.services.fprintd; + fprintdPkg = if cfg.tod.enable then pkgs.fprintd-tod else pkgs.fprintd; -in + # Overlay to support elanmoc2 if enabled + myOverlay = final: prev: { + libfprint = prev.libfprint.overrideAttrs (old: { + src = builtins.fetchGit { + url = "https://gitlab.freedesktop.org/depau/libfprint.git"; + ref = "elanmoc2"; + rev = "f4439ce96b2938fea8d4f42223d7faea05bd4048"; + }; + }); + fprintd = prev.fprintd.overrideAttrs (old: { + mesonCheckFlags = [ + "--no-suite" "fprintd:TestPamFprintd" + "--no-suite" "fprintd:FPrintdManagerPreStartTests" + ]; + }); + }; +in { - ###### interface options = { @@ -41,13 +56,18 @@ in ''; }; }; + + elanmoc2 = { + + enable = mkEnableOption "Compile elanmoc2 to enable support for 04f3:0c00 fingerprint reader"; + + }; }; }; - ###### implementation - config = mkIf cfg.enable { + config = mkIf (cfg.enable || cfg.elanmoc2.enable) { services.dbus.packages = [ cfg.package ]; @@ -59,6 +79,8 @@ in FP_TOD_DRIVERS_DIR = "${cfg.tod.driver}${cfg.tod.driver.driverPath}"; }; - }; + # Apply overlay if elanmoc2 is enabled + nixpkgs.overlays = mkIf cfg.elanmoc2.enable [ myOverlay ]; + }; }