How do I migrate this expression to NixOS 23.11?

In NixOS 23.05 I used the following expression, as suggested in #215583:

# Add dependency of https://gubaer.github.io/josm-scripting-plugin/
josm.override {
  jre = graalvm17-ce.override {
    products = with graalvmCEPackages; [
      js-installable-svm-java17
    ];
  };
}

What is the equivalent expression in NixOS 23.11? The products input no longer exists and I’m not familiar enough with Java to understand what to do now.

Just replace graalvm17-ce with graalvm-ce

https://github.com/NixOS/nixpkgs/pull/257433/files#diff-29ed0f5fda84c91253503c1664d60a194a324e29518d472adf846f30b8db52e3R692

unexpected argument ‘products’

Maybe for josm, it would be enought to do:

josm.override {
  jre = graalvmCEPackages.graaljs;
}

No, graalvmCEPackages.graaljs alone doesn’t provide the required ${jre}/bin/java.

I do not know java/graal enough. The only other idea I have is to follow this path and to replace your override with:

let
  graaljs-jars = pkgs.fetchzip {
    url = "https://github.com/Gubaer/josm-scripting-plugin-graaljs/releases/download/23.0.0/graaljs-23.0.0.zip";
    hash = "";
   };
in
josm.override { extraJavaOpts = ''--module-path "${graaljs-jars}/lib" --add-modules org.graalvm.sdk,org.graalvm.js,com.oracle.truffle.regex,org.graalvm.truffle -Djosm.restart=true -Djava.net.useSystemProxies=true'';  }

Not tested and I am not sure about the GraalJs version.

Thanks! That pointed me in the right direction. It works to switch graaljs to its -jvm release which includes the required modules, and pass those to JOSM:

{
  # Include modules in GraalJS
  graalvmCEPackages = graalvmCEPackages // {
    graaljs = graalvmCEPackages.graaljs.overrideAttrs (g: {
      src = fetchurl { url = replaceStrings [ "community" ] [ "community-jvm" ] g.src.url; hash = "…"; };
      buildInputs = g.buildInputs ++ graalvm-ce.buildInputs;
    });
  };

  # Add dependency of https://gubaer.github.io/josm-scripting-plugin/
  josm = josm.override {
    jre = graalvm-ce;
    extraJavaOpts = "--module-path=${graalvmCEPackages.graaljs}/modules";
  };
}

Though it feels silly to pull in a second JVM and not use it. I suspect I’m still not using this as intended.