#
# Hacks to make jd-gui run on wayland.
#
{ ... }:
let
  package = "jd-gui";

  overlay = final': prev': {

    ${package} = prev'.${package}.overrideAttrs (
      final: prev: {

        # Patch the installed binary to be nice.
        installPhase = builtins.replaceStrings [ "export" ] [
          "export _JAVA_AWT_WM_NONREPARENTING=1; export"
        ] prev.installPhase;

      }
    );
  };
in
{
  nixpkgs.overlays = [ overlay ];
}
