diff --git a/pkgs/tools/security/jd-cli/default.nix b/pkgs/tools/security/jd-cli/default.nix new file mode 100644 index 000000000000..c57230bbd5a4 --- /dev/null +++ b/pkgs/tools/security/jd-cli/default.nix @@ -0,0 +1,62 @@ +{ lib, stdenv, fetchFromGitHub, jre, makeWrapper, maven }: + +let + pname = "jd-cli"; + version = "1.2.1"; + + src = fetchFromGitHub { + owner = "intoolswetrust"; + repo = pname; + rev = "${pname}-${version}"; + hash = "sha256-rRttA5H0A0c44loBzbKH7Waoted3IsOgxGCD2VM0U/Q="; + }; + + deps = stdenv.mkDerivation { + name = "${pname}-${version}-deps"; + inherit src; + + nativeBuildInputs = [ maven ]; + buildPhase = '' + mvn package -Dmaven.repo.local=$out + ''; + + # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside + installPhase = '' + find $out -type f \ + -name \*.lastUpdated -or \ + -name resolver-status.properties -or \ + -name _remote.repositories \ + -delete + ''; + + dontFixup = true; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "sha256-5d3ZLuzoEkPjh01uL/BuhJ6kevLdsm1P4PMLkEWaVUM="; + }; + +in stdenv.mkDerivation rec { + inherit pname version src; + + nativeBuildInputs = [ maven makeWrapper ]; + + buildPhase = '' + mvn --offline -Dmaven.repo.local=${deps} package; + ''; + + installPhase = '' + mkdir -p $out/bin $out/share/jd-cli + install -Dm644 jd-cli/target/jd-cli.jar $out/share/jd-cli + + makeWrapper ${jre}/bin/java $out/bin/jd-cli \ + --add-flags "-jar $out/share/jd-cli/jd-cli.jar" + ''; + + meta = with lib; { + description = "Simple command line wrapper around JD Core Java Decompiler project"; + homepage = "https://github.com/intoolswetrust/jd-cli"; + license = licenses.gpl3; + platforms = platforms.unix; + maintainers = with maintainers; [ majiir ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6905d570759e..2bd1cb2f5c62 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8101,6 +8101,8 @@ with pkgs; jc = with python3Packages; toPythonApplication jc; + jd-cli = callPackage ../tools/security/jd-cli { }; + jd-diff-patch = callPackage ../development/tools/jd-diff-patch { }; jd-gui = callPackage ../tools/security/jd-gui { };