Skip to content

Commit

Permalink
nixd/docs/configuration: add Emacs configuration (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
breitnw authored Oct 29, 2024
1 parent d3c7e56 commit 20290ee
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions nixd/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,33 @@ nvim_lsp.nixd.setup({
```
</details>

<details>
<summary>Emacs</summary>

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 <nixpkgs> { }"
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))
```
</details>

### Configuration overview

> [!NOTE]
Expand Down

0 comments on commit 20290ee

Please sign in to comment.