nixos/fprintd: add TOD support

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Signed-off-by: Yurii Matsiuk <ymatsiuk@users.noreply.github.com>
This commit is contained in:
Yurii Matsiuk 2021-03-29 12:27:51 +02:00
parent 531502481b
commit b29ed56049
No known key found for this signature in database
GPG key ID: 61302290298601AA
2 changed files with 22 additions and 10 deletions

View file

@ -5,6 +5,7 @@ with lib;
let
cfg = config.services.fprintd;
fprintdPkg = if cfg.tod.enable then pkgs.fprintd-tod else pkgs.fprintd;
in
@ -17,25 +18,30 @@ in
services.fprintd = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable fprintd daemon and PAM module for fingerprint readers handling.
'';
};
enable = mkEnableOption "fprintd daemon and PAM module for fingerprint readers handling";
package = mkOption {
type = types.package;
default = pkgs.fprintd;
defaultText = "pkgs.fprintd";
default = fprintdPkg;
defaultText = "if cfg.tod.enable then pkgs.fprintd-tod else pkgs.fprintd";
description = ''
fprintd package to use.
'';
};
};
tod = {
enable = mkEnableOption "Touch OEM Drivers library support";
driver = mkOption {
type = types.package;
example = literalExample "pkgs.libfprint-2-tod1-goodix";
description = ''
Touch OEM Drivers (TOD) package to use.
'';
};
};
};
};
@ -49,6 +55,10 @@ in
systemd.packages = [ cfg.package ];
systemd.services.fprintd.environment = mkIf cfg.tod.enable {
FP_TOD_DRIVERS_DIR = "${cfg.tod.driver}${cfg.tod.driver.driverPath}";
};
};
}

View file

@ -25,6 +25,8 @@ stdenv.mkDerivation {
cp lib/udev/rules.d/60-libfprint-2-tod1-goodix.rules "$out/usr/lib/udev/rules.d/"
'';
passthru.driverPath = "/usr/lib/libfprint-2/tod-1";
meta = with lib; {
description = "Goodix driver module for libfprint-2-tod Touch OEM Driver";
homepage = "https://git.launchpad.net/~oem-solutions-engineers/libfprint-2-tod1-goodix/+git/libfprint-2-tod1-goodix/";