2015-01-03 16:47:38 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.fprintd;
|
2021-03-29 11:27:51 +01:00
|
|
|
fprintdPkg = if cfg.tod.enable then pkgs.fprintd-tod else pkgs.fprintd;
|
2015-01-03 16:47:38 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.fprintd = {
|
|
|
|
|
2021-03-29 11:27:51 +01:00
|
|
|
enable = mkEnableOption "fprintd daemon and PAM module for fingerprint readers handling";
|
2015-01-03 16:47:38 +00:00
|
|
|
|
2019-05-15 21:56:58 +01:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
2021-03-29 11:27:51 +01:00
|
|
|
default = fprintdPkg;
|
2021-10-03 17:06:03 +01:00
|
|
|
defaultText = literalExpression "if config.services.fprintd.tod.enable then pkgs.fprintd-tod else pkgs.fprintd";
|
2019-05-15 21:56:58 +01:00
|
|
|
description = ''
|
|
|
|
fprintd package to use.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-03-29 11:27:51 +01:00
|
|
|
tod = {
|
|
|
|
|
|
|
|
enable = mkEnableOption "Touch OEM Drivers library support";
|
2019-04-14 15:19:57 +01:00
|
|
|
|
2021-03-29 11:27:51 +01:00
|
|
|
driver = mkOption {
|
|
|
|
type = types.package;
|
2021-10-03 17:06:03 +01:00
|
|
|
example = literalExpression "pkgs.libfprint-2-tod1-goodix";
|
2021-03-29 11:27:51 +01:00
|
|
|
description = ''
|
|
|
|
Touch OEM Drivers (TOD) package to use.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-01-03 16:47:38 +00:00
|
|
|
};
|
2019-04-14 15:19:57 +01:00
|
|
|
|
|
|
|
|
2015-01-03 16:47:38 +00:00
|
|
|
###### implementation
|
2019-04-14 15:19:57 +01:00
|
|
|
|
2015-01-03 16:47:38 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2021-01-10 16:29:43 +00:00
|
|
|
services.dbus.packages = [ cfg.package ];
|
2015-01-03 16:47:38 +00:00
|
|
|
|
2021-01-10 16:29:43 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2015-01-03 16:47:38 +00:00
|
|
|
|
2019-05-15 21:56:58 +01:00
|
|
|
systemd.packages = [ cfg.package ];
|
2015-01-03 16:47:38 +00:00
|
|
|
|
2021-03-29 11:27:51 +01:00
|
|
|
systemd.services.fprintd.environment = mkIf cfg.tod.enable {
|
|
|
|
FP_TOD_DRIVERS_DIR = "${cfg.tod.driver}${cfg.tod.driver.driverPath}";
|
|
|
|
};
|
|
|
|
|
2015-01-03 16:47:38 +00:00
|
|
|
};
|
2019-04-14 15:19:57 +01:00
|
|
|
|
2015-01-03 16:47:38 +00:00
|
|
|
}
|