(require 'common-lsp)
(require 'util-tree-sitter)

(use-package nix-mode
  :mode (("\\.nix\\'" . nix-mode)
         )
  :commands nix-mode
  :hook (
         (nix-mode . (lambda ()
                       (eglot-ensure)
                       (defclass my/eglot-nix (eglot-lsp-server) ()
                         :documentation
                         "Own eglot server class.")

                       (add-to-list 'eglot-server-programs
                                    '(nix-mode . (my/eglot-nix "nixd")))
                       (add-hook 'before-save-hook 'eglot-format-buffer nil 'local)
                       ))
         )
  )

(provide 'lang-nix)
