OpenJDK SEGV when trying to build Kotlin Native CInterop lib

I’m trying to build (and eventually package) gtk-kn on my NixOS machine. Following the development instructions, I’ve constructed the following devShell flake:

{
  inputs = {};

  outputs = { self, nixpkgs, ... }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; };
    in {
      devShells.${system}.default = (pkgs.buildFHSUserEnv {
         name = "gtk-kn-dev";
         targetPkgs = pkgs: with pkgs;
           [
             openjdk17
           ];
         multiPkgs = pkgs: with pkgs; [
           gobject-introspection.dev
           glib.dev
           gtk4.dev
           libadwaita.dev
         ];
         runScript = "zsh";
       }).env;
    };
}

Running nix develop works. Then, following the build instructions, I get to step 3 and run ./gradlew assemble --no-daemon:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ffff1740ec9, pid=157427, tid=157496
#
# JRE version: OpenJDK Runtime Environment (17.0.6+10) (build 17.0.6+10-nixos)
# Java VM: OpenJDK 64-Bit Server VM (17.0.6+10-nixos, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x540ec9]  AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<598116ul, G1BarrierSet>, (AccessInternal::BarrierType)2, 598116ul>::oop_access_barrier(void*)+0x9
#
# Core dump will be written. Default location: Core dumps may be processed with "/nix/store/m256q16dmb3ad579brv7q43bj8zss0s3-systemd/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to ~/Projects/gtk-kn/bindings/core/glib/core.157427)
#
# An error report file with more information is saved as:
# ~/Projects/gtk-kn/bindings/core/glib/hs_err_pid157427.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/
#

error report

I’m not at all familiar with debugging core dumps, and am unsure where to go from here. The installation does work on my non-NixOS workstation, so presumably there’s something Nix-specific happening.

Any insight or guidance would be greatly appreciated!

Have the same problem when compiling my kotlin native library. Did you find out the reason why it does not work?

I have not. I think the next step might be to file an official bug on nixpkgs, but I haven’t gotten around to it just yet.