summaryrefslogtreecommitdiff
path: root/pkgs/athena-bccr/unwrapped.nix
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2025-07-06 15:14:43 -0600
committerAlejandro Soto <alejandro@34project.org>2025-07-06 16:29:43 -0600
commitc839b6adb914e8af57317389ceb8eb68c31f3e22 (patch)
tree55f6db5e632ce39e085e47bbbd17c208399ffeb9 /pkgs/athena-bccr/unwrapped.nix
parent8d81cc1edb68363502315a848d7074435da1e963 (diff)
pkgs/athena-bccr: initial commit
Diffstat (limited to '')
-rw-r--r--pkgs/athena-bccr/unwrapped.nix134
1 files changed, 134 insertions, 0 deletions
diff --git a/pkgs/athena-bccr/unwrapped.nix b/pkgs/athena-bccr/unwrapped.nix
new file mode 100644
index 0000000..244bebc
--- /dev/null
+++ b/pkgs/athena-bccr/unwrapped.nix
@@ -0,0 +1,134 @@
+{ lib
+
+, release
+}:
+let
+ inherit (release) srcPaths;
+
+ moduleFromDeb = name: args@{ stdenv, dpkg, requireFile, unzip, srcPath, ... }:
+ stdenv.mkDerivation ({
+ pname = "${name}-unwrapped";
+ version = release.name;
+
+ src = requireFile {
+ url = "https://soportefirmadigital.com";
+ name = "${release.basename}.zip";
+
+ inherit (release) hash;
+ };
+
+ nativeBuildInputs = [ dpkg unzip ] ++ (args.nativeBuildInputs or [ ]);
+
+ postUnpack = ''
+ dpkg -x ${lib.escapeShellArg "${release.basename}/${srcPath}"} ${lib.escapeShellArg release.basename}
+ '';
+ } // lib.removeAttrs args [ "stdenv" "dpkg" "requireFile" "unzip" "srcPath" "nativeBuildInputs" ]);
+in
+{
+ ase-idprotect =
+ { autoPatchelfHook
+ , dpkg
+ , fontconfig
+ , freetype
+ , pcsclite
+ , requireFile
+ , stdenv
+ , unzip
+ , xorg
+ , zlib
+ }:
+ moduleFromDeb "ase-idprotect" {
+ inherit dpkg requireFile stdenv unzip;
+ srcPath = srcPaths.idprotect;
+
+ buildInputs = [
+ fontconfig
+ freetype
+ pcsclite
+ stdenv.cc.cc.lib
+ xorg.libX11
+ xorg.libXext
+ zlib
+ ];
+
+ nativeBuildInputs = [
+ autoPatchelfHook
+ ];
+
+ installPhase = ''
+ runHook preInstall
+
+ install -m755 -d $out/{bin,etc,lib/x64-athena}
+ install -m755 usr/bin/IDProtect{_Manager,PINTool} $out/bin/
+ install -m755 usr/lib/x64-athena/* $out/lib/x64-athena
+ cp -r etc/Athena $out/etc/Athena
+
+ runHook postInstall
+ '';
+
+ preFixup = ''
+ patchelf --set-rpath $out/lib/x64-athena $out/bin/*
+ '';
+ };
+
+ gaudi =
+ { autoPatchelfHook
+ , dpkg
+ , makeWrapper
+ , openjdk
+ , requireFile
+ , stdenv
+ , unzip
+ , writeShellScriptBin
+ }:
+ let
+ jdk = openjdk.override {
+ enableJavaFX = true;
+ };
+
+ fakeSudo = writeShellScriptBin "sudo" "";
+ in
+ moduleFromDeb "gaudi" {
+ inherit dpkg requireFile stdenv unzip;
+ srcPath = srcPaths.gaudi;
+
+ nativeBuildInputs = [
+ autoPatchelfHook
+ jdk
+ makeWrapper
+ ];
+
+ buildPhase = ''
+ install -m755 -d $out/{bin,opt/Firmador-BCCR/lib}
+ cp -r opt/Agente-GAUDI/lib/app $out/opt/Firmador-BCCR/lib/app
+
+ # Preserves the original filename and avoids <hash>-LaunchGaudi.java
+ ln -s ${./LaunchGaudi.java} LaunchGaudi.java
+
+ javac \
+ -cp opt/Agente-GAUDI/lib/app/bccr-firma-fva-clienteMultiplataforma.jar \
+ -d $out/opt/Firmador-BCCR/lib/app \
+ LaunchGaudi.java
+ '';
+
+ installPhase = ''
+ runHook preInstall
+
+ install -m755 -d $out/{share,opt/Firmador-BCCR/lib/runtime/lib}
+ install -m755 -D opt/Agente-GAUDI/bin/Agente-GAUDI $out/opt/Firmador-BCCR/bin/Agente-GAUDI
+ install -m755 -D opt/Agente-GAUDI/lib/libapplauncher.so $out/opt/Firmador-BCCR/lib/libapplauncher.so
+
+ ln -s ../opt/Firmador-BCCR/lib/app $out/share/java
+ ln -s Firmador-BCCR $out/opt/Agente-GAUDI
+ ln -s ${jdk}/lib/openjdk/lib/libjli.so $out/opt/Firmador-BCCR/lib/runtime/lib/libjli.so
+
+ makeWrapper ${jdk}/bin/java $out/bin/gaudi \
+ --prefix PATH : ${fakeSudo}/bin \
+ --add-flags "-cp $out/share/java:$out/share/java/bccr-firma-fva-clienteMultiplataforma.jar" \
+ --add-flags "-Djavax.net.ssl.trustStore=$out/opt/Firmador-BCCR/lib/app/bccr.cacerts" \
+ --add-flags "LaunchGaudi"
+
+ runHook postInstall
+ '';
+ };
+}