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,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
cfg,
|
cfg,
|
||||||
|
|
@ -8,9 +7,6 @@
|
||||||
}: let
|
}: let
|
||||||
athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
|
athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
|
||||||
inherit (athena) vendor;
|
inherit (athena) vendor;
|
||||||
|
|
||||||
driver = athena.card-driver.lib;
|
|
||||||
scmiddleware = "${driver}/lib/SCMiddleware";
|
|
||||||
in {
|
in {
|
||||||
environment = {
|
environment = {
|
||||||
etc =
|
etc =
|
||||||
|
|
@ -20,12 +16,11 @@ in {
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (vendor == "athena") {
|
// lib.optionalAttrs (vendor == "athena") {
|
||||||
"Athena".source = "${driver}/etc/Athena";
|
"Athena".source = "${athena.card-driver.lib}/etc/Athena";
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (vendor == "idopte") {
|
// lib.optionalAttrs (vendor == "idopte") {
|
||||||
"idoss.conf".source = "${driver}/etc/idoss.conf";
|
"idoss.conf".source = "${athena.card-driver.lib}/etc/idoss.conf";
|
||||||
"idoss.lic".source = "${driver}/etc/idoss.lic";
|
"idoss.lic".source = "${athena.card-driver.lib}/etc/idoss.lic";
|
||||||
"SCMiddleware".source = scmiddleware;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
systemPackages = [athena.card-driver];
|
systemPackages = [athena.card-driver];
|
||||||
|
|
@ -52,42 +47,10 @@ in {
|
||||||
services = {
|
services = {
|
||||||
pcscd.enable = true;
|
pcscd.enable = true;
|
||||||
|
|
||||||
udev.extraRules =
|
udev.extraRules = ''
|
||||||
lib.optionalString (vendor == "athena") ''
|
# Athena Smartcard Solutions, Inc. ASEDrive V3CR
|
||||||
# Athena Smartcard Solutions, Inc. ASEDrive V3CR
|
ATTRS{idVendor}=="0dc3", ATTRS{idProduct}=="1004", MODE="660", GROUP="${cfg.group}", TAG+="uaccess"
|
||||||
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} = {};
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ in
|
||||||
./0001-Remove-CheckUpdatePlugin-from-default-list.patch
|
./0001-Remove-CheckUpdatePlugin-from-default-list.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
mvnHash = "sha256-QDjhwrKZK/cEQxRYUM+z1zMCNrTHyxRqAhUfNtubhhI=";
|
mvnHash = "sha256-0vwJ1f+0UXxrXRaJ1BHqfOXDU/pxrSPdYYEQ71m4jJQ=";
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
makeWrapper
|
makeWrapper
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@
|
||||||
libnotify,
|
libnotify,
|
||||||
openssl,
|
openssl,
|
||||||
pcsclite,
|
pcsclite,
|
||||||
python3,
|
|
||||||
stdenv,
|
stdenv,
|
||||||
unzip,
|
unzip,
|
||||||
webkitgtk_4_1,
|
webkitgtk_4_1,
|
||||||
|
|
@ -125,7 +124,6 @@
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
autoPatchelfHook
|
autoPatchelfHook
|
||||||
python3
|
|
||||||
];
|
];
|
||||||
|
|
||||||
outputs = ["out" "lib"];
|
outputs = ["out" "lib"];
|
||||||
|
|
@ -134,34 +132,15 @@
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
install -m755 -d $out/bin $lib/{etc,lib/SCMiddleware}
|
install -m755 -d $out/bin $lib/{etc,lib/SCMiddleware}
|
||||||
install -m755 usr/lib/SCMiddleware/SCManager $out/bin
|
install -m755 usr/lib/SCMiddleware/{idocachesrv,SCManager} $out/bin
|
||||||
install -m755 usr/lib/SCMiddleware/{*.so,idocachesrv} $lib/lib/SCMiddleware
|
install -m755 usr/lib/SCMiddleware/*.so $lib/lib/SCMiddleware
|
||||||
cp -r etc/id* $lib/etc
|
cp -r etc/id* $lib/etc
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
for elf in $lib/lib/SCMiddleware/* $out/bin/*; do
|
patchelf --set-rpath $lib/lib/SCMiddleware $lib/lib/SCMiddleware/* $out/bin/*
|
||||||
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
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.pkcs11-path = "lib/SCMiddleware/libidop11.so";
|
passthru.pkcs11-path = "lib/SCMiddleware/libidop11.so";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue