all repos — nixfiles @ 339a09090a926535f67f855890d97e41673f642a

System and user configuration, managed by nix and home-manager

Install nil as a langserver for nix
Alan Pearce alan@alanpearce.eu
Tue, 14 Mar 2023 20:07:16 +0100
commit

339a09090a926535f67f855890d97e41673f642a

parent

9bf85a0fc518d6003943aba1bcf5637e2cda412f

3 files changed, 9 insertions(+), 0 deletions(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -1030,10 +1030,12 @@ css-mode-hook             go-mode-hook
             scss-mode-hook
             html-mode-hook
+            nix-mode-hook
             haskell-mode-hook)
           #'eglot-ensure)
   :config (progn
 						(add-to-list 'eglot-stay-out-of 'company)
+            (add-to-list 'eglot-server-programs '(nix-mode . ("nil")))
             (defun my/setup-eglot-eldoc ()
               (push 'flymake-eldoc-function eldoc-documentation-functions))
             (add-hook 'eglot-managed-mode-hook 'my/setup-eglot-eldoc)))
M user/settings/base.nixuser/settings/base.nix
@@ -33,6 +33,12 @@ enable = true;       settings = {
         "json.enable" = true;
         "suggest.enablePreview" = true;
+        languageserver = {
+          nix = {
+            command = "${pkgs.nil}/bin/nil";
+            filetypes = [ "nix" ];
+          };
+        };
       };
     };
   };
M user/settings/nix.nixuser/settings/nix.nix
@@ -5,6 +5,7 @@ ... }: {
   nixpkgs.config = import ../config.nix;
   home.packages = with pkgs; [
+    nil
     nix-prefetch-scripts
     alejandra # nix formatter
   ];