This is a Nix language server that directly uses (i.e., is linked with) the official Nix library (https://github.com/NixOS/nix).
Some notable features provided by linking with the Nix library include:
- Nixpkgs option support, for all option system (NixOS/home-manager/flake-parts).
- Diagnostics and evaluation that produce identical results as the real Nix command.
- Shared eval caches (flake, file) with your system's Nix.
- Native support for cross-file analysis (goto definition to locations in nixpkgs).
- Precise Nix language support. We do not maintain "yet another parser & evaluator".
- Support for built-ins, including Nix plugins.
Home-manager options auto-completion & goto declaration
See how to configure option system: https://github.com/nix-community/nixd/blob/main/docs/user-guide.md#options
Native cross-file analysis
We support goto-definition on nix derivations!
Just Ctrl + click
to see where is a package defined.
And also for nix lambda:
See how to configure the evaluator for cross-file analysis: https://github.com/nix-community/nixd/blob/main/docs/user-guide.md#evaluation
- Editor Setup
- User Guide
- Configuration Examples
- Developers' Manual (internal design, contributing):
- Project matrix room: https://matrix.to/#/#nixd:matrix.org
.
├── default.nix
├── docs
├── editors
├── flake.lock
├── flake.nix
├── LICENSE
├── lspserver # The C++ library for writing LSP servers.
├── meson.build
├── nixd # Modularized nixd components, test suite, and tools (binary)
│ ├── include # General header files
│ ├── lib
│ │ ├── AST # AST library for nix expressions, static analysis (rename, completion, location, range) & evaluation bindings.
│ │ ├── Expr # Expressions library (single AST nodes) with name lookups, locations, ...
│ │ ├── meson.build
│ │ ├── Nix # Extension to NixOS/nix
│ │ ├── Parser # Extension to the parser from NixOS/nix. with ranges support & error handling.
│ │ ├── Server # The nixd server library with controller (the process interacting with clients) and multiple workers (option, eval).
│ │ └── Support
│ ├── meson.build
│ ├── test # Library tests. (rarely used)
│ └── tools
│ ├── meson.build
│ ├── nix-ast-dump # Dump nix AST from the offical parser (NixOS/nix)
│ │ ├── meson.build
│ │ ├── nix-ast-dump.cpp
│ │ └── test
│ ├── nixd # The nixd binary (entry point)
│ │ ├── meson.build
│ │ ├── nixd.cpp
│ │ └── test # The regression tests.
│ └── nixd-ast-dump # Dump the AST nodes parsed from the extended parser, check leaks & memory safety.
│ ├── meson.build
│ ├── nixd-ast-dump.cpp
│ └── test
└── README.md