nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 makeWrapper,
6 stripJavaArchivesHook,
7 meson,
8 ninja,
9 pkg-config,
10 gradle_8,
11 curl,
12 cryptopp,
13 fontconfig,
14 jre,
15 libxml2,
16 openssl,
17 pcsclite,
18 podofo_0_10,
19 ghostscript,
20}:
21
22let
23 pname = "cie-middleware-linux";
24 version = "1.5.9";
25
26 src = fetchFromGitHub {
27 owner = "M0rf30";
28 repo = "cie-middleware-linux";
29 tag = version;
30 hash = "sha256-2UMKxanF35oBNBtIqfU46QUYJwXiTU1xCrCMqzqetgI=";
31 };
32
33 gradle = gradle_8;
34
35 # Shared libraries needed by the Java application
36 libraries = lib.makeLibraryPath [ ghostscript ];
37
38in
39
40stdenv.mkDerivation {
41 inherit pname src version;
42
43 hardeningDisable = [ "format" ];
44
45 nativeBuildInputs = [
46 makeWrapper
47 stripJavaArchivesHook
48 meson
49 ninja
50 pkg-config
51 gradle
52 ];
53
54 buildInputs = [
55 cryptopp
56 fontconfig
57 podofo_0_10
58 openssl
59 pcsclite
60 curl
61 libxml2
62 ];
63
64 postPatch = ''
65 # substitute the cieid command with this $out/bin/cieid
66 substituteInPlace libs/pkcs11/src/CSP/AbilitaCIE.cpp \
67 --replace 'file = "cieid"' 'file = "'$out'/bin/cieid"'
68 '';
69
70 # Note: we use pushd/popd to juggle between the
71 # libraries and the Java application builds.
72 preConfigure = "pushd libs";
73
74 mitmCache = gradle.fetchDeps {
75 inherit pname;
76 data = ./deps.json;
77 };
78
79 gradleFlags = [
80 "-Dorg.gradle.java.home=${jre}"
81 "--build-file"
82 "cie-java/build.gradle"
83 ];
84
85 gradleBuildTask = "standalone";
86
87 buildPhase = ''
88 runHook preBuild
89
90 ninjaBuildPhase
91 pushd ../..
92 gradleBuildPhase
93 popd
94
95 runHook postBuild
96 '';
97
98 doCheck = true;
99
100 checkPhase = ''
101 runHook preCheck
102
103 mesonCheckPhase
104 pushd ../..
105 gradleCheckPhase
106 popd
107
108 runHook postCheck
109 '';
110
111 postInstall = ''
112 popd
113
114 # Install the Java application
115 ls cie-java/build/libs/CIEID-standalone.jar
116 install -Dm755 cie-java/build/libs/CIEID-standalone.jar \
117 "$out/share/cieid/cieid.jar"
118
119 # Create a wrapper
120 mkdir -p "$out/bin"
121 makeWrapper "${jre}/bin/java" "$out/bin/cieid" \
122 --add-flags "-Djna.library.path='$out/lib:${libraries}'" \
123 --add-flags "-Dawt.useSystemAAFontSettings=gasp" \
124 --add-flags "-cp $out/share/cieid/cieid.jar" \
125 --add-flags "app.m0rf30.cieid.MainApplication"
126
127 # Install other files
128 install -Dm644 data/app.m0rf30.cieid.desktop -t "$out/share/applications"
129 install -Dm755 data/app.m0rf30.cieid.svg -t "$out/share/pixmaps"
130 install -Dm644 LICENSE "$out/share/licenses/cieid/LICENSE"
131 '';
132
133 preGradleUpdate = "cd ../..";
134
135 meta = {
136 homepage = "https://github.com/M0Rf30/cie-middleware-linux";
137 description = "Middleware for the Italian Electronic Identity Card (CIE)";
138 longDescription = ''
139 Software for the usage of the Italian Electronic Identity Card (CIE).
140 Access to PA services, signing and verification of documents
141
142 Warning: this is an unofficial fork because the original software, as
143 distributed by the Italian government, is essentially lacking a build
144 system and is in violation of the license of the PoDoFo library.
145 '';
146 license = lib.licenses.bsd3;
147 platforms = lib.platforms.unix;
148 maintainers = with lib.maintainers; [ rnhmjoj ];
149 };
150}