Creating Jetbrains Idea Wrapper Overlay

I am trying to create an overlay for Intellij Idea that wraps the binary with some environment variables.
I tried this:

      (self: super: {
      jetbrains = super.jetbrains // {
        idea-community = pkgs.symlinkJoin {
          name = "idea-community";
          paths = [ super.jetbrains.idea-community ];
          buildInputs = [ pkgs.makeWrapper ];
          postBuild = ''
            wrapProgram $out/bin/idea-community --set GDK_SCALE 2 --set XCURSOR_SIZE 64
          '';
        };
      };
    })

However, paths = [ super.jetbrains.idea-community ]; gives an infinite recursion error. I’m not sure how to refer to the original path here. Any help is greatly appreciated!

Don’t use super since super includes your overlay, use self instead.

      (self: super: {
      jetbrains = self.jetbrains // {
        idea-community = pkgs.symlinkJoin {
          name = "idea-community";
          paths = [ self.jetbrains.idea-community ];
          buildInputs = [ pkgs.makeWrapper ];
          postBuild = ''
            wrapProgram $out/bin/idea-community --set GDK_SCALE 2 --set XCURSOR_SIZE 64
          '';
        };
      };
    })

I gave this code a try, and unfortunately still ran into a similar infinite recursion error:

error: infinite recursion encountered

       at /nix/store/74g1wnpq5ca2pzygkh2a66yimr78r6xp-source/modules/hyprland/default.nix:51:7:

           50|     (self: super: {
           51|       jetbrains = self.jetbrains // {
             |       ^
           52|         idea-community = pkgs.symlinkJoin {

I’m really not sure how this code causes infinite recursion.

Somehow, going back to my original idea is now working. I have no idea what has changed, but it seems to work as expected.