2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, jdk8, maven, makeWrapper, jre8_headless, pcsclite }:
|
2018-08-01 05:53:33 +01:00
|
|
|
|
2020-09-19 16:39:26 +01:00
|
|
|
let jdk = jdk8; jre_headless = jre8_headless; in
|
2018-08-16 17:13:46 +01:00
|
|
|
# TODO: This is quite a bit of duplicated logic with gephi. Factor it out?
|
2018-08-01 05:53:33 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2018-08-16 16:25:44 +01:00
|
|
|
pname = "global-platform-pro";
|
2018-10-14 16:36:23 +01:00
|
|
|
version = "18.09.14";
|
|
|
|
GPPRO_VERSION = "18.09.14-0-gb439b52"; # git describe --tags --always --long --dirty
|
2018-08-01 05:53:33 +01:00
|
|
|
|
2018-08-16 16:25:44 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "martinpaljak";
|
|
|
|
repo = "GlobalPlatformPro";
|
2019-09-09 00:38:31 +01:00
|
|
|
rev = version;
|
2018-10-14 16:36:23 +01:00
|
|
|
sha256 = "1vws6cbgm3mrwc2xz9j1y262vw21x3hjc9m7rqc4hn3m7gjpwsvg";
|
2018-08-16 16:25:44 +01:00
|
|
|
};
|
2018-08-01 05:53:33 +01:00
|
|
|
|
2018-08-16 16:25:44 +01:00
|
|
|
deps = stdenv.mkDerivation {
|
2019-08-15 13:41:18 +01:00
|
|
|
name = "${pname}-${version}-deps";
|
2018-10-14 16:36:23 +01:00
|
|
|
inherit src;
|
2018-08-16 16:25:44 +01:00
|
|
|
nativeBuildInputs = [ jdk maven ];
|
2018-08-16 17:27:45 +01:00
|
|
|
installPhase = ''
|
|
|
|
# Download the dependencies
|
2018-08-16 16:25:44 +01:00
|
|
|
while ! mvn package "-Dmaven.repo.local=$out/.m2" -Dmaven.wagon.rto=5000; do
|
|
|
|
echo "timeout, restart maven to continue downloading"
|
|
|
|
done
|
2018-08-16 17:27:45 +01:00
|
|
|
|
|
|
|
# And keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files
|
|
|
|
# with lastModified timestamps inside
|
2018-08-16 16:25:44 +01:00
|
|
|
find "$out/.m2" -type f \
|
|
|
|
-regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' \
|
|
|
|
-delete
|
2018-08-01 05:53:33 +01:00
|
|
|
'';
|
2018-08-16 16:25:44 +01:00
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
2018-10-14 16:36:23 +01:00
|
|
|
outputHash = "1qwgvz6l5wia8q5824c9f3iwyapfskljhqf1z09fw6jjj1jy3b15";
|
2018-08-16 16:25:44 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ jdk maven makeWrapper ];
|
2018-08-01 05:53:33 +01:00
|
|
|
|
2018-08-16 16:25:44 +01:00
|
|
|
buildPhase = ''
|
|
|
|
cp -dpR "${deps}/.m2" ./
|
|
|
|
chmod -R +w .m2
|
|
|
|
mvn package --offline -Dmaven.repo.local="$(pwd)/.m2"
|
|
|
|
'';
|
2018-08-01 05:53:33 +01:00
|
|
|
|
2018-08-16 16:25:44 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/lib/java" "$out/share/java"
|
|
|
|
cp target/gp.jar "$out/share/java"
|
|
|
|
makeWrapper "${jre_headless}/bin/java" "$out/bin/gp" \
|
|
|
|
--add-flags "-jar '$out/share/java/gp.jar'" \
|
|
|
|
--prefix LD_LIBRARY_PATH : "${pcsclite.out}/lib"
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-08-16 16:25:44 +01:00
|
|
|
description = "Command-line utility for managing applets and keys on Java Cards";
|
|
|
|
longDescription = ''
|
|
|
|
This command-line utility can be used to manage applets and keys
|
|
|
|
on Java Cards. It is made available as the `gp` executable.
|
|
|
|
|
|
|
|
The executable requires the PC/SC daemon running for correct execution.
|
|
|
|
If you run NixOS, it can be enabled with `services.pcscd.enable = true;`.
|
|
|
|
'';
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/martinpaljak/GlobalPlatformPro";
|
2018-08-16 16:25:44 +01:00
|
|
|
license = with licenses; [ lgpl3 ];
|
2018-10-30 16:06:27 +00:00
|
|
|
maintainers = with maintainers; [ ekleog ];
|
2018-08-16 16:25:44 +01:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2018-08-01 05:53:33 +01:00
|
|
|
}
|