2024-10-23 06:41:50 +00:00
{ lib , stdenv , fetchFromGitHub , jdk11 , maven , makeWrapper , jre_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 " ;
2024-10-23 06:41:50 +00:00
version = " 2 4 . 1 0 . 1 5 " ;
GPPRO_VERSION = " v 2 4 . 1 0 . 1 5 - 0 - g f 2 a f 9 e f " ; # 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 } " ;
2024-10-23 06:41:50 +00:00
sha256 = " s h a 2 5 6 - y y 2 W O L D e t B r b N R f 6 H v v P d N P D 5 1 u j X o m I 2 a 2 H j 6 e V x 1 Q = " ;
2020-04-24 23:36:52 +00:00
} ;
2024-10-23 06:41:50 +00:00
mvnJdk = jdk11 ;
mvnHash = " s h a 2 5 6 - v T l O x F B j E Z R D 2 3 l d M F + V R K Z x 6 j y Z 6 Y v g v Z M 3 5 3 F W r W Q = " ;
2020-04-24 23:36:52 +00:00
2024-10-23 06:41:50 +00:00
nativeBuildInputs = [ jdk11 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 ;
} ;
2024-10-23 06:41:50 +00:00
postPatch = ''
git_properties_file = " . / l i b r a r y / t a r g e t / c l a s s e s / p r o / j a v a c a r d / g p / g i t . p r o p e r t i e s "
mkdir - p " $ ( d i r n a m e " $ git_properties_file " ) "
# Suffix to differentiate from upstream builds.
distro_suffix = - nixpkgs
echo " g i t . c o m m i t . i d . d e s c r i b e = ' ' ${ GPPRO_VERSION } ' ' ${ distro_suffix } " > " $ g i t _ p r o p e r t i e s _ f i l e "
'' ;
2023-10-09 19:29:22 +00:00
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 "
2024-10-23 06:41:50 +00:00
makeWrapper " ${ jre_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
} ;
}