Using nimlangserver (LSP) in Emacs with Eglot

I've been changing my Doom Emacs config around a bit this last week, and wanting to give Eglot a shot, given that it's lightweight and built-in. Turns out that some languages aren't as simple as others to switch over.

What I had to do was add the following code block, inspired by what is required to make Deno's LSP work with Eglot:

(after! eglot
  (defclass eglot-nim (eglot-lsp-server) ()
    :documentation "A custom class for Nim's LSP.")
  (add-to-list 'eglot-server-programs '((nim-mode) . (eglot-nim "nimlangserver")))
  (cl-defmethod eglot-initialization-options ((server eglot-nim))
    "Passes through required initialization options"
    (list :enable t :lint t)))

With that, everything seems to work perfectly with Doom Emacs + Eglot + nimlangserver. This may or may not work with nimlsp (provided you replace the names obviously). I haven't tried, because I don't use it.