From cccfa8f3953933147757d6790ad025e88de32dc0 Mon Sep 17 00:00:00 2001 From: Léo Gaspard Date: Wed, 1 Aug 2018 13:53:33 +0900 Subject: global-platform-pro: init at 0.3.10-rc11 --- .../tools/global-platform-pro/default.nix | 89 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 91 insertions(+) create mode 100644 pkgs/development/tools/global-platform-pro/default.nix diff --git a/pkgs/development/tools/global-platform-pro/default.nix b/pkgs/development/tools/global-platform-pro/default.nix new file mode 100644 index 000000000000..fdbeb82cf206 --- /dev/null +++ b/pkgs/development/tools/global-platform-pro/default.nix @@ -0,0 +1,89 @@ +{ stdenv, fetchFromGitHub, jdk, maven, writeText, makeWrapper, jre_headless, pcsclite }: + +# TODO: This is quite a bit of duplicated logic with gephy. Factor it out? +stdenv.mkDerivation rec { + pname = "global-platform-pro"; + version = "0.3.10-rc11"; + describeVersion = "v0.3.10-rc11-0-g8923747"; # git describe --tags --always --long --dirty + name = "${pname}-${version}"; + + src = fetchFromGitHub { + owner = "martinpaljak"; + repo = "GlobalPlatformPro"; + rev = "v${version}"; + sha256 = "0rk81x2y7vx1caxm6wa59fjrfxmjn7s8yxaxm764p8m2qxk3m4y2"; + }; + + patches = [ (writeText "${name}-version.patch" '' + diff --git a/pom.xml b/pom.xml + index 1e5a82d..1aa01fe 100644 + --- a/pom.xml + +++ b/pom.xml + @@ -121,14 +121,10 @@ + + + + - git + + echo + target/generated-resources/pro/javacard/gp/pro_version.txt + + - describe + - --tags + - --always + - --long + - --dirty + + ${describeVersion} + + + + '') ]; + + deps = stdenv.mkDerivation { + name = "${name}-deps"; + inherit src patches; + nativeBuildInputs = [ jdk maven ]; + buildPhase = '' + while mvn package -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do + echo "timeout, restart maven to continue downloading" + done + ''; + # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside + installPhase = ''find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete''; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "15bbi7z9v601all9vr2azh8nk8rpz2vd91yvvw8id6birnbhn3if"; + }; + + nativeBuildInputs = [ jdk maven makeWrapper ]; + + buildPhase = '' + mvn package --offline -Dmaven.repo.local=$( \ + cp -dpR ${deps}/.m2 ./ && \ + chmod +w -R .m2 && \ + pwd \ + )/.m2 + ''; + + installPhase = '' + mkdir -p $out/lib/java $out/share/java + cp -R target/apidocs $out/doc + 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" + ''; + + meta = with stdenv.lib; { + 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;`. + ''; + homepage = https://github.com/martinpaljak/GlobalPlatformPro; + license = with licenses; [ lgpl3 ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c9f6c16e9928..8b1a5e30681c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -180,6 +180,8 @@ with pkgs; fetchMavenArtifact = callPackage ../build-support/fetchmavenartifact { }; + global-platform-pro = callPackage ../development/tools/global-platform-pro/default.nix { }; + graph-easy = callPackage ../tools/graphics/graph-easy { }; packer = callPackage ../development/tools/packer { }; -- cgit 1.4.1 From a52ad2569ab9183837bf73cb03e643d331dfbbd7 Mon Sep 17 00:00:00 2001 From: Léo Gaspard Date: Fri, 17 Aug 2018 00:19:40 +0900 Subject: fixup: points mentioned by timokau --- .../tools/global-platform-pro/default.nix | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/pkgs/development/tools/global-platform-pro/default.nix b/pkgs/development/tools/global-platform-pro/default.nix index fdbeb82cf206..ccf4632ad6ec 100644 --- a/pkgs/development/tools/global-platform-pro/default.nix +++ b/pkgs/development/tools/global-platform-pro/default.nix @@ -14,6 +14,10 @@ stdenv.mkDerivation rec { sha256 = "0rk81x2y7vx1caxm6wa59fjrfxmjn7s8yxaxm764p8m2qxk3m4y2"; }; + # This patch hardcodes the return of a git command the build system tries to + # run. As `fetchFromGitHub` doesn't fetch a full-fledged git repository, + # this command can only fail at build-time. As a consequence, we include the + # `describeVersion` variable defined above here. patches = [ (writeText "${name}-version.patch" '' diff --git a/pom.xml b/pom.xml index 1e5a82d..1aa01fe 100644 @@ -43,12 +47,16 @@ stdenv.mkDerivation rec { inherit src patches; nativeBuildInputs = [ jdk maven ]; buildPhase = '' - while mvn package -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do + while ! mvn package "-Dmaven.repo.local=$out/.m2" -Dmaven.wagon.rto=5000; do echo "timeout, restart maven to continue downloading" done ''; # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside - installPhase = ''find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete''; + installPhase = '' + find "$out/.m2" -type f \ + -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' \ + -delete + ''; outputHashAlgo = "sha256"; outputHashMode = "recursive"; outputHash = "15bbi7z9v601all9vr2azh8nk8rpz2vd91yvvw8id6birnbhn3if"; @@ -57,19 +65,17 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ jdk maven makeWrapper ]; buildPhase = '' - mvn package --offline -Dmaven.repo.local=$( \ - cp -dpR ${deps}/.m2 ./ && \ - chmod +w -R .m2 && \ - pwd \ - )/.m2 + cp -dpR "${deps}/.m2" ./ + chmod -R +w .m2 + mvn package --offline -Dmaven.repo.local="$(pwd)/.m2" ''; installPhase = '' - mkdir -p $out/lib/java $out/share/java - cp -R target/apidocs $out/doc - cp target/gp.jar $out/share/java - makeWrapper ${jre_headless}/bin/java $out/bin/gp \ - --add-flags "-jar $out/share/java/gp.jar" \ + mkdir -p "$out/lib/java" "$out/share/java" + cp -R target/apidocs "$out/doc" + 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" ''; -- cgit 1.4.1 From 39cd3f370d66840bd22d2733a56fe9035e12fd09 Mon Sep 17 00:00:00 2001 From: Léo Gaspard Date: Fri, 17 Aug 2018 00:25:44 +0900 Subject: fixup: reindent --- .../tools/global-platform-pro/default.nix | 162 ++++++++++----------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/pkgs/development/tools/global-platform-pro/default.nix b/pkgs/development/tools/global-platform-pro/default.nix index ccf4632ad6ec..20c17e77d6e1 100644 --- a/pkgs/development/tools/global-platform-pro/default.nix +++ b/pkgs/development/tools/global-platform-pro/default.nix @@ -2,94 +2,94 @@ # TODO: This is quite a bit of duplicated logic with gephy. Factor it out? stdenv.mkDerivation rec { - pname = "global-platform-pro"; - version = "0.3.10-rc11"; - describeVersion = "v0.3.10-rc11-0-g8923747"; # git describe --tags --always --long --dirty - name = "${pname}-${version}"; + pname = "global-platform-pro"; + version = "0.3.10-rc11"; + describeVersion = "v0.3.10-rc11-0-g8923747"; # git describe --tags --always --long --dirty + name = "${pname}-${version}"; - src = fetchFromGitHub { - owner = "martinpaljak"; - repo = "GlobalPlatformPro"; - rev = "v${version}"; - sha256 = "0rk81x2y7vx1caxm6wa59fjrfxmjn7s8yxaxm764p8m2qxk3m4y2"; - }; + src = fetchFromGitHub { + owner = "martinpaljak"; + repo = "GlobalPlatformPro"; + rev = "v${version}"; + sha256 = "0rk81x2y7vx1caxm6wa59fjrfxmjn7s8yxaxm764p8m2qxk3m4y2"; + }; - # This patch hardcodes the return of a git command the build system tries to - # run. As `fetchFromGitHub` doesn't fetch a full-fledged git repository, - # this command can only fail at build-time. As a consequence, we include the - # `describeVersion` variable defined above here. - patches = [ (writeText "${name}-version.patch" '' - diff --git a/pom.xml b/pom.xml - index 1e5a82d..1aa01fe 100644 - --- a/pom.xml - +++ b/pom.xml - @@ -121,14 +121,10 @@ - - - - - git - + echo - target/generated-resources/pro/javacard/gp/pro_version.txt - - - describe - - --tags - - --always - - --long - - --dirty - + ${describeVersion} - - - - '') ]; - - deps = stdenv.mkDerivation { - name = "${name}-deps"; - inherit src patches; - nativeBuildInputs = [ jdk maven ]; - buildPhase = '' - while ! mvn package "-Dmaven.repo.local=$out/.m2" -Dmaven.wagon.rto=5000; do - echo "timeout, restart maven to continue downloading" - done - ''; - # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside - installPhase = '' - find "$out/.m2" -type f \ - -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' \ - -delete - ''; - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - outputHash = "15bbi7z9v601all9vr2azh8nk8rpz2vd91yvvw8id6birnbhn3if"; - }; - - nativeBuildInputs = [ jdk maven makeWrapper ]; + # This patch hardcodes the return of a git command the build system tries to + # run. As `fetchFromGitHub` doesn't fetch a full-fledged git repository, + # this command can only fail at build-time. As a consequence, we include the + # `describeVersion` variable defined above here. + patches = [ (writeText "${name}-version.patch" '' + diff --git a/pom.xml b/pom.xml + index 1e5a82d..1aa01fe 100644 + --- a/pom.xml + +++ b/pom.xml + @@ -121,14 +121,10 @@ + + + + - git + + echo + target/generated-resources/pro/javacard/gp/pro_version.txt + + - describe + - --tags + - --always + - --long + - --dirty + + ${describeVersion} + + + + '') ]; + deps = stdenv.mkDerivation { + name = "${name}-deps"; + inherit src patches; + nativeBuildInputs = [ jdk maven ]; buildPhase = '' - cp -dpR "${deps}/.m2" ./ - chmod -R +w .m2 - mvn package --offline -Dmaven.repo.local="$(pwd)/.m2" + while ! mvn package "-Dmaven.repo.local=$out/.m2" -Dmaven.wagon.rto=5000; do + echo "timeout, restart maven to continue downloading" + done ''; - + # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside installPhase = '' - mkdir -p "$out/lib/java" "$out/share/java" - cp -R target/apidocs "$out/doc" - 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" + find "$out/.m2" -type f \ + -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' \ + -delete ''; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "15bbi7z9v601all9vr2azh8nk8rpz2vd91yvvw8id6birnbhn3if"; + }; + + nativeBuildInputs = [ jdk maven makeWrapper ]; - meta = with stdenv.lib; { - 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. + buildPhase = '' + cp -dpR "${deps}/.m2" ./ + chmod -R +w .m2 + mvn package --offline -Dmaven.repo.local="$(pwd)/.m2" + ''; - 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 = https://github.com/martinpaljak/GlobalPlatformPro; - license = with licenses; [ lgpl3 ]; - platforms = platforms.all; - }; + installPhase = '' + mkdir -p "$out/lib/java" "$out/share/java" + cp -R target/apidocs "$out/doc" + 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" + ''; + + meta = with stdenv.lib; { + 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;`. + ''; + homepage = https://github.com/martinpaljak/GlobalPlatformPro; + license = with licenses; [ lgpl3 ]; + platforms = platforms.all; + }; } -- cgit 1.4.1 From 61e0b8d3be4a9dcf930c5625e38f3a2bf85575b0 Mon Sep 17 00:00:00 2001 From: Léo Gaspard Date: Fri, 17 Aug 2018 01:13:46 +0900 Subject: fixup: use the correct gephy package name --- pkgs/development/tools/global-platform-pro/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/tools/global-platform-pro/default.nix b/pkgs/development/tools/global-platform-pro/default.nix index 20c17e77d6e1..5848f131d73c 100644 --- a/pkgs/development/tools/global-platform-pro/default.nix +++ b/pkgs/development/tools/global-platform-pro/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchFromGitHub, jdk, maven, writeText, makeWrapper, jre_headless, pcsclite }: -# TODO: This is quite a bit of duplicated logic with gephy. Factor it out? +# TODO: This is quite a bit of duplicated logic with gephi. Factor it out? stdenv.mkDerivation rec { pname = "global-platform-pro"; version = "0.3.10-rc11"; -- cgit 1.4.1 From fd14b4d48de0b7ad6b4d5beeaaf6eadb50f68d09 Mon Sep 17 00:00:00 2001 From: Léo Gaspard Date: Fri, 17 Aug 2018 01:27:45 +0900 Subject: fixup: merge buildPhase and installPhase --- pkgs/development/tools/global-platform-pro/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/development/tools/global-platform-pro/default.nix b/pkgs/development/tools/global-platform-pro/default.nix index 5848f131d73c..8bdb14c7c657 100644 --- a/pkgs/development/tools/global-platform-pro/default.nix +++ b/pkgs/development/tools/global-platform-pro/default.nix @@ -46,13 +46,14 @@ stdenv.mkDerivation rec { name = "${name}-deps"; inherit src patches; nativeBuildInputs = [ jdk maven ]; - buildPhase = '' + installPhase = '' + # Download the dependencies while ! mvn package "-Dmaven.repo.local=$out/.m2" -Dmaven.wagon.rto=5000; do echo "timeout, restart maven to continue downloading" done - ''; - # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside - installPhase = '' + + # And keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files + # with lastModified timestamps inside find "$out/.m2" -type f \ -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' \ -delete -- cgit 1.4.1 From 6195eee47a11fbc73e655e619cc3162af245c25e Mon Sep 17 00:00:00 2001 From: Léo Gaspard Date: Fri, 17 Aug 2018 01:32:03 +0900 Subject: fixup: add links to upstream issues --- pkgs/development/tools/global-platform-pro/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/global-platform-pro/default.nix b/pkgs/development/tools/global-platform-pro/default.nix index 8bdb14c7c657..7c697bc5e576 100644 --- a/pkgs/development/tools/global-platform-pro/default.nix +++ b/pkgs/development/tools/global-platform-pro/default.nix @@ -3,7 +3,7 @@ # TODO: This is quite a bit of duplicated logic with gephi. Factor it out? stdenv.mkDerivation rec { pname = "global-platform-pro"; - version = "0.3.10-rc11"; + version = "0.3.10-rc11"; # Waiting for release https://github.com/martinpaljak/GlobalPlatformPro/issues/128 describeVersion = "v0.3.10-rc11-0-g8923747"; # git describe --tags --always --long --dirty name = "${pname}-${version}"; @@ -18,6 +18,8 @@ stdenv.mkDerivation rec { # run. As `fetchFromGitHub` doesn't fetch a full-fledged git repository, # this command can only fail at build-time. As a consequence, we include the # `describeVersion` variable defined above here. + # + # See upstream issue https://github.com/martinpaljak/GlobalPlatformPro/issues/129 patches = [ (writeText "${name}-version.patch" '' diff --git a/pom.xml b/pom.xml index 1e5a82d..1aa01fe 100644 -- cgit 1.4.1