1 { lib, stdenv, fetchFromGitHub, jdk8, maven, makeWrapper, jre8_headless, pcsclite }:
3 let jdk = jdk8; jre_headless = jre8_headless; in
4 # TODO: This is quite a bit of duplicated logic with gephi. Factor it out?
5 stdenv.mkDerivation rec {
6 pname = "global-platform-pro";
8 GPPRO_VERSION = "18.09.14-0-gb439b52"; # git describe --tags --always --long --dirty
10 src = fetchFromGitHub {
11 owner = "martinpaljak";
12 repo = "GlobalPlatformPro";
14 sha256 = "1vws6cbgm3mrwc2xz9j1y262vw21x3hjc9m7rqc4hn3m7gjpwsvg";
17 deps = stdenv.mkDerivation {
18 name = "${pname}-${version}-deps";
20 nativeBuildInputs = [ jdk maven ];
22 # Download the dependencies
23 while ! mvn package "-Dmaven.repo.local=$out/.m2" -Dmaven.wagon.rto=5000; do
24 echo "timeout, restart maven to continue downloading"
27 # And keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files
28 # with lastModified timestamps inside
29 find "$out/.m2" -type f \
30 -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' \
33 outputHashAlgo = "sha256";
34 outputHashMode = "recursive";
35 outputHash = "1qwgvz6l5wia8q5824c9f3iwyapfskljhqf1z09fw6jjj1jy3b15";
38 nativeBuildInputs = [ jdk maven makeWrapper ];
41 cp -dpR "${deps}/.m2" ./
43 mvn package --offline -Dmaven.repo.local="$(pwd)/.m2"
47 mkdir -p "$out/lib/java" "$out/share/java"
48 cp target/gp.jar "$out/share/java"
49 makeWrapper "${jre_headless}/bin/java" "$out/bin/gp" \
50 --add-flags "-jar '$out/share/java/gp.jar'" \
51 --prefix LD_LIBRARY_PATH : "${pcsclite.out}/lib"
55 description = "Command-line utility for managing applets and keys on Java Cards";
57 This command-line utility can be used to manage applets and keys
58 on Java Cards. It is made available as the `gp` executable.
60 The executable requires the PC/SC daemon running for correct execution.
61 If you run NixOS, it can be enabled with `services.pcscd.enable = true;`.
63 homepage = "https://github.com/martinpaljak/GlobalPlatformPro";
64 sourceProvenance = with sourceTypes; [
68 license = with licenses; [ lgpl3 ];
69 maintainers = with maintainers; [ ekleog ];
71 platforms = platforms.all;