trivionomicon: athena-bccr: add idopte cache server

This commit is contained in:
Alejandro Soto 2026-03-09 02:33:53 -06:00
parent dd366aa20e
commit f7ec31843d

View file

@ -1,4 +1,5 @@
{ {
config,
pkgs, pkgs,
lib, lib,
cfg, cfg,
@ -51,10 +52,42 @@ in {
services = { services = {
pcscd.enable = true; pcscd.enable = true;
udev.extraRules = '' udev.extraRules =
# Athena Smartcard Solutions, Inc. ASEDrive V3CR lib.optionalString (vendor == "athena") ''
ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1004", MODE="660", GROUP="${cfg.group}", TAG+="uaccess" # Athena Smartcard Solutions, Inc. ASEDrive V3CR
''; ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1004", MODE="660", GROUP="${cfg.group}", TAG+="uaccess"
''
+ lib.optionalString (vendor == "idopte") ''
# Bit4id Srl miniLector-s
ACTION=="add", SUBSYSTEM=="usb", ENV{PRODUCT}=="25dd/1101*", RUN+="${config.systemd.package}/bin/systemctl start --no-block idopte-reader.target"
ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="25dd/1101*", RUN+="${config.systemd.package}/bin/systemctl stop --no-block idopte-reader.target"
'';
};
systemd = lib.mkIf (vendor == "idopte") {
#TODO: make this run as a non-root user
services.idopte-cache = {
description = "Idopte cache server";
after = ["smartcard.target"];
bindsTo = ["idopte-reader.target"];
wantedBy = ["idopte-reader.target"];
serviceConfig = {
Type = "forking";
PIDFile = "/run/idoCacheSrv.pid";
RuntimeDirectory = "idoss";
ExecStart = "${scmiddleware}/idocachesrv";
};
};
targets.idopte-reader = {
description = "Idopte USB reader inserted";
wants = ["smartcard.target"];
before = ["smartcard.target"];
};
}; };
users.groups.${cfg.group} = {}; users.groups.${cfg.group} = {};