at 25.11-pre 1.3 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 9 cfg = config.services.fprintd; 10 fprintdPkg = if cfg.tod.enable then pkgs.fprintd-tod else pkgs.fprintd; 11 12in 13 14{ 15 16 ###### interface 17 18 options = { 19 20 services.fprintd = { 21 22 enable = lib.mkEnableOption "fprintd daemon and PAM module for fingerprint readers handling"; 23 24 package = lib.mkOption { 25 type = lib.types.package; 26 default = fprintdPkg; 27 defaultText = lib.literalExpression "if config.services.fprintd.tod.enable then pkgs.fprintd-tod else pkgs.fprintd"; 28 description = '' 29 fprintd package to use. 30 ''; 31 }; 32 33 tod = { 34 35 enable = lib.mkEnableOption "Touch OEM Drivers library support"; 36 37 driver = lib.mkOption { 38 type = lib.types.package; 39 example = lib.literalExpression "pkgs.libfprint-2-tod1-goodix"; 40 description = '' 41 Touch OEM Drivers (TOD) package to use. 42 ''; 43 }; 44 }; 45 }; 46 }; 47 48 ###### implementation 49 50 config = lib.mkIf cfg.enable { 51 52 services.dbus.packages = [ cfg.package ]; 53 54 environment.systemPackages = [ cfg.package ]; 55 56 systemd.packages = [ cfg.package ]; 57 58 systemd.services.fprintd.environment = lib.mkIf cfg.tod.enable { 59 FP_TOD_DRIVERS_DIR = "${cfg.tod.driver}${cfg.tod.driver.driverPath}"; 60 }; 61 62 }; 63 64}