Compare commits
No commits in common. "789b1780cb5f3b309497466bf73e1389c281cc13" and "913b3acec30af2f506aed0754ccd36046ed4d852" have entirely different histories.
789b1780cb
...
913b3acec3
3 changed files with 11 additions and 69 deletions
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
cfg,
|
||||
|
|
@ -8,9 +7,6 @@
|
|||
}: let
|
||||
athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
|
||||
inherit (athena) vendor;
|
||||
|
||||
driver = athena.card-driver.lib;
|
||||
scmiddleware = "${driver}/lib/SCMiddleware";
|
||||
in {
|
||||
environment = {
|
||||
etc =
|
||||
|
|
@ -20,12 +16,11 @@ in {
|
|||
'';
|
||||
}
|
||||
// lib.optionalAttrs (vendor == "athena") {
|
||||
"Athena".source = "${driver}/etc/Athena";
|
||||
"Athena".source = "${athena.card-driver.lib}/etc/Athena";
|
||||
}
|
||||
// lib.optionalAttrs (vendor == "idopte") {
|
||||
"idoss.conf".source = "${driver}/etc/idoss.conf";
|
||||
"idoss.lic".source = "${driver}/etc/idoss.lic";
|
||||
"SCMiddleware".source = scmiddleware;
|
||||
"idoss.conf".source = "${athena.card-driver.lib}/etc/idoss.conf";
|
||||
"idoss.lic".source = "${athena.card-driver.lib}/etc/idoss.lic";
|
||||
};
|
||||
|
||||
systemPackages = [athena.card-driver];
|
||||
|
|
@ -52,43 +47,11 @@ in {
|
|||
services = {
|
||||
pcscd.enable = true;
|
||||
|
||||
udev.extraRules =
|
||||
lib.optionalString (vendor == "athena") ''
|
||||
udev.extraRules = ''
|
||||
# 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} = {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ in
|
|||
./0001-Remove-CheckUpdatePlugin-from-default-list.patch
|
||||
];
|
||||
|
||||
mvnHash = "sha256-QDjhwrKZK/cEQxRYUM+z1zMCNrTHyxRqAhUfNtubhhI=";
|
||||
mvnHash = "sha256-0vwJ1f+0UXxrXRaJ1BHqfOXDU/pxrSPdYYEQ71m4jJQ=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
|
|
|
|||
|
|
@ -102,7 +102,6 @@
|
|||
libnotify,
|
||||
openssl,
|
||||
pcsclite,
|
||||
python3,
|
||||
stdenv,
|
||||
unzip,
|
||||
webkitgtk_4_1,
|
||||
|
|
@ -125,7 +124,6 @@
|
|||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
python3
|
||||
];
|
||||
|
||||
outputs = ["out" "lib"];
|
||||
|
|
@ -134,34 +132,15 @@
|
|||
runHook preInstall
|
||||
|
||||
install -m755 -d $out/bin $lib/{etc,lib/SCMiddleware}
|
||||
install -m755 usr/lib/SCMiddleware/SCManager $out/bin
|
||||
install -m755 usr/lib/SCMiddleware/{*.so,idocachesrv} $lib/lib/SCMiddleware
|
||||
install -m755 usr/lib/SCMiddleware/{idocachesrv,SCManager} $out/bin
|
||||
install -m755 usr/lib/SCMiddleware/*.so $lib/lib/SCMiddleware
|
||||
cp -r etc/id* $lib/etc
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
for elf in $lib/lib/SCMiddleware/* $out/bin/*; do
|
||||
python3 /dev/fd/3 <$elf >$elf.patched 3<<EOF
|
||||
import sys
|
||||
contents = sys.stdin.buffer.read()
|
||||
|
||||
def bin_replace(s, a, b):
|
||||
assert len(a) >= len(b)
|
||||
return s.replace(a, b + b'\0' * (len(a) - len(b)))
|
||||
|
||||
contents = bin_replace(contents, b'/usr/lib/SCMiddleware', b'/etc/SCMiddleware')
|
||||
contents = bin_replace(contents, b'/tmp/.idoss_socket', b'/run/idoss/socket')
|
||||
|
||||
sys.stdout.buffer.write(contents)
|
||||
EOF
|
||||
|
||||
chmod --reference=$elf $elf.patched
|
||||
mv $elf.patched $elf
|
||||
|
||||
patchelf --set-rpath $lib/lib/SCMiddleware $elf
|
||||
done
|
||||
patchelf --set-rpath $lib/lib/SCMiddleware $lib/lib/SCMiddleware/* $out/bin/*
|
||||
'';
|
||||
|
||||
passthru.pkcs11-path = "lib/SCMiddleware/libidop11.so";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue