{
  pkgs,
  base,
  lib,
  stdenv,
  system,
  makeWrapper,
  jdk17,
  xorg,
  openjfx17,
  glib,
  alsa-lib,
  libGL,
  gtk3,
  ...
}:
stdenv.mkDerivation rec {
  pname = "base-demo";
  version = "0.0.1";

  src = ./.;

  nativeBuildInputs = [base.packages.${system}.default makeWrapper];

  buildPhase = ''
    base-editor -bHp $src/project.json -o build
  '';

  installPhase = ''
    mkdir -p $out/bin
    mkdir -p $out/share/java

    cp build/out/game.jar $out/share/java/base-demo-game.jar

    makeWrapper "${jdk17}/bin/java" $out/bin/base-demo \
      --add-flags "-jar $out/share/java/base-demo-game.jar" \
      --prefix LD_LIBRARY_PATH : "${xorg.libXtst}/lib" \
      --prefix LD_LIBRARY_PATH : "${openjfx17}/lib" \
      --prefix LD_LIBRARY_PATH : "${glib.out}/lib" \
      --prefix LD_LIBRARY_PATH : "${alsa-lib}/lib" \
      --prefix LD_LIBRARY_PATH : "${libGL}/lib" \
      --prefix LD_LIBRARY_PATH : "${gtk3}/lib"
  '';
}
