diff --git a/nixd/docs/configuration.md b/nixd/docs/configuration.md index d162b25a..f20f25e2 100644 --- a/nixd/docs/configuration.md +++ b/nixd/docs/configuration.md @@ -110,6 +110,33 @@ nvim_lsp.nixd.setup({ ``` +
+ Emacs + + Configuration via [lsp-mode](https://github.com/emacs-lsp/lsp-mode) plugin. As of Oct 24, 2024, lsp-mode master has support for nixd autocompletion and formatting options. + + ```elisp +(use-package nix-mode + :after lsp-mode + :ensure t + :hook + (nix-mode . lsp-deferred) ;; So that envrc mode will work + :custom + (lsp-disabled-clients '((nix-mode . nix-nil))) ;; Disable nil so that nixd will be used as lsp-server + :config + (setq lsp-nix-nixd-server-path "nixd" + lsp-nix-nixd-formatting-command [ "nixfmt" ] + lsp-nix-nixd-nixpkgs-expr "import { }" + lsp-nix-nixd-nixos-options-expr "(builtins.getFlake \"/home/nb/nixos\").nixosConfigurations.mnd.options" + lsp-nix-nixd-home-manager-options-expr "(builtins.getFlake \"/home/nb/nixos\").homeConfigurations.\"nb@mnd\".options")) + +(add-hook! 'nix-mode-hook + ;; enable autocompletion with company + (setq company-idle-delay 0.1)) + + ``` +
+ ### Configuration overview > [!NOTE]