2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.fprintd;
|
2021-04-17 00:35:05 +00:00
|
|
|
fprintdPkg = if cfg.tod.enable then pkgs.fprintd-tod else pkgs.fprintd;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.fprintd = {
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "fprintd daemon and PAM module for fingerprint readers handling";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
2021-04-17 00:35:05 +00:00
|
|
|
default = fprintdPkg;
|
2021-10-06 13:57:05 +00:00
|
|
|
defaultText = literalExpression "if config.services.fprintd.tod.enable then pkgs.fprintd-tod else pkgs.fprintd";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
fprintd package to use.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
tod = {
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = mkEnableOption "Touch OEM Drivers library support";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
driver = mkOption {
|
|
|
|
type = types.package;
|
2021-10-06 13:57:05 +00:00
|
|
|
example = literalExpression "pkgs.libfprint-2-tod1-goodix";
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2021-04-17 00:35:05 +00:00
|
|
|
Touch OEM Drivers (TOD) package to use.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
services.dbus.packages = [ cfg.package ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
systemd.packages = [ cfg.package ];
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
systemd.services.fprintd.environment = mkIf cfg.tod.enable {
|
|
|
|
FP_TOD_DRIVERS_DIR = "${cfg.tod.driver}${cfg.tod.driver.driverPath}";
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|