2023-10-09 19:29:22 +00:00
{ lib , stdenv , fetchFromGitHub , jdk8 , maven , makeWrapper , jre8_headless , pcsclite , proot , zlib }:
2020-04-24 23:36:52 +00:00
2023-07-15 17:15:38 +00:00
let
2023-10-09 19:29:22 +00:00
defineMvnWrapper = ''
mvn ( )
{
# One of the deps that are downloaded and run needs zlib.
export LD_LIBRARY_PATH = " ${ lib . makeLibraryPath [ zlib ] } "
# Give access to ELF interpreter under FHS path, to be able to run
# prebuilt binaries.
" ${ lib . getExe proot } " - b " ${ stdenv . cc . libc } / l i b : / l i b 6 4 " mvn " $ @ "
}
'' ;
2023-07-15 17:15:38 +00:00
in
2024-07-27 06:49:29 +00:00
maven . buildMavenPackage rec {
2020-04-24 23:36:52 +00:00
pname = " g l o b a l - p l a t f o r m - p r o " ;
2023-10-09 19:29:22 +00:00
version = " 2 0 . 0 1 . 2 3 " ;
GPPRO_VERSION = " v 2 0 . 0 1 . 2 3 - 0 - g 5 a d 3 7 3 b " ; # git describe --tags --always --long --dirty
2020-04-24 23:36:52 +00:00
src = fetchFromGitHub {
owner = " m a r t i n p a l j a k " ;
repo = " G l o b a l P l a t f o r m P r o " ;
2023-10-09 19:29:22 +00:00
rev = " v ${ version } " ;
sha256 = " s h a 2 5 6 - z 3 8 I 6 1 J R 4 o i A k I m k b w c v X o K 5 Q s d o R 9 8 6 d D r O z h H s C e Y = " ;
2020-04-24 23:36:52 +00:00
} ;
2024-07-27 06:49:29 +00:00
mvnJdk = jdk8 ;
mvnHash = " s h a 2 5 6 - e s 8 M 7 g V 2 z 1 V 9 V p W O x a n J w Q y i e m a b i U w 3 n 4 h e J B 8 Q 7 5 A = " ;
2020-04-24 23:36:52 +00:00
2023-08-04 22:07:22 +00:00
nativeBuildInputs = [ jdk8 makeWrapper ] ;
2020-04-24 23:36:52 +00:00
2023-10-09 19:29:22 +00:00
# Fix build error due to missing .git directory:
# Failed to execute goal pl.project13.maven:git-commit-id-plugin:4.0.0:revision (retrieve-git-info) on project gppro: .git directory is not found! Please specify a valid [dotGitDirectory] in your pom.xml -> [Help 1]
mvnParameters = " - D m a v e n . g i t c o m m i t i d . s k i p = t r u e " ;
mvnFetchExtraArgs = {
preConfigure = defineMvnWrapper ;
} ;
preConfigure = defineMvnWrapper ;
2020-04-24 23:36:52 +00:00
installPhase = ''
mkdir - p " $ o u t / l i b / j a v a " " $ o u t / s h a r e / j a v a "
2023-10-09 19:29:22 +00:00
cp tool/target/gp.jar " $ o u t / s h a r e / j a v a "
2023-07-15 17:15:38 +00:00
makeWrapper " ${ jre8_headless } / b i n / j a v a " " $ o u t / b i n / g p " \
2020-04-24 23:36:52 +00:00
- - add-flags " - j a r ' $ o u t / s h a r e / j a v a / g p . j a r ' " \
2024-02-29 20:09:43 +00:00
- - prefix LD_LIBRARY_PATH : " ${ lib . getLib pcsclite } / l i b "
2020-04-24 23:36:52 +00:00
'' ;
2021-01-15 22:18:51 +00:00
meta = with lib ; {
2020-04-24 23:36:52 +00:00
description = " C o m m a n d - l i n e u t i l i t y f o r m a n a g i n g a p p l e t s a n d k e y s o n J a v a C a r d s " ;
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 ; ` .
'' ;
homepage = " h t t p s : / / g i t h u b . c o m / m a r t i n p a l j a k / G l o b a l P l a t f o r m P r o " ;
2022-06-16 17:23:12 +00:00
sourceProvenance = with sourceTypes ; [
fromSource
2023-08-04 22:07:22 +00:00
binaryBytecode # deps
2022-06-16 17:23:12 +00:00
] ;
2020-04-24 23:36:52 +00:00
license = with licenses ; [ lgpl3 ] ;
maintainers = with maintainers ; [ ekleog ] ;
2022-04-27 09:35:20 +00:00
mainProgram = " g p " ;
2020-04-24 23:36:52 +00:00
} ;
}