{ config, lib, pkgs, inputs, ... }: { options.services.fingerprint-fix.enable = lib.mkEnableOption "Enable support for fingerprint for P51S-like ThinkPads."; options.services.fingerprint-fix.calibDataFile = lib.mkOption { description = "Path to calibration data file."; }; imports = lib.mkIf config.services.fingerprint-fix.enable [ inputs.fingerprint-sensor.nixosModules."06cb-009a-fingerprint-sensor" ]; config = lib.mkIf config.services.fingerprint-fix.enable { # Needed because we're getting TLS error with open-fprintd-resume systemd.services.validity-restart = let targets = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" "suspend-then-hibernate.target" ]; in { description = "Restart services to fix fingerprint integration"; wantedBy = targets; after = targets; serviceConfig = { type = "simple"; ExecStart = "systemctl --no-block restart python3-validity.service open-fprintd.service"; }; }; services."06cb-009a-fingerprint-sensor" = { enable = true; backend = "python-validity"; calib-data-file = config.services.fingerprint-fix.calibDataFile; }; services.open-fprintd.enable = true; security.pam.services.login.fprintAuth = true; security.pam.services.greetd.fprintAuth = true; security.pam.services.sudo.fprintAuth = true; security.pam.services.su.fprintAuth = true; services.udev.extraRules = '' ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="138a", ATTRS{idProduct}=="0097", ATTR{power/persist}="1" ''; security.pam.services.hyprlock.text = '' # PAM configuration file for hyprlock # the 'login' configuration file (see /etc/pam.d/login) auth include login ''; }; }