summaryrefslogtreecommitdiff
path: root/trivionomicon/modules/athena-bccr/sys.nix
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2026-03-09 02:33:53 -0600
committerAlejandro Soto <alejandro@34project.org>2026-03-09 12:55:19 -0600
commit5741f2b89b1f7b2bbe51d452871776d2b414d3bb (patch)
tree2aaf830795d7f880b86f66ce4e1e52901f8b926f /trivionomicon/modules/athena-bccr/sys.nix
parent2de1a4811ea5f3363dc84432f0bc0bb339c43676 (diff)
trivionomicon: athena-bccr: add idopte cache server
Diffstat (limited to '')
-rw-r--r--trivionomicon/modules/athena-bccr/sys.nix41
1 files changed, 37 insertions, 4 deletions
diff --git a/trivionomicon/modules/athena-bccr/sys.nix b/trivionomicon/modules/athena-bccr/sys.nix
index 425c23a..98ae904 100644
--- a/trivionomicon/modules/athena-bccr/sys.nix
+++ b/trivionomicon/modules/athena-bccr/sys.nix
@@ -1,4 +1,5 @@
{
+ config,
pkgs,
lib,
cfg,
@@ -51,10 +52,42 @@ in {
services = {
pcscd.enable = true;
- udev.extraRules = ''
- # Athena Smartcard Solutions, Inc. ASEDrive V3CR
- ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1004", MODE="660", GROUP="${cfg.group}", TAG+="uaccess"
- '';
+ udev.extraRules =
+ lib.optionalString (vendor == "athena") ''
+ # 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} = {};