trivionomicon: athena-bccr: add support for non-Athena driver vendors

This commit is contained in:
Alejandro Soto 2026-03-02 19:48:42 -06:00
parent 62eee95d99
commit 57f673b495
6 changed files with 152 additions and 144 deletions

View file

@ -6,17 +6,18 @@
...
}: let
athena = pkgs.${doctrine.prefix}.athena-bccr.${cfg.release};
inherit (athena.card-driver) vendor;
in {
environment = {
etc = {
"Athena".source = "${athena.ase-pkcs11}/etc/Athena";
etc = lib.optionalAttrs (vendor == "athena") {
"Athena".source = "${athena.card-driver}/etc/Athena";
"pkcs11/modules/asep11".text = ''
module: ${athena.libasep11}
module: ${athena.pkcs11-module}
'';
};
systemPackages = [athena.ase-pkcs11];
systemPackages = [athena.card-driver];
};
security = {

View file

@ -16,15 +16,15 @@
};
pkgsForRelease = release: let
ase-pkcs11 = unwrapped.ase-idprotect.lib;
libasep11 = "${ase-pkcs11}/lib/x64-athena/libASEP11.so";
inherit (unwrapped) card-driver bccr-cacerts;
unwrapped = overrideUnwrapped {inherit release;} {};
pkcs11-module = "${card-driver.lib}/${card-driver.pkcs11-path}";
in {
inherit ase-pkcs11 libasep11;
inherit (unwrapped) ase-idprotect bccr-cacerts;
inherit card-driver bccr-cacerts pkcs11-module;
gaudi = callPackage ./gaudi-env.nix {inherit unwrapped;};
firmador = callPackage ./firmador.nix {inherit libasep11;};
firmador = callPackage ./firmador.nix {inherit pkcs11-module;};
};
in
lib.mapAttrs (_: pkgsForRelease) (releases // {latest = releases.${latest};})

View file

@ -5,7 +5,7 @@
maven,
openjdk,
wrapGAppsHook3,
libasep11 ? null,
pkcs11-module ? null,
}: let
jdk = openjdk.override {
enableJavaFX = true;
@ -34,8 +34,8 @@ in
wrapGAppsHook3
];
postPatch = lib.optionalString (libasep11 != null) ''
sed -i 's@/usr/lib/x64-athena/libASEP11.so@${libasep11}@g' src/main/java/cr/libre/firmador/signers/CRSigner.java
postPatch = lib.optionalString (pkcs11-module != null) ''
sed -i 's@/usr/lib/x64-athena/libASEP11.so@${pkcs11-module}@g' src/main/java/cr/libre/firmador/signers/CRSigner.java
'';
installPhase = ''

View file

@ -12,7 +12,7 @@ in
name = "gaudi";
targetPkgs = pkgs: [
unwrappedWithGaudi.ase-idprotect.lib
unwrappedWithGaudi.card-driver.lib
unwrappedWithGaudi.gaudi
(writeShellScriptBin "launch-gaudi" ''

View file

@ -3,6 +3,7 @@
# nix hash convert --hash-algo sha256 --from base16 --to sri $(sha256sum sfd_ClientesLinux_DEB64_Rev26.zip | cut -d' ' -f1)
hash = "sha256-ZPWP9TqJQ5coJAPzUSiaXKVItBWlqFM4smCjOf+gqQM=";
basename = "sfd_ClientesLinux_DEB64_Rev26";
vendor = "athena";
srcPaths = {
gaudi = "Firma Digital/Agente GAUDI/agente-gaudi_20.0_amd64.deb";

View file

@ -5,7 +5,7 @@
gaudiHash ? null,
...
}: let
inherit (release) srcPaths;
inherit (release) srcPaths vendor;
src = requireFile {
url = "https://soportefirmadigital.com";
@ -42,7 +42,7 @@
'';
}
// lib.removeAttrs args ["stdenv" "dpkg" "unzip" "srcPath" "nativeBuildInputs"]);
in {
ase-idprotect = {
autoPatchelfHook,
dpkg,
@ -89,8 +89,11 @@ in {
preFixup = ''
patchelf --set-rpath $lib/lib/x64-athena $out/bin/*
'';
};
passthru.pkcs11-path = "lib/x64-athena/libASEP11.so";
};
in
{
gaudi = {
autoPatchelfHook,
dpkg,
@ -224,3 +227,6 @@ in {
echo -e "\ngaudiHash: $(nix-hash --to-sri --type sha256 $(sha256sum "$zip_path" | cut -d' ' -f1))"
'';
}
// lib.optionalAttrs (vendor == "athena") {
card-driver = ase-idprotect;
}