From a9860a986f2d4159904dfc4fdb8c4c98b4320ffd Mon Sep 17 00:00:00 2001 From: Ruixi-rebirth Date: Wed, 24 Apr 2024 22:30:44 +0800 Subject: [PATCH] docs: improving nvim configuration nixd (#459) --- nixd/docs/configuration.md | 45 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/nixd/docs/configuration.md b/nixd/docs/configuration.md index 7ab505650..0f265ec56 100644 --- a/nixd/docs/configuration.md +++ b/nixd/docs/configuration.md @@ -81,31 +81,32 @@ For vscode users you should write `settings.json`[^settings] like this:
Neovim - Write your settings in Lua, in `setup()` function argument. + + Configuration via [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) plugin. If you want to make configuration changes based on different projects, you can see nvim-lspconfig official [wiki-Project_local_settings](https://github.com/neovim/nvim-lspconfig/wiki/Project-local-settings) ```lua - nvim_lsp.nixd.setup({ - on_attach = on_attach(), - capabilities = capabilities, - settings = { - nixd = { - nixpkgs = { - expr = "import { }", - }, - formatting = { - command = { "nixpkgs-fmt" }, - }, - options = { - nixos = { - expr = '(builtins.getFlake "/tmp/NixOS_Home-Manager").nixosConfigurations.hostname.options', - }, - home_manager = { - expr = '(builtins.getFlake "/tmp/NixOS_Home-Manager").homeConfigurations."user@hostname".options', - }, - }, +local nvim_lsp = require("lspconfig") +nvim_lsp.nixd.setup({ + cmd = { "nixd" }, + settings = { + nixd = { + nixpkgs = { + expr = "import { }", + }, + formatting = { + command = { "nixpkgs-fmt" }, + }, + options = { + nixos = { + expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.k-on.options', + }, + home_manager = { + expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."ruixi@k-on".options', }, - }, - }) + }, + }, + }, +}) ```