1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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
'';
};
}
|