{ depot, pkgs, ... }:
let
  inherit (pkgs) stdenvNoCC fetchurl makeWrapper;
  java = pkgs.jdk;
in
stdenvNoCC.mkDerivation rec {
  pname = "tiny-remapper";
  version = "0.3.2";

  src = fetchurl {
    url = "https://maven.fabricmc.net/net/fabricmc/tiny-remapper/${version}/tiny-remapper-${version}-fat.jar";
    sha256 = "d8301fbe684d10849003dc92d18f24ec53cf755c3a6fdfe371d581cb30bd47e1";
  };

  dontBuild = true;
  dontUnpack = true;

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    mkdir -p $out/lib $out/bin
    cp $src $out/lib/tiny-remapper-${version}-fat.jar
    makeWrapper ${java}/bin/java $out/bin/tiny-remapper \
      --set JAVA_HOME ${java} \
      --add-flags "-jar $out/lib/tiny-remapper-${version}-fat.jar"
  '';
}