Utilizing dap in NixVim

So, I’ve been messing around with some new plugins to NixVim of which I have had a lot of trouble trying to get dap to work. Currently I am just attempting to get it to work with a minimal mvn project (so that I can then trey getting neotest to work) but is proving to be quite a challenge. My current dap setup looks like this:

╭──────────────────────────────────────────────────────────────────────────────────╮
│ plugins.dap = {                                                                  │
│     enable = true;                                                               │
│     configurations = {                                                           │
│         java = [                                                                 │
│             {                                                                    │
│                 type = "java";                                                   │
│                 request = "launch";                                              │
│                 name = "java";                                                   │
│                 hostName = "127.0.0.1";                                          │
│                 port = 5005;                                                     │
│             }                                                                    │
│         ];                                                                       │
│     };                                                                           │
│     adapters.servers.java = {                                                    │
│     host = "127.0.0.1";                                                          │
│     port = 5005;                                                                 │
│     id = "2";                                                                    │
│     executable = {                                                               │
│       command = ''                                                               │
│         config = function()                                                      │
│              require("java").setup {}                                            │
│              require("lspconfig").jdtls.setup {                                  │
│                on_attach = require("plugins.configs.lspconfig").on_attach,       │
│                capabilities = require("plugins.configs.lspconfig").capabilities, │
│                filetypes = { "java" },                                           │
│              }                                                                   │
│            end,                                                                  │
│       '';                                                                        │
│     };                                                                           │
│   };                                                                             │
│ };                                                                               │
╰──────────────────────────────────────────────────────────────────────────────────╯

I do not expect this to actually work, however, the error that is thrown is not what I would expect:

...pack/myNeovimPackages/start/nvim-dap/lua/dap/session.lua:1203: ENAMETOOLONG: name too long                                                                                     
stack traceback:                                                                                                                                                                            
^I[C]: in function 'error'                                                                                                                                                                  

I am unsure what exactly causes this (wild guess is path to the jdtls) but according to the luaposix docs this error is thrown when a filename is too long which I don’t have the slightest clue on how to fix so would appreciate some tips/help or another way to get dap to work.

hi, im also new to nix so i’m not really sure if this is correct but according to my knowledge i think command options should be a path to the executables where a function like the one you specified should be in the enrichConfig option. mine is configured like this for golang:

  programs.nixvim.plugins.dap = {
    enable = true;

    adapters = {
      servers = {
        delve = {
          host = "127.0.0.1";
          port = "\${port}";

          executable = {
            command = lib.getExe pkgs.delve;
            args = [ "dap" "-l" "127.0.0.1:\${port}" "--log" "--log-output=dap" ];
          };
        };
      };
    };

    configurations = {
      go = [
        {
          name = "delve";
          type = "delve";
          request = "launch";
          program = "\${file}";
        }
      ];
    };
  };