summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-09-17 14:25:39 -0700
committerFranck Cuny <franck@fcuny.net>2022-09-17 14:25:39 -0700
commitfebc80e812bbb28af467751d487cf4d2e2d63c90 (patch)
treecb4b2b2daef9c0f5cde863f7486df04ed7a9cf6a
parentref(tree-sitter): move the configuration to its own file (diff)
downloademacs.d-febc80e812bbb28af467751d487cf4d2e2d63c90.tar.gz
feat(lang/nix): configure Emacs for nix
Change-Id: I4e92859e96362268431bde6dd4a81f73a8796b0d
-rw-r--r--emacs/custom/my-lang-nix.el21
-rw-r--r--emacs/init.el1
2 files changed, 22 insertions, 0 deletions
diff --git a/emacs/custom/my-lang-nix.el b/emacs/custom/my-lang-nix.el
new file mode 100644
index 0000000..9de5c50
--- /dev/null
+++ b/emacs/custom/my-lang-nix.el
@@ -0,0 +1,21 @@
+;;; my-lang-nix.el --- configure emacs for nix -*- lexical-binding: t -*-
+;; Author: Franck Cuny <franck@fcuny.net>
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
+(lsp-register-client
+ (make-lsp-client :new-connection
+                  (lsp-stdio-connection '("rnix-lsp"))
+                  :major-modes '(nix-mode)
+                  :server-id 'nix))
+
+(add-hook 'nix-mode-hook #'lsp-deferred)
+
+(provide 'my-lang-nix)
+
+;;; my-lang-nix.el ends here
diff --git a/emacs/init.el b/emacs/init.el
index 910bae5..eec012e 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -54,6 +54,7 @@
 (require 'my-lang-go)
 (require 'my-lang-python)
 (require 'my-lang-rust)
+(require 'my-lang-nix)
 
 (require 'my-buffers)
 (require 'my-git-extra)